Typical X12/EDIFACT/SAP IDoc mapping: a batch split

Today I want to explain how batch split works in SAP IDocs. For some reasons many developers have difficulty with this so I hope they would find this helpful.

What is the batch? Imagine a bakery which makes bread. Bread is the product. Batch is the bread of the same type made at one baking, i.e. a specific instance of this product. Batch has the same manufacturing/expiration dates, (usually) the same taste and other characteristics. So, the bakery makes the same bread 5 days a week and every baking produces a new batch – 5 different batches during a work week.

What is the batch split? In SAP IDoc it is a situation when the product contains one or more batches (specific instances) and the IDoc contains information about both product and its batches. It is where people are usually confused because IDoc uses the same records for both product (material) and its batch(es).

For example, in DELVRY SAP IDoc products/batches are described with E1EDL24. When there is no batch split, there will be one E1EDL24 per product:

    POSNR = 000010
    MATNR = 123456
    ARKTX = Wholewheat Bread
    LFIMG = 125.00
    VRKME = EA

A straight-forward situation – 125 loafs of Wholewheat Bread have been shipped. But it becomes different (and a bit tricky) when such IDoc contains information not only about the product, but also about its batches. If these 125 loafs are actually 100 loafs baked yesterday and 25 baked today, it will be something like this:

E1EDL24  <<< this is the product
    POSNR = 000010
    MATNR = 123456
    ARKTX = Wholewheat Bread
    LFIMG = 0.00    <<< its quantity is zero (!!)
    VRKME = EA
E1EDL24  <<< this is the 1st batch
    POSNR = 900001
    MATNR = 123456
    ARKTX = Wholewheat Bread
    LFIMG = 100.00    <<< its quantity is 100
    VRKME = EA
    HIPOS = 000010    <<< link to the "parent" product
    CHARG = ABC1234    <<< Batch ID
    VFDAT = 20200315    <<< Expiration Date
E1EDL24  <<< this is the 2nd batch
    POSNR = 900002
    MATNR = 123456
    ARKTX = Wholewheat Bread
    LFIMG = 25.00    <<< its quantity is 25
    VRKME = EA
    HIPOS = 000010    <<< link to the "parent" product
    CHARG = ABC1235    <<< Batch ID
    VFDAT = 20200316    <<< Expiration Date

So you could see the difference – now there is one E1EDL24 with zero quantity and no HIPOS, and 2 E1EDL24s with HIPOS which is the same as POSNR of the “parent” product. Usually there are 2 indicators of a batch split situation – (1) when some E1EDL24s have POSNRs which start with “9” and (2) when some E1EDL24s contain HIPOS elements. If you see such E1EDL24s – they are batches. I personally check the presence of HIPOS to understand if this is a batch and LFIMG of zero to understand it is the main product.

CHARG is the batch number, unique ID assigned to this particular batch.

I think it is obvious you cannot treat E1EDL24s equally when there is a batch split situation. Your implementation will depend on the requirements. If the trading partner isn’t interested in batches – you should use the main item only (“E1EDL24 with no HIPOS”) and use LFIMG of this item (if not zero) or the sum of LFIMGs of its batches (E1EDL24s where HIPOS is equal to the POSNR of this item). If they need batches – use batches (“E1EDL24 with HIPOS”) for items.

Also, there could be some mixed situations – when SAP IDoc might contain both products with and without batches. Or when the trading partner wants to have only one product but list all the batch numbers under it. And so on – but I hope it is clear now how to process such things.

Gennady Kim

2 thoughts on “Typical X12/EDIFACT/SAP IDoc mapping: a batch split

    • Thanks! You are right, it is often very important (because of expiration dates in particular), and unfortunately some developers do not understand how it works in SAP – they think there are some products with zero quantity 🙂

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s