Last edited: 1999-07-18 18:29 +0200
Receiving an IDoc and the subsequent processing is a widely mechanical and straightforward task. With the help of the control record information, the SAP system finds a processing FB, which processes the IDoc data in three basic steps.
1 Unpack the data and decode it into the proper segment structure |
The data of an IDoc is always delivered in junks of data which are strings of 1000 characters length. If you want to use them in an ABAP you have to overlay them into the appropriate structure, so that you can easily address the data by fields. |
| TABLES:
Z1ORDERHEADER. .... CASE IDOC_CONTRL-SEGNAM. ... WHEN 'Z1ORDERHEADER'. MOVE IDOC_DATA-SDATA TO Z1ORDERHEADER. |
|
| The structure Z1ORDERHEADER in the example is automatically created as DDIC structure, when you define the IDoc segment in the WE31. | |
2 Eventually prepare data to be suitable for a call transaction |
It would be naïve to expect that the data you receive from an external source were 100% ready to be stored in your system. The most complicated task is to convert the data into the form you require in your system. Eg. SAP stores dates in the format YYYYMMDD, however many legacy systems will send you dates in a country specific format, eg. MM/DD/YY. |
| It is becoming especially difficult, when the data in the IDoc has a different HEADER-ITEM structure than SAP. Eg. some legacy system will send the delivery date of an order in the header data to be valid for all items. However, SAP stores this information in the item position | |
3 Store the data in the SAP database by CALL TRANSACTION or an existing Direct Input FB |
Now you simply play a call transaction session with all the data necessary to complete the transaction. This is an intellectually easy task, because the only thing you have to do, is to manually enter an example and record all the screen sequence and the fields that have to be filled with data. However, as with all the batch input programming, this can become somehow tricky, if the screen sequence varies depending on the input data. In that case your routine, that build the batch input data (BTCI) would have some IF and ELSE statements. remember, that the easiest way to create a BTCI program is to record the session with the BTCI macro recorder in SM35 and to generate the program from the recorded data. |