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

sample code for FM HU_CREATE_GOODS_MOVEMENT'

0 Likes
6,200

Hi,

My requirement is to move some HU within one plant from one storage loc to another storage loc.

for same purpose i am using HU_CREATE_GOODS_MOVEMENT.

now i am passing following parameters in internal table IT_MOVE_TO.

matnr

charg

werks

lgort ( destination storage loc)

and

in IT_EXTERNAL_ID, external handing unit number which has to be moved.

could you send me a sample code ? what parameters has to be passed ?

Thanks,

Satendra

2 REPLIES 2
Read only

former_member778253
Active Participant
0 Likes
2,843

Hi

Sample code for FM HU_CREATE_GOODS_MOVEMENT follows:

CALL FUNCTION 'HU_CREATE_GOODS_MOVEMENT'

EXPORTING

if_event = p_huwbevent

if_commit = ' '

if_tcode = 'VLMOVE'

it_move_to = li_move_to

it_external_id = li_external_id

IMPORTING

ef_posted = li_posted

es_message = li_message

et_messages = li_messages

ES_EMKPF = li_emkpf.

  • CHANGING

  • CT_IMSEG =

COMMIT WORK AND WAIT.

**********************************************************************

where,

p_huwbevent - process code for movement type (any)

*Process code for Movement 453

select single huwbevent into p_huwbevent

from THUWBBWART where stock_cat = 'R' and

move_type = c_good_mvt_453.

'VLMOVE' is the transaction code

"li_move_to" - is a workarea with plant and storage location data

"li_external_id" - is handling unit number

************************************************************************

Hope this help's you......

Read only

Rocky1
Product and Topic Expert
Product and Topic Expert
0 Likes
2,843

Hi,

Please check the following code:

SORT i_huitem BY hu_item_number hu_item_type obj_item_number .

READ TABLE i_huitem INDEX 1 INTO w_huitem.

IF sy-subrc EQ 0.

wa_move-matnr = w_huitem-material.

wa_move-werks = t001w-werks.

wa_move-lgort = t001l-lgort.

wa_move-sobkz = w_huitem-spec_stock.

wa_move-sonum = w_huitem-sp_stck_no.

wa_move-huwbevent = c_0007.

wa_move-bwart = c_301 .

ENDIF.

APPEND wa_move TO i_move.

wa_external-exidv = vekp-exidv.

APPEND wa_external TO i_external.

CALL FUNCTION 'HU_CREATE_GOODS_MOVEMENT'

EXPORTING

if_tcode = c_vlmove

it_move_to = i_move

it_external_id = i_external

IMPORTING

ef_posted = is_posted

et_messages = i_huitem_messages.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = c_x.

Hope it will help you.

Thanks & regards

Rocky Agarwal

9225545815