Populate Segment E1EDK02 In Outgoing IDOC

We need to populate the segment E1EDK02 with a new qualifer and a zfield in outgoing IDOC of basic type ORDERS05 and msg type ORDERS.  The processing function module is IDOC_OUTPUT_ORDERS.

Please let me know the user-exit in which we can implement the logic to add a new segment E1EDK02 with a new qualifier.

Can we use the exit ZXM06U02 in EXIT_SAPLEINM_002 for this purpose?

Solution:

Yes EXIT_SAPLEINM_002 is the right one, that is to be used to populate E1EDK02 segment.

In fact it is called right after each segment is appended. You can see that withing PERFORM FUELLEN_IDOC_INTTAB in IDOC_OUTPUT_ORDERS, a PERFORM customer_function is called right after each APPEND int_edidd which appends a Idoc segment. This form customer_function calls the user exit EXIT_SAPLEINM_002.

So for you to be able to insert E1EDK02 under its parent E1EDK01, you need to ascertain that the call to this user exit via PERFORM customer_function is happening right after APPEND of the segment E1EDK01 below which you want to append your custom E1EDK02 segment.
 

How we typically do this is:

1. Do a DESCRIBE on int_edidd table to know the INDEX of last segment that is appended by SAP code in the table

2. READ that segment with its INDEX and make a CASE code

CASE int_edidd-segname.

  WHEN '<segment below which you want to insert>, say E1EDK01'.

     Do your coding here, to check qualifier  E1EDK01-TDID,

     if you get your qulifier

     APPEND int_edidd with  child E1EDK02 (with TDLINE)

 ENDCASE.

The advantage of the above coding is that in future, people can use your CASE... ENDCASE to insert their own segments by putting another WHEN clause.

PS: 

Tcode for Customer Exit: CMOD

Also check assigned Process code "ME10-ORDERS: Purchase order".

If you check the function module assigned to "ME10" in WE41 transaction, it is "IDOC_OUTPUT_ORDERS".

If you go and check in this function module there you will find PERFORM FUELLEN_IDOC_INTTAB. If you dbclik on that, then inside that form routine you will find PERFORM customer_function. which is calling user-exit EXIT_SAPLEINM_002.

SAP BC Tips

See Also
How To Search By Value A Particular Idoc

Get help for your Basis problems
Do you have a SAP Basis Question?

SAP Basis Admin Books
SAP System Administration, Security, Authorization, ALE, Performance Tuning Reference Books

SAP Basis Tips
SAP BC Tips and Basis Components Discussion Forum

Administration In SAP - Sapgui, Unix, SAP ITS, Router, Client Copy and IDES 

Main Index
SAP ERP Modules, Basis, ABAP and Other IMG Stuff

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.