Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Assigning the delivery to the main transport order - module LO

0 Kudos
810

Hi.

I have a transport order number in the /SCMTMS/D_TORROT table.

Delivery number in SD - LIKP table.

How to check if this delivery is assigned to the main transport order?

1 REPLY 1

DominikTylczyn
SAP Champion
SAP Champion
735

Hello natanielg

I can see two ways to do that.

First, starting with the freight order. Read the /SCMTMS/TOR object of the freight order and DOCREFERENCE node. The delivery if it is assigned to the freight order will be there. BTD_TCO = 73, BTD_ID = <delivery number>

Second, starting with the delivery. Read the TM document flow of the delivery and check if the freight order is there. The following code snipped might help:

  DATA:
    lo_tms_docflow      TYPE REF TO cl_tms_docflow_data,
    lt_docflow_erp      TYPE tms_t_doc_flow_scr.

  CREATE OBJECT lo_tms_docflow
    EXPORTING
      iv_doc_type = '06' "outbound delivery
      iv_doc_nr   = <-- outbound delivery number here

  CALL METHOD lo_tms_docflow->get_data_for_display
    EXPORTING
      iv_display_type = if_tms_docflow_c=>view_erp
*     iv_doc_item     =
    IMPORTING
      et_docflow      = lt_docflow_erp
*     ev_internal_int =
    .

  READ TABLE lt_docflow_erp ASSIGNING FIELD-SYMBOL(<docflow_erp>) WITH KEY btd_category_code = 'TO'. "freight order<br>

Please be aware that you are not supposed to read BOBF tables directly. Use BOBF provided methods instead. See SAP Transportation Management 9.x Enhancement Guide

Best regards

Dominik Tylczynski