Using SAP IDoc Files |
SAP IDocs consist of fields of data grouped into segments. The segments themselves have a hierarchical relationship to each other.
A physician's prescription of a drug for a hospital patient needs to get to the hospital's pharmacy. This could be done by means of an IDoc sent from a bedside program to a program in the pharmacy. Suppose the IDoc has a hierarchy of four levels of segments:
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. There can be more than one second level segment for a given patient.
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 may 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. More than one medicine may be ordered for a given patient on a given visit.
System, Application, and Products in Data Processing (SAP) is a workflow application designed to allow third-party application and incompatible databases to exchange information, and to automate a large companies order processing, fulfillment, customer service, supply chain management, and inventory management systems.
Creating a XML script using SAP's Auto-ID Infrastructure (AII).
Creating an Intermediate Document (IDoc) file.
IDoc is a name for a way of grouping fields of data group 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.
SAP is a trademark of SAP Aktiengesellschaft.
Since an IDoc is a message, both the sending and receiving programs must conform to a common convention about where, in a given IDoc, each piece of data will be found. To this end, 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, like this one, must conform to the definitions when parsing the IDoc.
IDoc types have names of six letters and two numerals. 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 may 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 defined by SAP AG always begin with "E", while custom designed segment names always begin with "Z".
You associate a parser file with a particular IDoc type on the IDoc Type Definitions dialog.
Since 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 for simplicity:
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, the doctor ordered naprosin.
The path through the tibia fracture and the prescription for naprosin can be collapsed into a flat record like this:
Patient Name |
Diagnosis |
Visit |
Drug |
Johnson |
tibia fracture |
followup |
naprosin |
The two other complete paths could be collapsed into these records:
Patient Name |
Diagnosis |
Visit |
Drug |
Johnson |
tibia fracture |
admission |
codeine |
Johnson |
tibia fracture |
admission |
amidol |
You will not always need a item to print 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 with respect to your design needs.
Consider the data tree shown in the introductory example. If the hospital needs a label for every drug prescribed, then it would set 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 built from this IDoc, I'll want one item to print for every _____________.
In the preceding example, if "visit" fills the blank, then the third level would probably be the best choice of Master Segment level, but if "prescribed drug" fills the blank, then the fourth level would probably be a better choice.
Related Topics