Creation of the IDoc Data

R/3 provides a sophisticated IDoc processing framework. This framework determines a function module which is responsible for creating or processing the IDoc.

Function module to generate the IDoc :

The kernel of the IDoc processing is always a distinct function module. For the outbound processing, the function module creates the IDoc and leaves it in an internal table, which is passed as an interface parameter.During inbound processing the function module receives the IDoc via an interface parameter table. It would interpret the IDoc data and typically update the database either directly or via a call transaction.

Function are called dynamically :

The function modules are called dynamically from a standard routine. Therefore, the function must adhere to a well-defined interface. 

Function group EDIN with useful routines :

You may want to investigate the function group EDIN, which contains a number of IDoc handler routines and would call the customised function.

Copy and modify existing routines :

The easiest way to start the development of an outbound IDoc function module is to copy an existing one. There are many samples in the standard R/3 repository'; most are named IDOC_OUTBOUND* or IDOC_OUTPUT*

Outbound sample functions are named like IDOC_OUTPUT* :

FUNCTION IDOC_OUTPUT_ORDERS01

Inbound sample functions are named like IDOC_INPUT* :

FUNCTION IDOC_INPUT_ORDERS01

Outbound sample functions for master data are named like MASTERIDOC_INPUT* :

FUNCTION MASTERIDOC_CREATE_MATMAS

Interface Structure of IDoc Processing Functions

To use the standard IDoc processing mechanism, the processing function module must have certain interface parameters because the function is called dynamically from a standard routine.The automated IDoc processor will call your function module from within the program RSNASTED, usually either from the FORM ALE_PROCESSING or EDI_PROCESSING.In order to be compatible with this automated call, the interface of the function module must be compliant.

FUNCTION Z_IDOC_OUTBOUND_SAMPLE.

*" IMPORTING

*" VALUE(FL_TEST) LIKE RS38L-OPTIONAL DEFAULT 'X'
*" VALUE(FL_COMMIT) LIKE RS38L-OPTIONAL DEFAULT SPACE

*" EXPORTING

*" VALUE(F_IDOC_HEADER) LIKE EDIDC STRUCTURE EDIDC

*" TABLES

*" T_IDOC_CONTRL STRUCTURE EDIDC
*" T_IDOC_DATA STRUCTURE EDIDD

*" CHANGING

*" VALUE(CONTROL_RECORD_IN) LIKE EDIDC STRUCTURE EDIDC
*" VALUE(OBJECT) LIKE NAST STRUCTURE NAST

*" EXCEPTIONS

*" ERROR_IN_IDOC_CONTROL
*" ERROR_WRITING_IDOC_STATUS
*" ERROR_IN_IDOC_DATA
*" SENDING_LOGICAL_SYSTEM_UNKNOWN
*" UNKNOWN_ERROR

Inbound functions are also called via a standard mechanism.

FUNCTION IDOC_INPUT_SOMETHING.

*" IMPORTING

*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC

*" EXPORTING

*" VALUE(WORKFLOW_RESULT) LIKE BDWFAP_PAR-RESULT
*" VALUE(APPLICATION_VARIABLE) LIKE BDWFAP_PAR-APPL_VAR
*" VALUE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" VALUE(CALL_TRANSACTION_DONE) LIKE BDWFAP_PAR-CALLTRANS

*" TABLES

*" IDOC_CONTRL STRUCTURE EDIDC
*" IDOC_DATA STRUCTURE EDIDD
*" IDOC_STATUS STRUCTURE BDIDOCSTAT
*" RETURN_VARIABLES STRUCTURE BDWFRETVAR
*" SERIALIZATION_INFO STRUCTURE BDI_SER

RELATED POSTS

No comments :

Post a Comment