Supply Chain Management Blogs by Members
Learn about SAP SCM software from firsthand experiences of community members. Share your own post and join the conversation about supply chain management.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member204244
Active Participant
Hello Everyone,

This is a very simple blog post but my intention here is to explain simple things to the beginners out there who are struggling and enthusiastic to learn technical side of Transportation Management.

So, lets start with baby steps and today we will learn how to get details of Freight documents linked with any delivery document.

First, understand the flow of documents that are created when we create any delivery. The process is as below:


document flow


 

  1. When we create any delivery document, Freight unit gets created

  2. Number of the delivery document is saved as label text in the freight unit detail.

  3. In real time, document flow looks like below example:


 

Delivery numbers : Lets assume that delivery numbers are stored in an internal table IT_DELIVERY_NUMBER

 

  • Get an instance of a service manager i,e BO Freight Order
    go_srv_mgr_fo = /bobf/cl_tra_serv_mgr_factory=>get_service_manager
    ( /scmtms/if_tor_c=>sc_bo_key ).



 

  • First step is to create list of Label from the delivery number using below code.



DATA(lt_torlabel_uc) = VALUE /scmtms/t_tor_label
( FOR ls_del IN it_delivery_number
( |{ ls_del ALPHA = OUT }| ) '
).



  • Second step is to get the keys of freight unit by passing label ( which are basically delivery numbers)
    CALL METHOD go_srv_mgr_fo->convert_altern_key
    EXPORTING
    iv_node_key = /scmtms/if_tor_c=>sc_node-root
    iv_altkey_key = /scmtms/if_tor_c=>sc_alternative_key-root-labeltxt
    it_key = lt_torlabel_uc
    IMPORTING
    et_key = lt_freightunit_keys.



 

  • Third step is to get Freight Order/Freight booking keys based on Freight unit keys fetched in above step.
    CALL METHOD go_srv_mgr_fo->retrieve_by_association(
    EXPORTING
    iv_node_key = /scmtms/if_tor_c=>sc_node-root
    it_key = lt_freightunit_keys
    iv_association = /scmtms/if_tor_c=>sc_association-root-top_level_tors
    iv_fill_data = abap_true
    iv_invalidate_cache = abap_true
    IMPORTING
    eo_message = lo_message
    et_target_key = lt_tor_key
    et_data = lt_tor_data ).



Here, lt_tor_key will store the Keys of freight order or freight booking created from the freight unit keys that we passed via lt_freightunit_keys and lt_tor_data will contain the header level details of freight order and freight booking that are fetched.

Since, we have passed iv_fill_data = X, that's why we are getting the data along with the keys.

Thus, if we pass delivery number as 80000451 in the IT_DELIVERY_NUMBER and execute the code, we will get freight order data as below in internal table LT_TOR_DATA.


(For display purpose, have shown the screenshot of only few fields but its a very big structure )

Hope you enjoyed reading.

Thank You

Ishani
6 Comments
Labels in this area