사용법은 보통 이런식으로...

/scmtms/cl_tor_helper_common=>get_tor_data(
  EXPORTING
    it_root_key      = lt_root_key
  IMPORTING
    et_all_items     = lt_all_items
).

실행되는건 아래 코드와 같은 내용입니다.

DATA(lo_srv_mgr) = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_tor_c=>sc_bo_key ).
lo_srv_mgr->retrieve_by_association(
  EXPORTING
    iv_node_key       = /scmtms/if_tor_c=>sc_node-root
    it_key            = lt_root_key
    iv_association    = /scmtms/if_tor_c=>sc_association-root-item_tr
    iv_fill_data      = abap_true
  IMPORTING
    et_data           = lt_all_items
).

 

실용적인 코드 템플릿 >

DATA:
LT_ROOT_KEY TYPE /BOBF/T_FRW_KEY,
LT_ROOT	TYPE /SCMTMS/T_TOR_ROOT_K,
LT_ALL_ITEMS TYPE /SCMTMS/T_TOR_ITEM_TR_K,
LT_STOP	TYPE /SCMTMS/T_TOR_STOP_K,
LT_STOP_SUCC_ALL TYPE /SCMTMS/T_TOR_STOP_SUCC_K,
LT_DOC_REFERENCE TYPE /SCMTMS/T_TOR_DOCREF_K,
LT_EXEC TYPE /SCMTMS/T_TOR_EXEC_K,
LT_PARTY TYPE /SCMTMS/T_TOR_PARTY_K,

FIELD-SYMBOLS:
<LS_ROOT> TYPE /SCMTMS/S_TOR_ROOT_K,
<LS_ITEM> TYPE /SCMTMS/S_TOR_ITEM_TR_K,
<LS_STOP> TYPE /SCMTMS/S_TOR_STOP_K,
<LS_STOP_SUCC> TYPE /SCMTMS/S_TOR_STOP_SUCC_K,
<LS_DOC_REFERENCE> TYPE /SCMTMS/S_TOR_DOCREF_K,
<LS_EXEC> TYPE /SCMTMS/S_TOR_EXEC_K,
<LS_PARTY> TYPE /SCMTMS/S_TOR_PARTY_K,

" Invalidate cache
/bobf/cl_tra_trans_mgr_factory=>get_transaction_manager( )->cleanup( ).

" Get TOR data
/scmtms/cl_tor_helper_common=>get_tor_data(
  EXPORTING
    it_root_key      = lt_root_key
  IMPORTING
    et_root          = lt_root
    et_all_items     = lt_all_items
    et_stop          = lt_stop
    et_stop_succ_all = lt_stop_succ_all
    et_doc_reference = lt_doc_reference
    et_exec          = lt_exec
    et_party         = lt_party
).

 

/SCMTMS/T_TOR_ITEM_TR_K에 Secondary Key 가 여러개 있습니다.
Internal Table 의 Secondary Key 는 마치 DB Index 와 비슷한 역할을 하여 검색 속도를 빠르게 해줍니다.
차이점은 Secondary Key 가 여러개 있어도 Insert 속도에 영향을 주지 않습니다.
Secondary Key 의 Indexing 생성 시기는 최초 사용시 입니다. 사용하지 않는 Secondary Key 는 Indexing 하지 않습니다.


" ITEM_CAT = 'AVR' (차량)
READ TABLE lt_all_items ASSIGNING <ls_item> WITH KEY root_itmcat COMPONENTS root_key = <ls_root>-key item_cat = 'AVR'.

" ITEM_CAT = 'DRI' (드라이버)
READ TABLE lt_all_items ASSIGNING <ls_item> WITH KEY root_itmcat COMPONENTS root_key = <ls_root>-key item_cat = 'DRI'.

" ITEM_CAT = 'PRD' (제품)
LOOP AT lt_all_items ASSIGNING <ls_item> USING KEY root_itmcat WHERE <ls_root>-key item_cat = 'PRD'.

이렇게 Secondary Key 를 사용할때는 READ TABLE ... WITH KEY , LOOP AT ... USING KEY 구문을 쓰면 됩니다.

Item 노드 뿐만이 아니라 다른 노드에 대한 인터널 테이블도 모두 Secondary Key가 많이 있으니 찾아보고 활용해 보세요.

'ABAP > TM 물류운송관리' 카테고리의 다른 글

/SCMTMS/CL_UI_NAVIGATION=>START_NAVIGATION  (0) 2022.05.19

+ Recent posts