Transportation Management : Read Freight documents from Delivery

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%20flow

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.

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 as : DATA(lt_torlabel_ucVALUE /scmtms/t_tor_labelFOR 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_noderoot
    iv_altkey_key /scmtms/if_tor_c=>sc_alternative_keyrootlabeltxt
    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_noderoot
    it_key              = lt_freightunit_keys
    iv_association      /scmtms/if_tor_c=>sc_associationroottop_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, thats why we are getting the data along with the keys.

Hope you enjoyed reading.

Thank You

Ishani