tms trq tor




*& Report ZTRQ_TO_TOR
 *&---------------------------------------------------------------------*
 *& SAP TMS Input Forwarding Order and Find Freight Order or Railcar Unit
 *& Uses database selects from the following tables to link the objects
 *& together.
 *&
 *&---------------------------------------------------------------------*
 REPORT zmtest_trq_to_tor.
 
 TABLES: /scmtms/d_trqrot,
         /scmtms/d_torite,
         /scmtms/d_torrot.
 
 DATA: wa_trqrot TYPE /scmtms/d_trqrot,
       it_torite TYPE STANDARD TABLE OF /scmtms/d_torite,
       wa_torite TYPE /scmtms/d_torite,
       wa_torrot TYPE  /scmtms/d_torrot.
 
 PARAMETERS: p_trqid TYPE /scmtms/d_trqrot-trq_id OBLIGATORY.
 
 
 ***********************************************************************
 *START-OF-SELECTION.
 START-OF-SELECTION.
   WRITE: 'Forwarding Order', p_trqid, 'is found on:'.
   SKIP 2.
   SELECT SINGLE *
     FROM /scmtms/d_trqrot
     INTO CORRESPONDING FIELDS OF wa_trqrot
    WHERE trq_id EQ p_trqid.
 
   SELECT   *
     FROM /scmtms/d_torite
     INTO CORRESPONDING FIELDS OF TABLE it_torite
    WHERE orig_ref_root EQ wa_trqrot-db_key.
 
 
 ***********************************************************************
 *END-OF-SELECTION.
 END-OF-SELECTION.
   LOOP AT it_torite INTO wa_torite.
     SELECT SINGLE *
   FROM /scmtms/d_torrot
   INTO CORRESPONDING FIELDS OF wa_torrot
   WHERE db_key EQ wa_torite-parent_key.
 
     CASE wa_torite-ref_bo.
       WHEN 'TRQ'.
         WRITE:/ 'On Railcar Unit - '.
       WHEN 'TOR'.
         WRITE:/ 'On Train - '.
       WHEN OTHERS.
         WRITE:/ 'On - '.
     ENDCASE.
 
     WRITE: wa_torrot-tor_id, wa_torite-item_type.
     WRITE:/ wa_torite-ref_bo, wa_torite-local_item, '---', wa_torrot-tor_cat, wa_torrot-tor_type.
     SKIP 2.
 
   ENDLOOP.
 

Related Articles