Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FM / BAPI to update outbound delivery packing with existing HU

Former Member
0 Kudos

Hello,

I have a requirement to <b>pack items in an outbound delivery with an existing HU</b>. I do not want to create a new HU as there is already and existing handling unit to be used. I tried using WS_DELIVERY_UDPATE but I'm encountering errors. I suspect that I am passing the wrong tables/import parameters.

Can someone please tell me exactly which <b>parameters/tables</b> need to be filled up in order for WS_DELIVERY_UPDATES to work according to my requirement? Again, <b>I do not want to create HU, the HU is already available</b>.

Thank you very much.

Sincerely,

Ice

8 REPLIES 8

Former Member
0 Kudos

Solved on my own.

0 Kudos

Hi Ice,

I'm experiencing the same issue. I managed to link the delivery to the existent HU but I missed something because the delivery item is not packed. Could you tell me which parameters did you fill in order perform the proper packing?

Many thanks in advance,

Pere

0 Kudos

Solved on my own too using a three steps approach. I'm attaching the code in order to reduce development effort.

*

  • Subprocess 1: Assign delivery to a HU

*

DATA:

lwa_vbkok LIKE vbkok,

i_hu LIKE STANDARD TABLE OF hum_rehang_hu WITH HEADER LINE,

i_hus LIKE STANDARD TABLE OF vekpvb WITH HEADER LINE.

CLEAR: lwa_vbkok,

i_hu,

i_hus.

REFRESH: i_hu,

i_hus.

  • Confirming Picking Data from Delivery Header

lwa_vbkok-vbeln = lips-vbeln.

lwa_vbkok-vbeln_vl = lips-vbeln.

lwa_vbkok-vbtyp_vl = likp-vbtyp.

  • Item HU

i_hu-top_hu_external = vekp-exidv.

i_hu-top_hu_internal = vekp-venum.

i_hu-venum = vekp-venum.

i_hu-rfbel = lips-vbeln.

i_hu-rfpos = lips-posnr.

APPEND i_hu.

CALL FUNCTION 'WS_DELIVERY_UPDATE'

EXPORTING

vbkok_wa = lwa_vbkok

synchron = c_mark

commit = c_mark

delivery = lips-vbeln

nicht_sperren = space

TABLES

it_handling_units = i_hu

et_created_hus = i_hus.

*

  • Subprocess 2: Pack HU

*

DATA:

i_item TYPE bapihuitmproposal OCCURS 0 WITH HEADER LINE,

l_hukey TYPE bapihukey-hu_exid,

i_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

CLEAR: i_item,

l_hukey,

i_return .

REFRESH: i_item,

i_return .

l_hukey = vekp-exidv.

CALL FUNCTION 'BAPI_HU_PACK'

EXPORTING

hukey = l_hukey

itemproposal = i_item

TABLES

return = i_return.

*

  • Subprocess 3: Pack assigned delivery

*

CONSTANTS: c_vbtyp_notification LIKE likp-vbtyp VALUE '7',

c_in_delivery LIKE verko-object VALUE '03',

c_out_delivery LIKE verko-object VALUE '01',

c_velin LIKE vepo-velin VALUE '1'.

DATA:

lwa_vbkok LIKE vbkok,

i_verko LIKE STANDARD TABLE OF verko WITH HEADER LINE,

i_verpo LIKE STANDARD TABLE OF verpo WITH HEADER LINE,

i_prot LIKE STANDARD TABLE OF prott WITH HEADER LINE.

CLEAR: lwa_vbkok,

i_verko,

i_verpo,

i_prot.

REFRESH: i_verko,

i_verpo,

i_prot.

  • Populate internal tables for update Delivery.

  • Confirming Picking Data from Delivery Header

lwa_vbkok-vbeln = lips-vbeln.

lwa_vbkok-vbeln_vl = lips-vbeln.

lwa_vbkok-vbtyp_vl = likp-vbtyp.

  • Handling-Unit Confirmation: Header Data

MOVE-CORRESPONDING vekp TO i_verko.

i_verko-ernam = sy-uname.

IF likp-vbtyp = c_vbtyp_notification. "Delivery/shipping

"Notification

i_verko-object = c_in_delivery. "Inbound Delivery

ELSE.

i_verko-object = c_out_delivery. "Outbound Delivery

ENDIF.

i_verko-objkey = lips-vbeln. "Object to Which the HU is Assigned

APPEND i_verko.

  • Handling Unit Confirmation: Content Data

MOVE-CORRESPONDING lips TO i_verpo.

i_verpo-exidv_ob = i_verpo-exidv = vekp-exidv.

i_verpo-velin = c_velin. "Material item

i_verpo-tmeng = p_rfmng. "QUANTITY

APPEND i_verpo.

CALL FUNCTION 'WS_DELIVERY_UPDATE'

EXPORTING

vbkok_wa = lwa_vbkok

synchron = c_mark

commit = c_mark

delivery = lips-vbeln

nicht_sperren = space

TABLES

verko_tab = i_verko

verpo_tab = i_verpo

prot = i_prot.

IF NOT i_prot[] IS INITIAL.

CLEAR: i_prot.

READ TABLE i_prot INDEX 1.

MESSAGE ID i_prot-msgid

TYPE i_prot-msgty

NUMBER i_prot-msgno

WITH i_prot-msgv1 i_prot-msgv2

i_prot-msgv3 i_prot-msgv4.

ENDIF.

0 Kudos

Hi Pere,

Many thanks - your code worked for me!

Best Regards,

Andrew

0 Kudos

It's always good to post the way you solve problems even if you think it's not necessary, you never know when someone else could make a good use of your answers. Thanks for posting the code.

0 Kudos

Hi Pere! thank you for the code!

I have one question, do you think that I can use these this approach if I have the requirement of assign an existing HU with stock already pack to an existing outbound delivery, because the HU have been received from other center and it is on HU manage storage location (is a container already pack with diferent materials).

So if I use the Subprocess 1: Assign delivery to a HU, and then skip the part when you Pack HU (Subprocess 2) because is already pack in stock , and proceeds with Subprocess 3: Pack assigned delivery with CALL FUNCTION 'WS_DELIVERY_UPDATE.

It would work for me?

Do you know which function can I use to assign an existing HU already packed with stock to an existing outbound delivery with same materials and qty that the HU have in stock.

thank you in advance!

regards

Former Member
0 Kudos

Hello Ice,

I try to use the same FM to update just the external 2nd handling unit number.

There are no other handy FMs.

I do not manage to get an update done.

Is this at all possible?

Could you please let me know the needed basic field values for the update process of HUs?

Thanks a lot in advance.

BR,

Former Member
0 Kudos

Hi Ice,

How did you solve ur problem?