bopf retrive and retrive by association

Upload: mayur-bulbule

Post on 18-Oct-2015

437 views

Category:

Documents


2 download

DESCRIPTION

BOPF Retrive and Retrive by Association

TRANSCRIPT

Test: Simple report to demonstrate use of Retrieve and Retrieve by association methods.

REPORTztest_m1.DATA:lr_srv_mgrTYPEREFTO/bobf/if_tra_service_manager,lt_trq_idTYPEztrq_id_t,lt_trq_keyTYPE/bobf/t_frw_key,lt_dbtableTYPETABLEOFzmay_d_root,ls_dbtableTYPEzmay_d_root,ls_trq_idTYPEztrq_id_s,lt_item_dataTYPEzmay_t_item,lt_messageTYPEREFTO/bobf/if_frw_message,lt_changeTYPEREFTO/bobf/if_tra_change,lt_root_dataTYPEzmay_t_root,lt_failed_keyTYPE/bobf/t_frw_key.

DATA:lt_key_linkTYPE/bobf/t_frw_key_link,lt_target_keyTYPE/bobf/t_frw_key.

IF(lr_srv_mgrISNOTBOUND).lr_srv_mgr=/bobf/cl_tra_serv_mgr_factory=>get_service_manager(zif_may_trq1_c=>sc_bo_key)."PassingNodeIDENDIF.

SELECT*FROMzmay_d_rootINTOTABLElt_dbtable.

LOOPATlt_dbtableINTOls_dbtable.ls_trq_id-trq_id=ls_dbtable-trq_id.APPENDls_trq_idTOlt_trq_id.ENDLOOP.

CALLMETHODlr_srv_mgr->convert_altern_key"Convertanalternativekeytothetechnicalkey.*ConvertIDsintoBOPFkeys**convertsalistofTRQIDsintothecorrespondingRootnodekeysEXPORTINGiv_node_key=zif_may_trq1_c=>sc_node-root"Nodeiv_altkey_key=zif_may_trq1_c=>sc_alternative_key-root-ztrq_id"AlternativeKeyit_key=lt_trq_id"NodeKeyIMPORTINGet_key=lt_trq_key"KeyTable.

CALLMETHODlr_srv_mgr->retrieve"retrievethedatafortheRootnodekeys*UsemethodRRETRIEVEtoretrieveROOTdataEXPORTINGiv_node_key=zif_may_trq1_c=>sc_node-root"Nodeit_key=lt_trq_key"KeyTableiv_fill_data=abap_true",Data.elementfordomainBOOLE:TRUE(='X')andFALSE(='')IMPORTINGet_data=lt_root_data*et_failed_key=lt_failed_key"KeyTable.

CALLMETHODlr_srv_mgr->retrieve_by_association*UsemethodRetrievebyAssociationtoretrieveITEMnodedataEXPORTINGiv_node_key=zif_may_trq1_c=>sc_node-root"Nodeit_key=lt_trq_key"KeyTableiv_association=zif_may_trq1_c=>sc_association-root-item"Associationiv_fill_data=abap_true"DataelementfordomainBOOLE:TRUE(='X')andFALSE(='')IMPORTINGeo_message=lt_message"InterfaceofMessageObjecteo_change=lt_change"InterfaceofChangeObjectet_data=lt_item_dataet_key_link=lt_key_link"KeyLinket_target_key=lt_target_key"KeyTableet_failed_key=lt_failed_key"KeyTable.

BREAK-POINT.