cancel
Showing results for 
Search instead for 
Did you mean: 

Auto packaging in outbound delivery through abap code

Daderiga
Explorer
0 Kudos
1,086

Hi, I have this requirement where in exit ZXLTOU02 I create an HU with BAPI_HU_CREATE and then assign this HU to the outbound delivery with BAPI_HU_CHANGE_HEADER.

I tried to pack the material of the outbound delivery with BAPI_HU_PACK in the same user exit ZXLTOU02. 

My problem here is that I can get all done but in the outbound delivery I have the HU with a packed material but not the one in the outbound delivery. I'ts like the material item is not linked to the outbound delivery.

Here 2 pics.

The first one with my HU and its material linked to it.

The second one showing that, the material of the outbound delivery remains unpacked even though the first pick shows other thing.

Daderiga_0-1721289942368.png

Daderiga_1-1721289996770.png

I have read that you can update the outbound delivery and assign the HU and it's content through WS_DELIVERY_UPDATE but I can not find where I should implement this.

Any idea is welcome

 

Accepted Solutions (1)

Accepted Solutions (1)

DominikTylczyn
SAP Champion
SAP Champion
0 Kudos

Hello @Daderiga 

You can't pack deliveries with like BAPI_HU_PACK. It is explained in the note 581282 - Packing of deliveries via BAPI or function module

The note recommends to use either WHSCON IDocs or the WS_DELIVERY_UPDATE function. The former is preferable as the function is not released for customer usage.

I'd suggest to trigger WHSCON IDoc from the ZXLTOU02  exit. The IDoc functionality is documented on SAP Help Delivery Interface This way you'll have a SAP supported solution with a robust, workflow enabled error handling out-of-the-box.

Best regards

Dominik Tylczynski

Daderiga
Explorer
0 Kudos
Would you know which parameters of WS_DELIVERY_UPDATE must be filled to acomplish this objective?
Daderiga
Explorer
0 Kudos
Would you know which parameters of WS_DELIVERY_UPDATE must be filled to acomplish this objective? Thanks in advance
DominikTylczyn
SAP Champion
SAP Champion
0 Kudos

Hello @Daderiga 

No, I don't know that of the top of my head. However you can easily figure it out by yourself. Use WE19 to build WHSCON IDoc as described on the SAP Help page that I have provided previously. Once you are satisfied with how the IDoc packs the delivery, put a break point in WS_DELIVERY_UPDATE and WS_DELIVERY_UPDATE_2 - WHSCON IDocs are processed by one of those functions, I don't remember by which one exactly. This way you can get the right parameters to call the function. 

However, I'd suggest to use WHSCON IDocs, instead of calling WS_DELIVERY_UPDATE directly. It's much better - standard solution supported by SAP, robust error processing.

Best regards

Dominik Tylczynski

Answers (1)

Answers (1)

baris_yalcin
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Daderiga,

the Outbound Delivery OData API supports the assignment of a free/standalone Handling Unit to an Outbound Delivery:
https://help.sap.com/docs/SAP_S4HANA_CLOUD/588780cab2774a7ab9fffca3a7f919fe/27ca8a2be9924c76bdea2ab8...

I think that you could use also the Function Module WS_DELIVERY_UPDATE_2 for your purpose by using parameter IT_HANDLING_UNITS_1.

Best regards,
Barış Yalçın

Daderiga
Explorer
0 Kudos
I achieved it by BDC record and using a function with the IN BACKGROUND TASK DESTINATION 'NONE' statement.