Ansicht
Dokumentation

MWMIDO01 - Enhancement of IDOCs WMTOID01 (Transport request) Outbox

MWMIDO01 - Enhancement of IDOCs WMTOID01 (Transport request) Outbox

ROGBILLS - Synchronize billing plans   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

With this user exit, the contents and structure of IDOC WMTOID01 'Transfer order' can be influenced customer-specifically in the outbox.

The user exit is performed in the function module that sets up IDOC WMTOID01. This is done after the IDOC setup but before it is transferred to the ALE interface. The standard function module for setting up IDOC WMTOID01 is called L_IDOC_CREATE_WMTOID01. The IDOC setup is part of the transfer order generation. This means that the source code can run both asynchronously in the update program and online. For this reason, all error messages must be issued as abend messages to guarantee a correct termination with rollback. Furthermore, you must not use any key words such as COMMIT WORK, ROLLBACK WORK, LEAVE, or the like.

The user exit in the program is function module EXIT_SAPLLIDO_001. In order to be able to use the user exit, you must create Include ZXLIDU01 and activate the enhancement with transaction CMOD. As parameters, you can use the transfer order and IDOC data:

  • TO header (import parameter I_LTAK)
  • TO items (table parameter T_LTAP)
  • Control record of the IDOC that has been set up (import parameter X_IDOC_CONTROL)
  • Data records of the IDOC that has been set up (table parameter T_IDOC_DATA)

This user exit can basically be used to:

  • change or redetermine the data in IDOC WMTOID01 that were determined during the standard procedure or provide partners with additional information using empty fields of this IDOC.
  • change or enhance the data for controlling the IDOC processing in the control record of the IDOC.
  • If you enhanced the basic IDOC WMTOID01 with your own segments, you have to fill these segments including the necessary data.

The user exit returns the modified IDOC data to the calling program by means of the following parameters:

  • Control record of the IDOC that has been set up (export parameter X_IDOC_CONTROL)
  • Data records of the IDOC that has been set up (table parameter T_IDOC_DATA)

The modified IDOC is passed on by the calling program to the ALE interface for sending.

Although changes to table T_LTAP are without any meaning, they should still not be made.

Below, you will find some conceivable changes including the necessary source code.

  • You want to send additional data on TO item level. These data are transferred in the standard segment of IDOC WMTOID01.
With field 'Goods recipient', information is transferred whether the external system should additionally print accompanying documents for the sent transfer order. The indicator for printout from the TO header and the printer from the TO items are specified in this field.
In addition, a separate description is written into the field 'Unloading point'.

*---------------------------------------------------------------------*
* INCLUDE ZXLIDU01 *
*---------------------------------------------------------------------*
tables: e1ltori,


loop at t_idoc_data.

*........Zusatzinfos aus dem Transportauftrag..........................
if t_idoc_data-segnam = 'E1LTORI'.
move t_idoc_data-sdata to e1ltori.
loop at t_ltap
where tanum eq i_ltak-tanum
and tapos eq e1ltori-tapos.
exit.
endloop.
if sy-subrc eq 0.
move i_ltak-drukz to e1ltori-wempf.
move t_ltap-ldest to e1ltori-wempf+2.
move e1ltori to t_idoc_data-sdata.
modify t_idoc_data.
endif.

*........Zusatzinfos die individuell beschafft werden..................
move 'USER-EXIT' to e1ltori-ablad.
move e1ltori to t_idoc_data-sdata.
modify t_idoc_data.
endif.
endloop.

  • The IDOCs that have been set up are to be transferred to the external system via two different logical destinations, depending on the transport type. This requires two different partner profiles. The partner profile depends on the message type, message variant and message function. Message function 'EIN' is used for stock placements whereas 'RES' is used for all other movements. You have to maintain the partner profile for these two message functions 'EIN' and 'RES' as well.

    *---------------------------------------------------------------------*
    * INCLUDE ZXLIDU01 *
    *---------------------------------------------------------------------*

    if i_ltak-trart eq 'E'.
    move 'EIN' to x_idoc_control-mesfct.
    else.
    move 'RES' to x_idoc_control-mesfct.
    endif.

For transfer orders on deliveries, the external system requires additional delivery data such as name of the goods recipient, route, shipping point, and the like. In this case, the large amount of additional data can only be transferred via an additional IDOC segment. That is, you have to define a seprate IDOC type that consists of the basic IDOC type WMTOID01 and a separate enhancement type. In the enhancement type, you define the new segment, for example Z1LTORZ, that refers to the standard segment E1LTORH. Filling the data of the new segment can be done as follows.

*--------------------------------------------------------------------*
* INCLUDE ZXLIDU01 *
*--------------------------------------------------------------------*
tables: e1ltori,
z1ltorz,
edidd,
likp.
data: flg_neues_segment.

data: begin of xidoc_data occurs 0.
include structure edidd.
data: end of xidoc_data.

*....>>> Neues Segment anlegen Z1LTORZ <<<.............................

*........Bestehendes IDOC sichern......................................
loop at t_idoc_data.
move t_idoc_data to xidoc_data.
append xidoc_data.
endloop.

*........Neuen IDOC-Typ und Erweiterungs-Typ im Kontrolsatz fortschr...
move:
'ZZWMTOID' to x_idoc_control-doctyp,
'ZWMTOID1' to x_idoc_control-cimtyp.

*........Aus dem bestehenden IDOC ein neues IDOC erstellen.............

* dabei wird das neue Segment aufgebaut und eingebettet

refresh t_idoc_data.
loop at xidoc_data.

*........Merken:neues Segment soll nach dem Segment E1LTORH kommen.....
if xidoc_data-segnam = 'E1LTORH'.
flg_neues_segment = 'X'.
endif.

*........Standard-Segmente übernehmen..................................
move xidoc_data to t_idoc_data.
append t_idoc_data.

*........Neues Segment übernehmen......................................
if flg_neues_segment eq 'X'.

*........Lesen Lieferung und Daten in neues Segment übergeben..........
if not i_ltak-vbeln is initial.
select single * from likp
where vbeln eq i_ltak-vbeln.
if sy-subrc eq 0.
clear t_idoc_data.
move-corresponding likp to z1ltorz.

*........Neues Segment sichern.........................................
move 'Z1LTORZ' to t_idoc_data-segnam.
move z1ltorz to t_idoc_data-sdata.
append t_idoc_data.

endif.
endif.
endif.
move space to flg_neues_segment.
endloop.






Addresses (Business Address Services)   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 8124 Date: 20240329 Time: 065122     sap01-206 ( 150 ms )