Boomi: mapping of complex ASN structures: part I – problem

In this article I want to demonstrate an approach of mapping between two complex structures in Boomi. All the mapping samples in Boomi training courses are more/less simple mapping between the same levels (header to header and details to details). However if your mapping requires more complex scenarios like mapping between repeatable and non-repeatable structures, grouping data and changing the structures you would probably need more advanced techniques, like using JS/Groovy scripts in particular.

The approach I’m going to review here is to use a temporary XML structure and XSLT for the data transformation. I’ll create a process to convert an SAP DELVRY03 DESADV IDoc with E1EDL24s (products) and E1EDL37s (packages) into X12 4010 856 ASN transaction set, SOPI (“pick and pack”). The main focus of this article is on the complex structure transformation, when we need to convert

  • Shipment (E1EDL20)
    • Product (item) (E1EDL24)
      • Order (E1EDL41)
    • Package (E1EDL37)

into

  • Shipment (HL-S)
    • Order (HL-O)
      • Package (HL-P)
        • Product (item) (HL-I)

This approach will be working for XML -> any other format (i.e. it is important that the source document is in the XML format). To use it with situations when the source document is not XML would require an additional step (converting the data into XML). To be able to use this approach you should have some XSLT knowledge and it would be easier if you have an idea about XSD.

A side note – I have worked with different data translators and right now I think that XSLT is one of the best technologies for the purpose of the data transformation. I prefer it over any script language, it is powerful for most mapping rules and it is not that complex to learn and master compared to JavaScript in particular. Boomi supports XSLT 3.0 and it might be used for creating maps of almost any complexity.

As you know, Boomi contains a visual mapping editor which mostly relies on so called simple links – then you drag an element from the source structure and drop it on the element in the target structure. For conditions you can use instance identifiers, for more complex logic you can create your own function using a built-in editor or write a script in JS/Groovy.

Unfortunately you cannot use simple links when you need to transform the structure. If your source structure is SAP DELVRY based IDoc, you have two parallel structures – E1EDL24 and E1EDL37 as it described here. For example to describe 3 products on 5 pallets the structure would look like this (idea):

E1EDL24
    POSNR = 000010
    MATNR = Product A
E1EDL24
    POSNR = 000020
    MATNR = Product B
E1EDL24
    POSNR = 000030
    MATNR = Product C
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

If you need to transform it into an X12 856 SOPI, you will need to create a hierarchy of packages (P) and products (I) when products belong to packages:

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

Let’s assume we need to generate the following simplified X12 856 SOPI:

TARGETSOURCE
BSN/BSN-01hardcode “00” (Original)
BSN/BSN-02E1EDL20/VBELN
BSN/BSN-03EDI_DC40/CREDAT
BSN/BSN-04EDI_DC40/CRETIM
HL (S)just generate HL*1**S~
HL (O)just generate HL*2*1*O~
PRF/PRF-01use the first E1EDL20/E1EDL24/E1EDL41[QUALI = ‘001’]/BSTNR
HL (P)for each E1EDL20/E1EDL37
MAN/MAN-01hardcode “GM” (SSCC18)
MAN/MAN-02EXIDV
HL (I)for each E1EDL44 under current E1EDL37
LIN/LIN-02hardcode “BP” (Buyer’s Part Number)
LIN/LIN-03E1EDL24/KDMAT where E1EDL24/POSNR = E1EDL44/POSNR
SN1/SN1-02VEMNG
SN1/SN1-03VEMEH, convert “KGM” to “KG”
CTT/CTT-01number of HL loops in the transaction set

It is either impossible or hard to create such structure with just simple links. So how should it work? If you are familiar with Sterling products, you know that it uses temporary structures for such cases – i.e. you extend the source structure with additional records and field which “imitate” the target structure you need to build and then you use simple links to connect this temporary structure (or rather a mix of regular and temporary structures) with the target.

The approach I’m going to describe here is quite similar. But instead of extending the source structure I’m going to use a few additional steps – take the inbound IDoc XML, convert it into an intermediate XML structure with XSLT and then convert this intermediate XML into the target structure using a regular Boomi map.

On the next step we will create a temporary XML structure (XML Profile)

Next lesson

Gennady Kim