About SAP IDoc Files |
SAP Intermediate Document (IDoc) files consist of fields of data that are grouped into segments. The segments themselves have a hierarchical relationship to each other.
SAP is a trademark of SAP Aktiengesellschaft (SAP AG).
A physician's prescription for a drug for a hospital patient must go to the hospital's pharmacy. This transfer can be done by using an IDoc that is sent from a bedside program to a program in the pharmacy.
Suppose the IDoc has a hierarchy of four levels of segments, as follows.
Patient Name: Johnson
Diagnosis: croup
Diagnosis: tibia fracture
Visit Type: admission
Drug: codeine
Drug: amidol
Visit Type: followup
Drug: naprosin
Level 1: Contains data that remains constant for years at a time, such as patient name and address.
Level 2: Contains data that remains constant through a given illness but changes from illness to illness, such as primary physician and diagnosis. A patient can have more than one second-level segment.
Level 3: Contains data that remains constant through a particular visit to the hospital but changes from visit to visit, such as visit type (admission or followup) and attending physician. A patient can have more than one hospital visit during an illness.
Level 4: Contains data that tends to change from prescription to prescription, such as prescribing physician, medicine, and dosage. A patient can have more than one medicine ordered on a given visit.
Systems, Applications and Products in Data Processing (SAP) is a workflow application that allows third-party applications and incompatible databases to exchange information and automates a large company's order processing, fulfillment, customer service, supply chain management, and inventory management systems.
Creating an XML script by using SAP Auto-ID Infrastructure (AII)
Creating an IDoc file
IDoc is a method of grouping fields of data into segments that have a hierarchical relationship with each other. SAP maintains a library of file types, but you can create custom IDoc file types to meet your needs.
Because an IDoc is a message, both the sending and receiving programs must conform to a common convention about where each piece of data is found in a given IDoc. Therefore, SAP AG has defined several hundred IDoc types and a large number of segment types.
A sending program must construct an IDoc of a given type in accordance with these definitions, and a receiving program must conform to those definitions when it parses the IDoc.
IDoc types have names that consist of six letters and two numerals. For example, SHPMNT01 is an IDoc that embodies a message about shipments. SAP revises the definitions of IDocs from time to time, and the two numerals at the end of the name identify the revision.
Segment names can end in three-digit version numbers. For example, E2KNA1M001 is a segment for the DEBMAS02 (customer masters) IDoc type.
SAP owners can create their own custom IDoc types and segment types.
Names of segments that are defined by SAP AG always begin with "E", and custom-designed segment names always begin with "Z".
To associate a parser file with a particular IDoc type, use the SAP IDoc Definitions page in the Databases section of Administration Console.
Because data in a child segment is always associated with the data in its parent, any non-branching path through a tree in an IDoc, from a top node to a bottom node, can be thought of as a record, just like the records in a table-oriented database.
Consider the following data hierarchy, in which each segment has just one field:
Patient Name: Johnson
Diagnosis: croup
Diagnosis: tibia fracture
Visit Type: admission
Drug: codeine
Drug: amidol
Visit Type: followup
Drug: naprosin
Patient Johnson has been treated at different times for croup and a tibia fracture. (Details of the first illness are not depicted.) In the first hospital visit for the fracture, the doctor prescribed codeine and amidol. In the second visit, the doctor prescribed naprosin.
The path through the tibia fracture and the prescription for naprosin can be collapsed into a flat record, as follows.
Patient Name |
Diagnosis |
Visit |
Drug |
Johnson |
tibia fracture |
followup |
naprosin |
The two other complete paths can be collapsed into the following flat records.
Patient Name |
Diagnosis |
Visit |
Drug |
Johnson |
tibia fracture |
admission |
codeine |
Johnson |
tibia fracture |
admission |
amidol |
You will not always need a item to be printed for every possible record that could be produced from the data hierarchy in an IDoc.
The master segment is the segment whose data is the focus of interest for your design needs.
Consider the data tree that was shown in the introductory example. If the hospital needs a label for every drug that is prescribed, then it sets the master segment at the fourth level.
Patient Name |
Diagnosis |
Visit |
Drug |
---|---|---|---|
Johnson |
tibia fracture |
admission |
codeine |
Johnson |
tibia fracture |
admission |
amidol |
Johnson |
tibia fracture |
followup |
naprosin |
Suppose the hospital keeps separate files for every patient visit and wants to generate labels to be used for file folders. Only one label is needed for each visit.
Patient Name |
Diagnosis |
Visit |
Drug |
---|---|---|---|
Johnson |
tibia fracture |
admission |
codeine amidol |
Johnson |
tibia fracture |
followup |
naprosin |
In the typical run of items that are built from this IDoc, I want one item to be printed for every _____________.
In this example, if "visit" completes the statement, then the third level is probably the best choice for the master segment level. If "prescribed drug" completes the statement, then the fourth level is probably the best choice.
Whenever you add, modify, or delete an IDoc type, you are modifying the SAP IDoc definition file. You can create custom IDoc definition files on the SAP IDoc Definitions page of the Databases section of Administration Console.