Application Development 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: 

userexit in idoc

Former Member
0 Kudos

Hi Friends,

I have one extension idoc type requirement, now i want to insert the code in userexit. how can i find the user exit related to the idoc.

4 REPLIES 4

Former Member
0 Kudos

Check this forum link:

Regards.

former_member404244
Active Contributor
0 Kudos

Hi,

First of all get the function module that triggers the idoc..now once u get the FM then in the FM search for "CALL CUSTOMER-FUNCTION",u will get the exits...try to identify the correct exit and then write ur code..

Regards,

Nagaraj

0 Kudos

Get the package from IDOC Type, then search user exit in SMOD by Package

Former Member
0 Kudos

Hi,

can u explen what is your Scenario, here i am given some userexit for idoc.

u can find it from SMOD

MWMIDO01

MWMIDO02

MWMIDO03

MWMIDO04

MWMIDO07

MWMIDO08

MWMIDO09

MWMIDO10

MWMIDO11

MWMIDO12

MWMIDO13

SIDOC001

SIDOC002

EX......

MWMIDO01 (User Exit)

With this user exit, the contents and structure of IDOC WMTOID01

'Transfer order' can be influenced customer-specifically in the outbox.

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 transferre

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 th

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:

o TO header (import parameter I_LTAK)

o TO items (table parameter T_LTAP)

o Control record of the IDOC that has been set up (import parameter

X_IDOC_CONTROL)

o Data records of the IDOC that has been set up (table parameter

T_IDOC_DATA)

This user exit can basically be used to:

o 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.

o change or enhance the data for controlling the IDOC processing in

the control record of the IDOC.

o 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:

o Control record of the IDOC that has been set up (export parameter

X_IDOC_CONTROL)

o 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.

o 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.

o 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.

*******************************************

if it is help full to u please give max rewad point.