This section describes how to create a function module which is identified by the report RSNASTED (form routine NEW_DYN_PERFORM) via a new process code. This function module enters application data in the new basic type. RSNASTED can be found in table TNAPR as an EDI processing program. Message Control reads this table and can then call RSNASTED.
Procedure
In the example, the new function module is called IDOC_OUTPUT_TESTER. The function module uses the new interface (from Release 3.0 onwards), that is, the application data is stored in an internal table. In addition, the path without the ALE layer (that is, without filters) is selected.
The function module is called from Purchasing (create purchase order) in the same way as IDOC_OUTPUT_ORDERS (IDoc type ORDERS01). The function module therefore fills the segments of your new IDoc type from a purchasing table, that is, EKKO and EKPO (purchasing document header and item). Note that the intention here is not to simulate a realistic purchase order, but to describe how data reaches an IDoc table from application tables via segment structures. In this case, you should pay particular attention to the form routines HEADER_E1HEAD_FILL or POSITION_E1ITEM_FILL.
Administration parameters for IDOC_OUTPUT_TESTER
Application abbreviation |
M (Materials Management) |
Processing type |
normal, start immediately |
Interface for IDOC_OUTPUT_TESTER
Formal parameters |
Reference structure |
Explanation |
Import parameters |
||
OBJECT |
MC |
Current Message Control record |
CONTROL_RECORD_IN |
EDIDC |
Contains recipient information |
Export parameters |
||
OBJECT_TYPE |
WFAS1-ASGTP |
Object type for the application object in the Business Object Repository (BOR) |
CONTROL_RECORD_OUT |
EDIDC |
Contains the sender information as well as the date and time at which the IDoc table was filled. |
Table |
||
INT_EDIDD |
EDIDD |
IDoc data records (internal table) |
Coding example
FUNCTION IDOC_OUTPUT_TESTER.
SELECT * FROM EKET WHERE EBELN = EKKO-EBELN.
ENDSELECT.
ENDFORM. " ORDERS_READ
FORM IDOC_TABLE_FILL.
* header data
PERFORM HEADER_E1HEAD_FILL.
* data in position
PERFORM POSITION_E1ITEM_FILL.
ENDFORM. " IDOC_TABLE_FILL
FORM HEADER_E1HEAD_FILL.
CLEAR INT_EDIDD.
CLEAR E1HEAD.
INT_EDIDD-SEGNAM = 'E1HEAD'.
* fill fields
* document number
E1HEAD-BELNR = EKKO-EBELN.
The HLEVEL field (hierarchy level of segment) in the administration section is not filled. This is carried out by the IDoc interface, which receives this value from the definition of the IDoc type TESTER01.
You should also note that the segment in the INT_EDIDD-SEGNAM field must be written in upper case letters. Otherwise, the IDoc interface will return a syntax error.
Global data from IDOC_OUTPUT_TESTER
*
- Tabellen ------------------------------------------------------*