A customer extension in the coding of the inbound function module which maintains the application tables with data from the extension segments relates to the extension segments.
You must have completed the required steps in Enhancing an IDoc Type.
The customer extension to the corresponding function modules is written via transaction CMOD. You proceed in a similar way as to Outbound Processing.
In the example, enhance function module IDOC_INPUT_ORDERS in additional project ZEDA0001: The extension writes the value from segment field Z1TEST1-CONTINENT into field IHREZ (customer character) of structure XVBAK. The contents of this structure is used in the structure of batch input table BDCDATA, which transfers transaction VA01 (create standard order).
IHREZ is already supplied from field E1EDKA1-IHREZ of basic type ORDERS01, therefore an extension is not necessary at all here. The example should just be used as an illustration of the principle.
SAP enhancement |
VEDA0001 |
Function exit |
EXIT_SAPLVEDA_001 (Customer extension of data segments for inbound order document) |
Include |
ZXVEDU03 |
Segment |
Z1TEST1 |
master program |
SAPLXVED |
TOP program |
LXVEDTOP |
Customer top include |
ZXVEDTOP |
The source text is as follows:
DATA segnam(27).
DATA: BEGIN OF hxvbak.
INCLUDE STRUCTURE vbak.
DATA END OF hxvbak.
segnam = segment-segnam.
CASE segnam.
WHEN 'Z1TEST1'. "Name of Customer Segment
z1test1 = segment-sdata. "Data gets structurehxvbak-ihrez = z1test1-kontinent. "Fill Help Structure
MOVE hxvbak TO dxvbak. "Provide CHANGING Parameter
ENDCASE.
The CASE instruction in the source text is essential because the same customer exit is called for each segment in the function module IDOC_OUTPUT_ORDERS. For this reason, the new include must first determine whether the call came from the correct parent segment.