Design Guidelines and Formatting Rules for Creating New Segments

Design guidelines

  • Do not re-invent the wheel

Before you create a new segment, check whether your requirements can be met by an existing segment. Use the EDI standards, for example, ANSI X12 (North America) or EDIFACT (worldwide). You should use ISO codes for coded field values so that they are based on a standard which is generally applicable. ISO codes exist, for example, for countries (ISO 3166), currencies (ISO 4217) and units of measure (ISO 31).

  • Group your data in a meaningful manner

Business data is contained in segment fields. Data which belongs together from a logical point of view should be combined to form a segment. Segments which belong together from a logical point of view should be combined to form a segment group. For example, the materials in a purchase order could be contained in one segment. Together with other segments (information about the partner, taxes and terms of payment), this segment can then form part of the "Items" segment group.

  • Create universal segments

You can use segments which you have already created in other IDoc types. Check whether a segment can be used for different messages. An example of a universal segment is one which contains general address data.

  • Create clearly arranged segments and segment groups

Position the required fields as close as possible to the start of the segment. Two segments which always occur together should be combined in one segment.

Consider whether the use of qualifiers can be avoided. Qualifiers indicate how a segment is used and are difficult to document and interpret. Qualifiers are not usually defined on a cross-application basis, with the result that these segments are not universal.

  • Don’t waste space

The maximum length of all the fields in a segment is 1000 characters. The larger the segment, the better the ratio of useful data to administration data. A certain amount of space should be reserved in segments to allow for additional fields in the future.

  • Document your segments

Use the documentation options provided by the segment editor. You can store an additional data element for each field to provide information about how the field is used in the application. You can also document a segment to explain the attributes and structure of the entire segment. When documenting segments, remember that the segment fields are used in both inbound and outbound processing.

  • Remember that conversion to EDI standards may be necessary

Note the following formatting rules which specifically apply here.

Formatting rules

The following formatting rules usually apply to data in segment fields:

  • The segment fields may only contain alphanumeric data. You can make sure that this is the case by using data elements which contain characters in the segment fields.
  • No distinction is made between upper case and lower case letters.
  • The fields are maintained in such a way that the values are left-justified.
  • The standard date representation (without qualifiers) is YYYYMMDD. February 28, 1996 is therefore represented as 19960228.
  • The standard time representation (without qualifiers) is HHMMSS. 8.35pm is therefore represented as 203500.
  • Values with a fixed decimal point are represented with a decimal point only - there is no thousand delimiter. Negative values are indicated by a minus sign after the value.

German use: The number -2,097,152.64 is represented as 2097152.64-.

American use: The number -2,097,152.64 is represented as 2097152.64-.

  • Floating point numbers are represented with a decimal point - there is no thousand delimiter. Negative values are indicated via a minus sign after the value and the exponent is always specified.

German use: The number -23.4 is represented as -2.34E+01.

American use: The number -23.4 is represented as -2.34E+01.

The following rules may be useful if your IDocs are to be converted to other EDI standards (EDIFACT, ANSI X12):

  • If possible, segment fields in the IDoc should be represented directly by EDI data elements. Avoid splitting or combining fields or other changes which could lead to problems with automatic conversion.
  • The field length should be equal to the maximum length of the SAP application or relevant EDI standard (depending on which is longer), so that all the existing information can always be transferred.
  • The required segment fields in the EDI standard must be present in the IDoc segment, to ensure that the IDocs can be converted correctly.