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

/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

메소드 파라미터가 매우 많습니다.

필수는 없고 모든 파라미터가 선택사항이라 필요에 따라 조합하여 사용합니다.

입력 파라미터 설명
유형1: BO IV_BO_KEY BO Key
IV_BO_NAME BO Name. 입력시 내부에서 BO Key로 변환
IV_BO_CATEGORY BO Category. TOR,TRQ,FA 의 경우 필요함. 생략시 자동 찾음.
IV_CHANGE_MODE Mode (빈값: display, C: create, U: change)
IV_KEY BO 데이터 Key
IV_SRC_INST_KEY create mode 에서 원본 데이터 키 지정
IV_TCM_TEMPLATE scale,rate,tccs 에서 템플릿 사용시
IV_REF_CREATE_MODE create mode 에서 reference mode 지정
IT_BO_DATA Shared Memory에 write
IV_SKIP_INITIAL_SCREEN Initial Screen 건너뜀
유형2: FPM IV_TARGET_APPL FPM Appl.
IV_CONFIGURATIONID FPM Config.
유형3: URL IV_EXTERNAL_URL External URL
공통 IT_PARAMETERS 추가 파라미터
IV_INPLACE_NAVIGATION 빈값: 새창으로, X: Inplace

 

 

사용 예

사용 예
예제1: TOR Key로 조회
/scmtms/cl_ui_navigation=>start_navigation(
  EXPORTING
    iv_bo_key      = /scmtms/if_tor_c=>sc_bo_key
    iv_bo_category = /scmtms/if_tor_const=>sc_tor_category-freight_unit
    iv_key         = lv_tor_key
).
예제2: TOR ID로 변경
/scmtms/cl_ui_navigation=>start_navigation(
  EXPORTING
    iv_bo_key      = /scmtms/if_tor_c=>sc_bo_key
    iv_bo_category = /scmtms/if_tor_const=>sc_tor_category-freight_unit
    iv_key         = /scmtms/cl_tor_helper_root=>return_key_for_torid( lv_tor_id )
    iv_change_mode = /bofu/if_fbi_runtime_c=>sc_change_modes-change
).
예제3: TRQ 생성
/scmtms/cl_ui_navigation=>start_navigation(
  EXPORTING
    iv_bo_key          = /scmtms/if_trq_c=>sc_bo_key
    iv_bo_category     = /scmtms/if_trq_const=>c_trq_category-forwarding_order
    iv_change_mode     = /bofu/if_fbi_runtime_c=>sc_change_modes-create
    iv_src_inst_key    = lv_fwq_key
    iv_ref_create_mode = /scmtms/if_ui_trq_c=>sc_action_param-ref_create_mode-fwo_from_fwq
).
예제4: schedule Key로 조회
/scmtms/cl_ui_navigation=>start_navigation(
  EXPORTING
    iv_bo_key = /scmtms/if_fo_schedule_c=>sc_bo_key
    iv_key    = ls_item-sched_key
).
예제5: location ID로 조회
/scmtms/cl_ui_navigation=>start_navigation(
  EXPORTING
    iv_bo_key     = /scmtms/if_location_c=>sc_bo_key
    it_parameters = VALUE #(
      ( key = 'LOCATION' value = ls_stop-log_locid )
    )
).
예제6: resource ID로 조회
/scmtms/cl_ui_navigation=>start_navigation(
  EXPORTING
    iv_bo_key     = /scmtms/if_resource_c=>sc_bo_key
    it_parameters = VALUE #(
      ( key = 'RESOURCE' value = ls_item-res_id )
    )
).
예제7: product(material) ID로 조회
/scmtms/cl_ui_navigation=>start_navigation(
  EXPORTING
    iv_bo_key     = /scmtms/if_mat_c=>sc_bo_key
    it_parameters = VALUE #(
      ( key = 'PRODUCT' value = ls_item-product_id )
    )
).
예제8: BP ID로 조회
/scmtms/cl_ui_navigation=>start_navigation(
  EXPORTING
    iv_bo_key     = /bofu/if_bupa_constants=>sc_bo_key
    it_parameters = VALUE #(
      ( key = 'PARTNER' value = lv_bp_id )
      ( key = 'ROLE' value = lv_bp_role )
    )
).
예제9: order document 조회
/scmtms/cl_ui_navigation=>start_navigation(
  EXPORTING
    it_parameters = VALUE #(
      ( key = /scmtms/if_ui_cmn_c=>sc_wd_parameter-base_btd_tco
        value = ls_docref-btd_tco )
      ( key = /scmtms/if_ui_cmn_c=>sc_wd_parameter-base_btd_id
        value = ls_docref-btd_id )
    )
).
예제10: 스탠다드 worklist(POWL) 참고
/SCMTMS/CL_UI_ACTION_TOR->HANDLE_ACTION

+ Recent posts