IDoc

From HandWiki
Revision as of 20:15, 6 February 2024 by Len Stevenson (talk | contribs) (add)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

IDoc, short for Intermediate Document, is an SAP document format for business transaction data transfers.[1] Non SAP-systems can use IDocs as the standard interface (computing) for data transfer.[2] IDoc is similar to XML in purpose, but differs in syntax. Both serve the purpose of data exchange and automation in computer systems, but the IDoc-Technology takes a different approach.

While XML allows having some metadata about the document itself, an IDoc is obliged to have information at its header like its creator, creation time etc. While XML has a tag-like tree structure containing data and meta-data, IDocs use a table with the data and meta-data. IDocs also have a session that explains all the processes which the document passed or will pass, allowing one to debug and trace the status of the document.

Different IDoc types are available to handle different types of messages. For example, the IDoc format ORDERS01 may be used for both purchase orders and order confirmations.

IDoc technology offers many tools for automation, monitoring and error handling. For example, if the IDocs are customised that way on a particular server, then a user of SAP R/3 system creates a purchase order; this is automatically sent via an IDoc and a sales order is immediately created on the vendor's system.

When this order cannot be created because of an application error (for example: The price per piece is lower than allowed for this material), then the administrator on the vendor's system sees this IDoc among the erroneous ones and can solve the situation. If the error is in the master data at the vendor's system, he can correct them and order the IDoc to be processed again.

Because of the flexibility and transparency of IDoc technology, some non-SAP technologies use them as well.

Structure of the IDoc

An IDoc consists of

  • Control record (it contains the type of IDoc, port of the partner, release of SAP R/3 which produced the IDoc etc.)
  • Data records of different types. The number and type of segments is mostly fixed for each IDoc type, but there is some flexibility (for example an SD order can have any number of items).
  • Status records containing messages like 'IDoc created', 'The recipient exists', 'IDoc was successfully passed to the port', 'Could not book the invoice because..'

The IDoc itself is a structured Text-File, that means IDocs can be used on all platforms, there is no need to translate binary data. Each record is identified by the name of the record. The load (data) is stored in a 1000 byte long container. Use transaction WE60 in a SAP-System to get documentation for IDocs, like HTML files and C-header files.

Example ORDERS01  Segment E1EDK01

    /* -------------------------------------------------------------------------------------------------------------------- */
    /* Automatically created data declarations                                                                              */
    /* Data declarations for IDoc segments                                                                                  */
    /* of IDoc type ORDERS01                                                                                                */
    /* Creation 20.09.2017 13:11:00                                                                                         */
    /* Client 100                                                                                                           */
    /* System F10                                                                                                           */
    /* Release 740                                                                                                          */
    /* Lang. EN                                                                                                             */
    /* Transaction WE60                                                                                                     */
    /* Output for Release 740                                                                                               */
    /* Version 3 of IDoc record types : IDoc record types for SAP Release 4.0                                               */
    /* -------------------------------------------------------------------------------------------------------------------- */
    /* Segment structures for IDoc type ORDERS01                                                                            */
    /* -------------------------------------------------------------------------------------------------------------------- */
    #ifndef E2EDK01005
    #define E2EDK01005
    typedef struct e2edk01005 {                       /* IDoc: Document header general data                                 */
        
        Char action[3];                               /* Action code for the whole EDI message                              */
        Char kzabs[1];                                /* Flag: order acknowledgment required                                */
        Char curcy[3];                                /* Currency                                                           */
        Char hwaer[3];                                /* EDI local currency                                                 */
        Char wkurs[12];                               /* Exchange rate                                                      */
        Char zterm[17];                               /* Terms of payment key                                               */
        Char kundeuinr[20];                           /* VAT Registration Number                                            */
        Char eigenuinr[20];                           /* VAT Registration Number                                            */
        Char bsart[4];                                /* Document type                                                      */
        Char belnr[35];                               /* IDOC document number                                               */
        Char ntgew[18];                               /* Net weight                                                         */
        Char brgew[18];                               /* Net weight                                                         */
        Char gewei[3];                                /* Weight unit                                                        */
        Char fkart_rl[4];                             /* Invoice list type                                                  */
        Char ablad[25];                               /* Unloading Point                                                    */
        Char bstzd[4];                                /* Purchase order number supplement                                   */
        Char vsart[2];                                /* Shipping Conditions                                                */
        Char vsart_bez[20];                           /* Description of the Shipping Type                                   */
        Char recipnt_no[10];                          /* Number of recipient (for control via the ALE model)                */
        Char kzazu[1];                                /* Order Combination Indicator                                        */
        Char autlf[1];                                /* Complete delivery defined for each sales order?                    */
        Char augru[3];                                /* Order reason (reason for the business transaction)                 */
        Char augru_bez[40];                           /* Description                                                        */
        Char abrvw[3];                                /* Usage Indicator                                                    */
        Char abrvw_bez[20];                           /* Description                                                        */
        Char fktyp[1];                                /* Billing category                                                   */
        Char lifsk[2];                                /* Delivery block (document header)                                   */
        Char lifsk_bez[20];                           /* Description                                                        */
        Char empst[25];                               /* Receiving point                                                    */
        Char abtnr[4];                                /* Department number                                                  */
        Char delco[3];                                /* Agreed delivery time                                               */
        Char wkurs_m[12];                             /* Indirectly quoted exchange rate in an IDoc segment                 */
        } e2edk01005;
     #endif  E2EDK01005

IDoc Transactions in SAP

The following transactions can be used to create and process IDocs. The list does not include any transaction required for the development of new IDoc types. Please note that you get a comprehensive list of available transactions by using area menu WEDI.

  • WE02 - IDoc List report
  • WE05 - IDoc List
  • WE09 - IDoc Search for Business Content
  • WLF_IDOC - IDoc Processing
    • This transaction is used to display and edit IDocs.
  • WE19 - Test Tool for Idoc Processing
  • WE20 - Partner Profile
    • This transaction determines a processing code based on the partner profile identified by the control record of the IDoc.
  • WE21 - Ports in IDoc processing
    • This transaction identifies an external port (RFC, File, ABAP-PI, etc.) that controls the IDoc flow to an external system.
  • WE30 - IDoc Type Development
  • WE31 - Development IDoc Segment
  • WE32 - Development IDoc View
  • WE41 - Outbound process code
    • This transaction links an outbound processing code specified in a partner profile to a function module.
  • WE42 - Inbound process code
    • This transaction links an inbound processing code specified in a partner profile to a function module.
  • WE60 - IDoc Documentation
  • BD87 - Inbound processing
    • This transaction processes outbound IDocs.

NAST

NAST is a technique in SAP-Systems to create messages. Messages can be printed, sent or transferred into IDocs. SAP uses this for many applications e.g. Purchase Orders (PO ). The PO can create a message which might be printed, sent by FAX, or translated into an IDoc of type ORDERS. The IDoc ORDERS can be forwarded in an B2B-process to a vendor.

Error Handling

Transactions like WE02, WE05, WE09, WE19, and BD87 are used in traditional approaches to error handling in IDOC administration. Drill down through the idocs status data to find the actual root case. However, SAP S/4 HANA has rectified this and now provides an upgraded version of all of these with the WLF_ IDOC transaction.[3]

References

External links