Typical X12/EDIFACT/SAP IDoc mapping: ASN (Ship Notice) and Packaging structures

One of the most complex things you can encounter working on the maps is the mapping of hierarchical (nested) packages/products in ASNs (Ship Notices). Things like partners, dates or references usually are straight-forward and in a lot of cases you can use simple direct connections. But different formats use different approaches when it comes to hierarchical (nested) structures.

So, let me show you how X12, EDIFACT and IDocs describe this: one container C1 with 5 pallets, 2 pallets (P1 and P2) are for Product A, 2 pallets (P3 and P4) are for Product B and 1 pallet (P5) is a mixed load with Product A and Product C

C1
    P1
        Product A, 100 KGM
    P2
        Product A, 100 KGM
    P3
        Product B, 90 KGM
    P4
        Product B, 90 KGM
    P5
        Product A, 20 KGM
        Product C, 90 KGM



So, all mentioned formats (X12, EDIFACT and SAP IDoc) are able to describe products, containers/packages, and relationship between these entities.


SAP IDoc (DELVRY/SHPMNT)

Let’s start with SAP IDocs, DELVRY05 (if you familiar with SAP IDocs, you know that the same approach is used in SHPMNTs). There are 2 “parallel” (or sibling) structures for products and HUs (handling units), E1EDL24 and E1EDL37 respectively. Relationships between products and packages, as well as packaging hierarchical structure (parent/children HUs) are described with E1EDL37 / E1EDL44.

How products and packages which contain this product are connected:

E1EDL24                    <<< product
    POSNR = 000010
    MATNR = Product A
    LFIMG = 220
    VRKME = KG
E1EDL37                    <<< package (pallet)
    EXIDV = P1

    E1EDL44                    <<< connection between products and packages
        POSNR = 000010
        VEMNG = 100
        VEMEH = KG
        MATNR = Product A

As you can see, E1EDL44 contains information about the product it contains (POSNR, MATNR; CHARG for batch splits) and its amount in this container (VEMNG and VEMEH for UoM) – the total amount of Product A is 220 KGM but pallet P1 contains only 100 KGM of it.

How packages and containers which contain these packages are connected:

E1EDL37                    <<< package (container)
    EXIDV = C1

    E1EDL44                    <<< connection between this container and packages it contains
        EXIDV = P1
E1EDL37                    <<< package (pallet)
    EXIDV = P1

In this case E1EDL44 in the parent HU uses EXIDV to connect container C1 and pallet P1. Since there are “intermediate” packages between container and products, E1EDL37 which describes container doesn’t have any direct information about the products it contains.

So, in IDocs (DELVRY) parent structure E1EDL37 refers to its children via E1EDL44. The E1EDL44 is a repeatable structure, there will be multiple E1EDL44s under E1EDL37 if it contains more than one children (packages or products).

Our delivery example will be described like this:

E1EDL24
    POSNR = 000010
    MATNR = Product A
E1EDL24
    POSNR = 000020
    MATNR = Product B
E1EDL24
    POSNR = 000010
    MATNR = Product C
E1EDL37
    EXIDV = C1
    E1EDL44
        EXIDV = P1
    E1EDL44
        EXIDV = P2
    E1EDL44
        EXIDV = P3
    E1EDL44
        EXIDV = P4
    E1EDL44
        EXIDV = P5
E1EDL37
    EXIDV = P1
    E1EDL44
        POSNR = 000010
        MATNR = Product A
E1EDL37
    EXIDV = P2
    E1EDL44
        POSNR = 000010
        MATNR = Product A
E1EDL37
    EXIDV = P3
    E1EDL44
        POSNR = 000020
        MATNR = Product B
E1EDL37
    EXIDV = P4
    E1EDL44
        POSNR = 000020
        MATNR = Product B
E1EDL37
    EXIDV = P5
    E1EDL44
        POSNR = 000010
        MATNR = Product A
    E1EDL44
        POSNR = 000030
        MATNR = Product C

X12 (856)

In X12, 856 document is used for ASNs. It contains a special repeatable structure – HL group, which is used to organise hierarchical relationships.

Here let me make a brief digression. In my opinion, X12 is little bit more flexible comparing with IDoc or EDIFACT, and here you could meet such terms as “Pick and Pack” (aka SOPI) and “Standard Pack” (also referenced as SOIP). I think it might be useful to review them.

HL segment contain HL-03 element – “Hierarchical Level Code”, and in 99% cases it is one of S (Shipment), O (Order), T (Tare), P (Pack) or I (Item). First level in X12 ASNs is always S (Shipment), i.e. it contains data, common for this shipment (delivery). Next level is O (Order) and it contains information about PO this Shipment refers to. Even though X12 allows you to have multiple Orders under the same Shipment, this option is almost never used (for example, I have had only one case) and again, in 99% cases there is only one Order under Shipment. Structures “under” Order depends on the type of packaging and products used. Typical structure is Pick and Pack, or SOPI (or SOTPI, if you need to describe a container). You might already guess that P and I in “SOPI” are for Pack and Item respectively. If so – you are absolutely right. SOPI structure has the following implementation in X12:

SOPI (Pick and Pack)

HL (S)      <<< Shipment
  HL (O)      <<< Order
    HL (P)      <<< Package
      HL (I)
    HL (P)      <<< mixed load (2 products in one pack)
      HL (I)
      HL (I)

SOPI structure is ideal for describing packages which are different from each other – different weights, mixed loads (multiple products per package). But what if you have multiple “homogeneous” packages, which contain only one products and are the same except of their IDs (package IDs or labels or SCC codes) ? SOPI structure might be too cumbersome (but still you can use it – no problems!) – if you have 100 packages you would need to repeat HL (P) – HL (I) pairs 100 times, and the only difference between them would be package IDs. For such cases it is easier to use SOIP structure

SOIP (Standard Pack)

HL (S)      <<< Shipment
  HL (O)      <<< Order
    HL (I)      <<< mixed load (2 products in one pack)
      HL (P)
          MAN      <<< used for Package IDs, repeatable

so, there will be only one HL (I) for product and one HL (P) for all the same packages with this product. Repeatable MAN segment will be used for all the package IDs.

More complex nested packaging structures might be easily described with nested HLs – if you need containers it might be

SOTPI (container with packages)

HL (S)      <<< Shipment
  HL (O)      <<< Order
    HL (T)      <<< Container
      HL (P)      <<< Package
        HL (I)

or, you could get rid of HL (P) – for bulk product (like gas in a tank truck)

SOI (bulk)

HL (S)      <<< Shipment
  HL (O)      <<< Order
    HL (I)      <<< Product (bulk)

The relationship between HL groups is organised with using of HL-01 (hierarchical ID number, unique) and HL-02 (hierarchical parent ID) elements.

HL*1**S~
  HL*2*1*O~     << HL(O), unique ID is "2"
    HL*3*2*P~     << HL(O), unique ID is "3", parent ID is "2" - is a child of HL*2
      HL*4*3*I~
      HL*5*3*I~
    HL*6*2*P~
      HL*7*6*I~

Finally, our example will be described as this:

HL*1**S~    << shipment
  HL*2*1*O~     << order
    PRF*PO-0000001      << PO number
    HL*3*2*T~           << container
      MAN*GM*C1~      << container ID
      HL*4*3*P~           << pallet
        MAN*GM*P1~
        HL*5*4*I~        << product
          LIN*1*BP*Product A~      << product ID
          SN1*1*100*KGM~      << product quantity in this unit
      HL*6*3*P~
        MAN*GM*P2~
        HL*7*6*I~
          LIN*1*BP*Product A~
          SN1*1*100*KGM~
      HL*8*3*P~
        MAN*GM*P3~
        HL*9*8*I~
          LIN*2*BP*Product B~
          SN1*2*90*KGM~
      HL*10*3*P~
        MAN*GM*P4~
        HL*11*10*I~
          LIN*2*BP*Product B~
          SN1*2*90*KGM~
      HL*12*3*P~
        MAN*GM*P5~
        HL*13*12*I~
          LIN*1*BP*Product A~
          SN1*1*20*KGM~
        HL*14*12*I~
          LIN*3*BP*Product C~
          SN1*3*90*KGM~

EDIFACT (DELVRY)

EDIFACT (DESADV) uses hierarchical CPS groups, somehow similar to X12’s HLs. CPS groups includes PAC and LIN sub-groups, used for packages and products respectively. So, it might be used like these:

  • CPS with both PAC and LIN – package(s) and product(s) it contains (for example, pallets with products)
  • CPS with PAC only – package(s) only (for example, containers which contain pallets)
  • CPS with LIN only – products(s) only (bulk)

Similar to HL, CPS-01 (hierarchical ID number) and CPS-02 (hierarchical parent ID) are used to organise the relationship between nested packages. But to indicate that this product is placed in this container you should include appropriate LIN into CPS with the PAC it belongs to.

CPS+X++3'    << container
  CPS+Y+X+1'    << pallet on this container (pallet's CPS-02 = parent container's CPS-01)

CPS-03 is used to indicate type of packaging – 1 for inner (pallet), 3 for outer (container) and 4 for no packaging (bulk).

Usually mapping is pretty straight-forward, and our example will use somethings like this

CPS+1++3'    << container
  PAC+1'
    PCI
      GIN+ML+C1'    << container ID
  CPS+2+1+1'    << pallet
    PAC+1'
      PCI
        GIN+ML+P1'    << pallet ID
    LIN          << product
      PIA+5+Product A:BP'   << product ID
      MEA+WT+AAC+KGM:100'   << product quantity (weight)
  CPS+3+1+1'
    PAC+1'
      PCI
        GIN+ML+P2'
    LIN
      PIA+5+Product A:BP'
      MEA+WT+AAC+KGM:100'
  CPS+4+1+1'
    PAC+1'
      PCI
        GIN+ML+P3'
    LIN
      PIA+5+Product B:BP'
      MEA+WT+AAC+KGM:90'
  CPS+5+1+1'
    PAC+1'
      PCI
        GIN+ML+P4'
    LIN
      PIA+5+Product B:BP'
      MEA+WT+AAC+KGM:90'
  CPS+6+1+1'                << mixed pallet with 2 products
    PAC+1'
      PCI
        GIN+ML+P5'
    LIN
      PIA+5+Product A:BP'
      MEA+WT+AAC+KGM:20'
    LIN
      PIA+5+Product C:BP'
      MEA+WT+AAC+KGM:90'

Like we saw in X12, there is a way to group similar packages (same packaging type, same content and same weight/quantity) under the same CPS:

CPS+1++3'
  PAC+1'
    PCI
      GIN+ML+C1'
  CPS+2+1+1'
    PAC+2'    << 2 packages of this type
      PCI
        GIN+ML+P1:P2'  << their IDs are P1 and P2
    LIN
      PIA+5+Product A:BP'
      MEA+WT+AAC+KGM:100'
  CPS+3+1+1'
    PAC+2'
      PCI
        GIN+ML+P3:P4'
    LIN
      PIA+5+Product B:BP'
      MEA+WT+AAC+KGM:90'
  CPS+4+1+1'
    PAC+1'
      PCI
        GIN+ML+P5'
    LIN
      PIA+5+Product A:BP'
      MEA+WT+AAC+KGM:20'
    LIN
      PIA+5+Product C:BP'
      MEA+WT+AAC+KGM:90'

As always, it is just an idea. I tried to explain “how it works” and didn’t use all the available/possible structures (to make it simpler for understanding).

PS Some time ago I was making a similar presentation about ASNs for our client in the US:

Gennady Kim

Advertisements

4 thoughts on “Typical X12/EDIFACT/SAP IDoc mapping: ASN (Ship Notice) and Packaging structures

  1. This is fantastic – I’d never understood how nested packages could be encoded in IDOCs before and neither did the SAP consultants I’d spoken to (though IDOC ASNs I’ve dealt with haven’t ever had higher level hierarchies than at package level… so far)

      • Hi Kim I have a doubt regarding sterling integrator extended rule….I am trying to call a simple select statement in database with all hardcoded values like “Select id from employee where name = ‘santosh'” but while in one stance of map with the correct input file it is running fine ….whereas in other instance when I am adding one extra element in input file and then running it is returing “Error in SQL”. My assumption is it should run correctly because in select all are hardcoded value. Can you help.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s