Test FAG CAPACITY
unknown
abap
8 months ago
4.4 kB
5
Indexable
Never
*&---------------------------------------------------------------------* *& Report ZFAG_TEST *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT zfag_test. DATA: lr_srvmgr_trq TYPE REF TO /bobf/if_tra_service_manager, lr_srvmgr_fag TYPE REF TO /bobf/if_tra_service_manager, lt_fag_itm_key TYPE zcl_tm_md_cds_helper=>gtt_fag_itm_key, ls_fag_itm_key TYPE zcl_tm_md_cds_helper=>gty_fag_itm_key. DATA: lt_fag_item_key TYPE /bobf/t_frw_key, lt_fag_item_root_key TYPE /bobf/t_frw_key, lt_trq_root_key TYPE /bobf/t_frw_key, lt_fag_main_keys TYPE /bobf/t_frw_key. DATA: lt_fag_root TYPE /scmtms/t_fag_root_k, lt_fag_items TYPE /scmtms/t_fag_items_k, lt_fag_items_main TYPE /scmtms/t_fag_items_k. "lt_trq_root TYPE /scmtms/t_trq_root_k. DATA lt_trq_root TYPE /scmtms/t_trq_q_result. DATA it_sel_par_trq TYPE /bobf/t_frw_query_selparam. DATA ls_sel_par LIKE LINE OF it_sel_par_trq. DATA it_sel_par_fitem TYPE /bobf/t_frw_query_selparam. DATA ls_sel_par_fitem LIKE LINE OF it_sel_par_fitem. "FILL FAG ITEM for TRQ ROOT QUERY."""""""""" ls_sel_par-attribute_name = 'FAG_ITEM_KEY'. ls_sel_par-option = 'EQ'. ls_sel_par-sign = 'I'. ls_sel_par-low = '0285F58EED6E1EDCA6DBC02A4898B14D'. APPEND ls_sel_par TO it_sel_par_trq. """""""""""""""""""""""""""""""""""""""""""" lt_fag_item_key = VALUE #( ( key = '0285F58EED6E1EDCA6DBC02A4898B14D' ) ). * TRQ object instances lr_srvmgr_trq = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_trq_c=>sc_bo_key ). lr_srvmgr_fag = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_fag_c=>sc_bo_key ). "retrieve FAG ITEMS lr_srvmgr_fag->retrieve( EXPORTING iv_node_key = /scmtms/if_fag_c=>sc_node-items it_key = lt_fag_item_key IMPORTING et_data = lt_fag_items ). "Retrieve FAG Root. lr_srvmgr_fag->retrieve_by_association( EXPORTING iv_node_key = /scmtms/if_fag_c=>sc_node-items " Node it_key = lt_fag_item_key " Key Table iv_association = /scmtms/if_fag_c=>sc_association-items-to_root " Association iv_fill_data = abap_true " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ') IMPORTING et_data = lt_fag_root ). "RETRIEVE TRQ ROOT from FAG ITEMS. lr_srvmgr_trq->query( EXPORTING iv_query_key = /scmtms/if_trq_c=>sc_query-root-qdb_query_by_attributes " Query it_selection_parameters = it_sel_par_trq " Query Selection Parameters iv_fill_data = abap_true " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ') IMPORTING et_data = lt_trq_root ). "FILL FAG ITEM for TRQ ROOT QUERY."""""""""" ls_sel_par_fitem-attribute_name = 'ITEM_NO'. ls_sel_par_fitem-option = 'EQ'. ls_sel_par_fitem-sign = 'I'. ls_sel_par_fitem-low = lt_fag_items[ 1 ]-zzmain_item_cap. APPEND ls_sel_par_fitem TO it_sel_par_fitem. """""""""""""""""""""""""""""""""""""""""""" "FILL FAG ITEM for TRQ ROOT QUERY."""""""""" ls_sel_par_fitem-attribute_name = 'parent_key'. ls_sel_par_fitem-option = 'EQ'. ls_sel_par_fitem-sign = 'I'. ls_sel_par_fitem-low = lt_fag_root[ 1 ]-key. APPEND ls_sel_par_fitem TO it_sel_par_fitem. """""""""""""""""""""""""""""""""""""""""""" "RETRIEVE FAG ITEM Keys according to two parameters parent_key + ITEM NO lr_srvmgr_fag->query( EXPORTING iv_query_key = /scmtms/if_fag_c=>sc_query-items-query_by_attributes " Query it_selection_parameters = it_sel_par_fitem " Query Selection Parameters iv_fill_data = abap_true " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ') IMPORTING et_key = lt_fag_main_keys ). IF lt_fag_main_keys IS NOT INITIAL. "retrieve FAG MAIN ITEMS as is it named in cds lr_srvmgr_fag->retrieve( EXPORTING iv_node_key = /scmtms/if_fag_c=>sc_node-items it_key = lt_fag_main_keys IMPORTING et_data = lt_fag_items_main ). ENDIF.
Leave a Comment