Extending Inbound Function Modules

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.

Prerequisites

You must have completed the required steps in Extending an IDoc Type .

Procedure

The customer extension to the corresponding function modules is written using transaction CMOD. You proceed in a similar way as to Outbound processing.

In the example, extend the function module IDOC_INPUT_ORDERS in the additional project ZEDA0001. The extension writes the value from the segment field Z1TEST1-KONTINENT in the field IHREZ (customer character) of structure XVBAK. The contents of this structure are 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 the basic type ORDERS01, therefore an extension here is not necessary at all. The example should just be used as an illustration of the principle.

SAP extension

VEDA0001

Function exit

EXIT_SAPLVEDA_001 (Customer extension of data segments for inbound order document)

Include

ZXVEDU03

Segment

Z1TEST1

Main program

SAPLXVED

TOP program

LXVEDTOP

Customer Top Include

ZXVEDTOP

The source text appears 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 receives structure
  hxvbak-ihrez = z1test1-continent. "Fill help structure
  MOVE hxvbak TO dxvbak. "supply 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.