IDoc is widely used in ALE. Usually the IDoc type that system provided could fully meet customer requirement. Howevcr, sometimes customer want some extra fields added to standard IDoc type. In this case, we need to deal with issue of IDoc enhancement.

Generally, the processing of IDoc type falls into following three categories:

  • The IDoc type required is available and meets all requirements: No action needed
  • The IDoc type required is present but does not meet all requirements: Customer extension
  • The IDoc type required isn’t available or it’s present but does not meet all requirements: Development

There are some rules for customer extension:

  • Additional customer fields are recorded in their own customer segments
  • Customer segments depend on SAP segments(successor or child relationships)
  • The processing of customer segments is exclusively implemented in the customer exits of the coding provided in the standard system.

Here I present an example for IDoc enhancement, giving business scenario as following: The retail customer want to load old article master data into SAP system in batch via LSMW. Meanwhile, they want some extra fields to be transferred into system as well (AGRI and OWNBRAND). Generally, we could use IDoc import method in LSMW, here IDoc type ARTMAS05 is used, and match source structure to IDoc segment. But in this case, there are two extra customer fields that we need to map into IDoc type. Therefore, we need to extend standard IDoc type ARTMAS05 to make it contain extra customer fields. The steps are described as below:

  • Create Segment (we31)

Some Experience on IDoc Enhancement

Here segment type ZMARAAPPEND is created which contain three fields: MATERIAL, AGRI, and OWNBRAND. Field ‘MATERIAL’ is used as primary key field in segment.

  • Extending Basic Types(we30)

Some Experience on IDoc Enhancement

Because of some special requirement, I copy ARTMAS05 into ZARTMAS05, but the function is the same. First I create a new extension ‘ZARTMAS05EXT’, link to basic type ‘ZARTMAS05′.

Next, append ZMARAAPPEND into segment ‘E1BPE1MARART’ as a child.

  • Assign Message type to Basic type and Extension(we82)

  • Create link between message type and function module(we57, for inbound processing) 

Some Experience on IDoc Enhancement

 
  • Append structure ZAMARA to table MARA

Some Experience on IDoc Enhancement

  • Development in User Exit

Some Experience on IDoc Enhancement

First we need to do field mapping in LSMW. The source structure is APPEND_LEVEL, it contains three fields: MATERIAL, AGRI, and OWNBRAND. The segment ‘E1BPE1MARAEXTRT’ is used as container for extension field. I created a structure h_clientext, which get field value of MATERIAL, AGRI, OWNBRAND, then assign it to segment ‘E1BPE1MARAEXTRT’. The content of ‘E1BPE1MARAEXTRT’ will be used later.

Some Experience on IDoc Enhancement

From help.sap.com, we could find a User Exit for ALE distribution of Article Master. EXIT_SAPL1001_003 is for inbound processing when IDoc is posted. Here we write some code in it to process segment when doing inbound processing.

Some Experience on IDoc Enhancement

We need to use t-code ‘CMOD’ to create a project to develop user exit. Inside it, we begin processing when parameter_name is for CLIENTEXT, which map to ‘E1BPE1MARAEXTRT’ mentioned above. Next we assign value in CLIENTEXT to append fields of MARA table (here variable f_mara_ueb represents MARA table). After this step, we assign the value of extra fields to append structure of MARA table. Then we could do step ‘IDoc generation’ and ‘IDoc processing’ in LSMW, you could set break point inside source code to trace the value of variable. Finally, we could get new record in MARA table which contain value of extra field.

The steps for IDoc enhancement may be a little bit complex, the most important thing is we need to find the user exit to do IDoc processing, either inbound or outbound, depending on actual requirement.

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !