User Exits for IDOC Setup in WM
With this user exit, the contents and structure of IDOC WMTOID01 'Transfer order' can be influenced customer-specifically in the outbox. General Information on IDOC Processing Within the application, you first decide using the Customizing
application whether the interface to an external system will be activated. In this case, the transfer orders are evaluated and the system creates an extract of the items relevant for this interface. In addition, you determine the partner system to which the transfer order
data is to be transmitted, that is, one or several external systems are determined for the communication process. For each external system, an IDOC is created. The IDOC is set up in a function module that is assigned to the respective message type via a Customizing table. All
the transfer order items that are relevant for the external system in question are passed on to this function module. This function module creates the IDOC and passes it on to the ALE interface. The ALE interface is responsible for saving the created IDOCs and for
transmitting them to the external system. Call transaction and other important requirements 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. Parameters and options 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. Examples 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 ・ernehmen.................................. move xidoc_data to t_idoc_data. append t_idoc_data. *........Neues Segment ・ernehmen......................................
if flg_neues_segment eq 'X'. *........Lesen Lieferung und Daten in neues Segment ・ergeben.......... 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.
Function/Program:- EXIT_SAPLLIDO_001: Customer Exit of IDOC WMTOID01 (transfer Order) on Issue
|