Application Development and Automation 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: 
Read only

Delivery Items not getting packed programmatically

Former Member
0 Likes
700

I have managed to create a handling unit in delivery using BAPI_HU_CREATE and BAPI_HU_CHANGE_HEADER. However I m not able to pack the items into the handling unit. I have tried BAPI_HU_PACK, PACK_HANDLING_UNIT_DLVRY etc but nothing is working. Most likely i m not passing the right parameters. Please help.

Will give points for the right answer. Thanks for reading.

2 REPLIES 2
Read only

Former Member
0 Likes
488

Hi,

To pack items in handling unit linked to a delivery, you can use FM WS_DELIVERY_UPDATE_2.

Here is an example of the call of FM:

w_vbkok-vbeln_vl = p_vbeln. "delivery number

w_verko-exidv = wa_vekp_pal-exidv. "HU in which you pack

APPEND w_verko TO i_verko.

CLEAR w_verpo.

w_verpo-exidv_ob = wa_vekp_pal-exidv.

w_verpo-EXIDV = wa_vekp_col-exidv.

w_verpo-velin = '3'. " 3 to pack a HU in another one

" 1 to pack a material in a HU

w_verpo-vbeln = p_vbeln.

APPEND w_verpo TO i_verpo.

CLEAR i_repack.

w_repack-desthu = wa_vekp_pal-exidv. "HU in which you pack

w_repack-sourcehu = wa_vekp_col-exidv. "HU to be packed

w_repack-packhu = 'X'.

APPEND w_repack TO i_repack.

CALL FUNCTION 'WS_DELIVERY_UPDATE_2'

EXPORTING

vbkok_wa = w_vbkok "delivery number

delivery = p_vbeln

TABLES

prot = i_prot

verko_tab = i_verko

verpo_tab = i_verpo

it_repack = i_repack

EXCEPTIONS

error_message = 1

OTHERS = 2.

COMMIT WORK AND WAIT.

Read only

0 Likes
488

hi Hervé,

i successfully run the following F.M,but what my problem is after i did my PGI (Post Goods Issue) i need to catch the material document number for that Delivery order, i unable to catch the material document number , could plz help me ....

i am using following code .

l_vbkok-vbtyp_vl = 'J'.

l_vbkok-vbeln = l_vbkok-vbeln_vl = DONO. "do number

l_VBKOK-WABUC = 'X'.

APPEND L_VBKOK.

l_verko-object = '01'.

l_verko-objkey = DONO.

APPEND: l_verko.

REFRESH I_LIPS.

SELECT * FROM LIPS

INTO TABLE I_LIPS

WHERE VBELN = DONO AND CHARG NE ''.

clear i_vbpok.

loop at i_lips..

*move-corresponding i_lips to i_vbpok.

i_VBPOK-VBELN_VL = i_lips-VBELN."Delivery

i_VBPOK-POSNR_VL = i_lips-POSNR."Delivery Item

i_VBPOK-POSNN = i_lips-POSNR."Delivery Item

i_VBPOK-VBELN = i_lips-VBELN."Pick Order

i_VBPOK-VBTYP_N = 'Q'.

i_VBPOK-PIKMG = I_LIPS-LFIMG.

i_VBPOK-MEINS = i_LIPS-MEINS.

*

**i_VBPOK-NDIFM = 0.

*i_VBPOK-TAQUI = ' '.

i_VBPOK-CHARG = i_LIPS-CHARG.

i_VBPOK-MATNR = i_LIPS-MATNR.

i_VBPOK-werks = i_LIPS-werks.

APPEND i_VBPOK.

ENDLOOP.

CALL FUNCTION 'WS_DELIVERY_UPDATE_2'

EXPORTING

vbkok_wa = l_vbkok

SYNCHRON = ''

NO_MESSAGES_UPDATE_1 = ' '

COMMIT = 'X'

delivery = DONO

UPDATE_PICKING = 'X'

NICHT_SPERREN_1 = 'X'

TABLES

VBPOK_TAB = i_vbpok

VERKO_TAB = l_verko.

if sy-subrc = 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' " call FM to

EXPORTING

wait = 'X'.

ENDIF.

With Advance Thanks ,

jana