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).

ClosedExample of hierarchy

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.

ClosedIntegrating with SAP

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. BarTender uses IDocs to move data from SAP databases to the items that you print.

Designers who use SAP can choose to print by using either BarTender or SAP. When items are printed by using BarTender, information is sent from SAP to BarTender. SAP can send data by using the following methods:

When items are printed by using an SAP system, BarTender sends SAP a set of formatting commands called a printer code template. The template is combined with data and sent to the printer.

ClosedWorking with IDoc Files

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. An IDoc file is a message that contains data that is sent from an SAP-connected program to BarTender. You can add an IDoc file to your BarTender document by using the Database Setup wizard and manage the connection by using the Database Setup dialog. You can also create custom IDoc definitions by using the SAP IDoc Definitions page in the Databases section of Administration Console.

ClosedIDoc Types and Segment Definitions

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. This means that identifying a parser file is one step in setting up BarTender to use data from IDocs.

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".

ClosedParser Files

A parser file for an IDoc type contains the information that BarTender needs to parse the IDoc, such as what segments can appear in it, which segments are repeatable, what data fields appear in each segment, what order the fields are in, and what length each field has.

To associate a parser file with a particular IDoc type, use the SAP IDoc Definitions page in the Databases section of Administration Console.

ClosedConverting IDoc Hierarchical Data to Flat Records

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.

ClosedExample

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

When BarTender reads IDocs, it collapses data trees into flat records. From these records, you can select the fields that you need in objects on your template.

ClosedMaster Segment

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. You can configure BarTender to select only some records at print time, but some documents that draw data from an IDoc will not need every possible record, even in the typical case. BarTender uses the concept of the master segment to help you produce only the records that you need from an IDoc.

The master segment is the segment whose data is the focus of interest for your design needs. BarTender produces one record for every segment in the IDoc that you designate as the master segment.

ClosedExample

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. This causes BarTender to produce three records, as follows.

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. In this case, the master segment is set to the third level, and BarTender produces two records, as follows.

Patient Name

Diagnosis

Visit

Drug

Johnson

tibia fracture

admission

codeine amidol

Johnson

tibia fracture

followup

naprosin

In the first of these records, BarTender includes the Drug field from the level below the master segment and concatenates all the data from the segments at that lower level.

Because BarTender produces one record for every instance of the master segment, complete the following statement to help you determine what to use as your master segment.

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.

ClosedSAP IDoc Definition File

The SAP IDoc definition file is a list of the IDoc types that are currently available to BarTender and the default IDoc files, aliases, and parser files that are currently associated with each of the types.

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.

When BarTender is installed, it sets the definition file to <installation directory>\SAP\default.itd. You can switch to a different IDoc definition file from the File Locations page in Administration Console.

You would change the SAP IDoc definition file when BarTender is installed on an additional computer and you want it to use the same SAP IDoc definition file as the other computers that are running BarTender.