Using SAP IDoc Files

SAP IDocs consist of fields of data grouped into segments. The segments themselves have a hierarchical relationship to each other.

ClosedExample of hierarchy

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.

ClosedIntegrating With SAP

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

Designers using SAP can choose to print from either BarTender or SAP. When printing items using BarTender, information is sent from SAP to BarTender. The different ways SAP can send data include:

When printing items 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. Refer to the Integration with SAP white paper for a complete comparison of the differences between printing items from BarTender and printing items from the SAP system.

ClosedWorking with IDoc Files

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. An IDoc file is a message containing data that is sent from an SAP-connected program to BarTender. You can add an IDoc file to your BarTender document using the Database Setup Wizard and maintain the connection using the Database Setup dialog. You can also create custom IDoc files using the IDoc Type Definitions dialog and link type definitions to a parser file using the IDoc Definitions Setup dialog.

SAP is a trademark of SAP Aktiengesellschaft.

ClosedIDoc Types and Segment Definitions

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

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

ClosedParser Files

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

You associate a parser file with a particular IDoc type on the IDoc Type Definitions dialog.

ClosedConverting IDoc Hierarchical Data to Flat Records

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.

ClosedExample

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

When BarTender reads IDocs, it will collapse data trees into flat records. You will select the fields from these records that you need in objects on your template.

ClosedMaster Segment

You will not always need a item to print for every possible record that could be produced from the data hierarchy in an IDoc. BarTender can be configured at print-time to select only some records, 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 just the records you need from an IDoc.

The Master Segment is the segment whose data is the focus of interest with respect to your design needs. BarTender will produce one record for every segment in the IDoc that you designate as the Master Segment.

ClosedExample

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. This would cause BarTender to produce three records:

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. So the Master Segment is set to the third level, and BarTender produces two records:

Patient Name

Diagnosis

Visit

Drug

Johnson

tibia fracture

admission

codeine amidol

Johnson

tibia fracture

followup

naprosin

In the first of these records, BarTender included the field Drug from the level below the Master Segment and concatenated all the data from segments at that lower level. For more information, refer to Repeating Segment Rules dialog.

Because BarTender will produce one record for every instance of the Master Segment, completing the following statement may help you determine what to use as your Master Segment:

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.

ClosedSAP IDOC Definition File

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

You would change the SAP IDoc definition file when BarTender has been installed on an additional computer and you need it to use the same SAP IDoc definition file as the other computers running BarTender.

Related Topics