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: 

Add existing Handling Unit to delivery

Former Member
0 Kudos
5,336

Hi @ all,

i have following problem, i have a existing HU and I create a Delivery so now I like to match them together like I could do in transaction VL02N over EDIT->Pack.

Any code examples how to do that? It seems to me that BAPI_HU_CHANGE_HEADER is one step but not all

thanks a lot

Matt

4 REPLIES 4

0 Kudos
1,311

While looking out for a solution to handle KITS in the reassignment transaction I came across the FM 'PACK_HANDLING_UNIT_DLVRY'.

It creates and packs a HU in the delivery. But there are some issues in this FM:

1. It doesn't updates the serial number in the HU because the parameter for passing serial number into another FM (that actually creates HU) has been commented out.

2. The table O_HU_ITEMS is populated wrongly in the line number 131.

I believe if we make a 'Z' FM using the FM's used inside the mentioned FM then we can take care of the 2 issues I have mentioned above.

Alternative solution:

1. BAPI_HU_CREATE - For HU creation

2. WS_DELIVERY_UPDATE - Update the delivery to link it with the HU.

Last Alternative:

Use a BDC to assign the HU to the delivery. It is a working solution.

I had tried solution mentioned under "Alternative solution:". I was successfully able to assign the HU's to the delivery but after that the PGI was not happening so i opted for the BDC and it worked.

I told you all the possible things i knew so that you can also try your hands on it.

Kindly have a look at it and let me know your observations.

0 Kudos
1,311

Hi,

currently I tried using the FMs: 'V51P_FILL_GT' and 'V51P_ADD_HU_TO_OBJEKT'

out of transaction VL02N but I don't figger out a commit work FM... so it will not work

at the moment. In my case I don't need to create a new HU so may a snip of code within 'PACK_HANDLING_UNIT_DLVRY' can may solve my problem:

  • CALL FUNCTION 'WS_DELIVERY_UPDATE'

  • EXPORTING

  • VBKOK_WA = LS_VBKOK_WA

  • SYNCHRON = 'X'

  • COMMIT = 'X'

  • DELIVERY = LS_VBKOK_WA-VBELN

  • NICHT_SPERREN = space

  • TABLES

  • PROT = LT_PROT

  • IT_HANDLING_UNITS = LT_REHANG

thanks so far I will post more if I test it tommorow!

Matt

0 Kudos
1,311

Here y solutions works in my situation:

init_ref_object-objkey = me->f_current_delivery.

ls_hu_mm-plant = plant.

ls_hu_mm-stge_loc = storage_location.

CALL FUNCTION 'HU_INITIALIZE_PACKING'

EXPORTING

is_object = init_ref_object

is_plant_stloc = ls_hu_mm

IMPORTING

et_messages = o_hu_messages

EXCEPTIONS

not_possible = 01.

DATA: ls_likp TYPE likp.

SELECT SINGLE * FROM likp

INTO ls_likp

WHERE vbeln = delivery.

CLEAR ls_vbkok.

ls_vbkok-vbeln_vl = ls_vbkok-vbeln = delivery.

ls_vbkok-vbtyp_vl = ls_likp-vbtyp.

ls_vbkok-wabuc = 'X'.

READ TABLE me->t_huheader INTO ls_huheader INDEX 1.

ls_handling_units-top_hu_internal = ls_huheader-venum.

  • Pro Position ein Rehang-Satz

LOOP AT me->t_huitems INTO ls_huitems

WHERE velin = 1.

ls_handling_units-venum = ls_huitems-venum.

ls_handling_units-vepos = ls_huitems-vepos.

ls_handling_units-rfbel = --> delivery

ls_handling_units-rfpos = --> delivery position

APPEND ls_handling_units TO lt_rehang.

ENDLOOP.

CALL FUNCTION 'WS_DELIVERY_UPDATE'

EXPORTING

vbkok_wa = ls_vbkok

synchron = 'X'

commit = 'X'

delivery = ls_vbkok-vbeln

nicht_sperren = space

TABLES

prot = lt_prot

it_handling_units = lt_rehang.

Regards Matt

ashraf_usmani
Participant
0 Kudos
1,311

it's working for my case.

Perfect

thanks

Ashraf