Skip to Content
Technical Articles
Author's profile photo Dominik Tylczynski

Automatic packing of an inbound delivery created with DESADV IDoc

Following my recent blog on Subcontracting components in an inbound delivery via DESADV IDoc here is another eccentricity of DESADV IDocs processing.


Automatic Packing allows unattended handling units creation both for inbound and outbound deliveries. That works at the delivery creation or can be triggered latter on. This way, fully packed deliveries can be built, even if handling units are not provided explicitly.

That is of utmost importance in Decentralized Warehouse Management (LE-IDW) where goods receipts Link to Quality Management Through Handling Units. In other words a fully packed inbound delivery is a prerequisite for QM inspection lot creation:


LE-IDW goods receipt with QM integration. Source: SAP Help

The automatic packing can be driven either:

  • by packing instructions and packing instructions determination conditions or
  • by a custom logic implemented with BADI_HU_AUTOPACK enhancement.

The latter gives unlimited possibilities to build any packing algorithm required.

Problem statement

Recently, I have been implementing an inbound interface with DESADV / DELVRY07 IDocs. Due to LE-IDW integration, the requirement was to have deliveries fully packed. Automatic packing was the obvious choice. To my surprise however it works only partially:

  • If an inbound delivery contains main items only i.e. items numbered 10, 20, 30 etc., automatic packing works perfectly.
  • However if an inbound delivery contains also batch split items i.e. items numbered 900001, 900002, 900003, it does not work.

I ran the problem through SAP support. They confirmed my findings – it works with main items; it does not work with batch split items. They also explained why is that so. The culprit is the patchwork design of DESADV IDoc processing. Actually, it creates an inbound delivery in two internal steps:

  1. The first step calls the GN_DELIVERY_CREATE function to create an inbound delivery and its main items. The function supports automatic packing, which is why it works fine if batch split items are not provided in the IDoc.
  2. The second step adds batch split items with the WS_DELIVERY_UPDATE function. It does not provide automatic packing. So, DESADV IDoc with batch split items, no automatic packing.

That is confirmed with the note resulting from my OSS incident: 3067211 – No automatic packing for inbound delivery batch split items

I suggested to add one more step to the DESADV ALE message processing to trigger automatic packing after batch split items are created. That was rejected on the grounds that the current implementation is already complex and fragile enough and the of risk adding yet another piece to the puzzle is too big. I can understand that from the technical stand point. However, I was still disappointed as an SAP user.

Possible Workarounds

The note suggests at least two possible workarounds.

One is to build DESADV / DELVRY07 IDoc, so it does not contain any batch split items. That is perfectly doable as all necessary information about batches being delivered can be provided with main items. Batch split items are a bit superfluous here. The solution is implementable if you have control over how DESADV / DELVRY07 IDocs are constructed and sent to your system. For instance in case of an integration with an external vendor. That can be handled either in the middleware layer that builds the IDocs or with the IDoc processing BAdI enhancement.

This solution may prove difficult to implement however in the scenarios where the middleware is not available or where you do not really want to interfere with the IDoc structure – for instance in the Stock Transfer Between Distributed Systems (SD, MM) process that spans two SAP ERP or S/4HANA instances:


Distributed stock transfer process. Source: SAP Help

Here, an outbound delivery (7) possibly containing batch split items is sent with DESADV IDoc (8) and creates an inbound delivery (9). As both sending and receiving SAP systems use standard IDoc messages, translating batch split items to main items is counter intuitive.

Thus, the second workaround can be used in this case. The solution is to call automatic packaging of the inbound delivery once it is already created by SAP standard DESADV IDoc processing. Even though there is no BAPI function to trigger automatic packing, it is fairly easy to implement it with a simple BDC call to the VL32N transaction – I know, BDCs are out of fashion now, but it is still better than nothing. The BDC call can be wrapped in a custom function module or procedure and called once the inbound delivery is created by the IDoc.

The drawback of this approach is that the creation and the automatic packing of an inbound delivery are not executed as one atomic operation, in one logical unit of work. Therefore, it requires a bit of monitoring to ensure all the inbound deliveries are indeed packed automatically.

Soon, I am going to explain how to implement the second workaround with a custom output type automation.

Stay tuned – my blogs


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Ann Hustis
      Ann Hustis

      Dominik thanks very much for posting this.  I agree with you that this is a big miss by SAP.  Think of how many industries are batch managed!  I look forward to your next post about the subject.  Best regards, Ann

      Author's profile photo Dominik Tylczynski
      Dominik Tylczynski
      Blog Post Author

      Indeed this is a miss. Fortunately there are workarounds. I wish SAP issued a "missing functionality" note with a workaround implementation proposal.

      Cheers, Dominik

      Author's profile photo False Shade
      False Shade

      This Document purviews various approaches to setup inbound delivery in SAP. Inbound delivery is delivery pertaining to incoming good. It’s publix oasis Different from Outbound delivery in sense that outbound delivery encompasses scenario when goods move out of a plant, whereas inbound delivery is about receipt of goods. Thus inbound delivery is created at receiving entity. 

      Author's profile photo Ganesh Prabhu
      Ganesh Prabhu

      Hi Dominik,
      Thanks for the article. I am working on setting up QM flow with Decentralized Warehouse system (Non SAP). Would you please help providing any documents or guide on how automatic packing can be achieved through GN_DELIVERY_CREATE function to create an inbound delivery

      Author's profile photo Dominik Tylczynski
      Dominik Tylczynski
      Blog Post Author

      Hi Ganesh Prabhu

      I don't know all the technical details of how GN_DELIVERY_CREATE function handles automatic packing. I presume that it works the same way in the function as in the DESADV IDoc processing. Also SAP support explained that GN_DELIVERY_CREATE triggers the automatic update process.

      If so, you can either use packing instructions and packing instructions determination records to drive the automatic packing process or implement your own logic with BADI_HU_AUTOPACK. In any case you need to active the automatic packing in the customizing settings of the inbound delivery type.


      Dominik Tylczynski

      Author's profile photo Shyamkiran Shetty
      Shyamkiran Shetty

      Hi Dominik,

      Thank you for sharing this.

      Is packing instruction mandatory to use BADI_HU_AUTOPACK?Could provide some details around this?



      Author's profile photo Dominik Tylczynski
      Dominik Tylczynski
      Blog Post Author

      Hello Shyamkiran Shetty

      Packing instructions are not necessary to use BADI_HU_AUTOPACK. However if you decide to use packing instructions together with the BAdI, then first the packing proposal is built with packing instructions, then the result is passed to the BAdI. You can modify it there.

      If you don't use packing instructions, then you need to build the packing proposal from scratch in the BAdI implementation. That is quite straight forward and I have always used the BAdI without packing instructions.

      The BAdI is very well documented, so I'd suggest to start from there.

      Best regards

      Dominik Tylczynski