Welcome to the technical series of the SAP Transportation Management where we are aiming to learn basic codes that are used in SAP TM.
Since, this blog post is continuation of the previous blog post, hence Please visit the below blog post if you have not gone through yet.
- So, in the above mentioned blog post, we have learnt how to get header details and keys of the freight order and freight bookings.
- Internal table lt_tor_data will store the Freight order header details.
In this blog post, we will learn how to get the carrier details that are assigned in the freight order.
- First step is to get the TSP ID from the freight order header data into different internal table. This will work as keys for carrier object.
lt_tsp_root_key = VALUE #( FOR ls_header IN lt_tor_data ( key = ls_header-tsp ) ).
- Second step is to create the instance of a service manager of type supplier (BUPA)
lo_srv_mgr_supplier = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /bofu/if_supplier_c=>sc_bo_key ).
- Third step is to read the carrier header details using retrieve method.
CALL METHOD lo_srv_mgr_supplier->retrieve EXPORTING iv_node_key = /bofu/if_supplier_c=>sc_node-root it_key = lt_tsp_root_key iv_edit_mode = /bobf/if_conf_c=>sc_edit_read_only IMPORTING eo_message = lo_message et_data = lt_carrier_details et_failed_key = lt_failed_key.
Since we are fetching the carrier details, thus, node key is supplier root key while in the previous blog post, it was TOR root node.
Thus, we need to take care of the node key that we are passing to read the data in SAP TM.
Hope you have enjoyed reading.