Hi together,
I want to post a goods issue on an process order (some of them are networks) but I have some problem with filling the structures.
Could you please help me?
Book material
ls_bapi_head-pstng_date = ls_booking-budat.
ls_bapi_head-doc_date = sy-datum.
ls_bapi_head-pr_uname = sy-uname.
ls_bapi_item-material = ls_booking-idnrk.
ls_bapi_item-plant = p_werks.
ls_bapi_item-stge_loc = ls_booking-lgort.
ls_bapi_item-entry_qnt = ls_booking-dmeng.
ls_bapi_item-entry_uom = ls_booking-meins.
ls_bapi_item-orderid = ls_booking-aufnr.
ls_bapi_item-mvt_ind = gc_mvt_ind.
IF ls_bapi_item-entry_qnt > 0.
ls_bapi_item-move_type = '261'.
ELSE.
ls_bapi_item-move_type = '262'.
ENDIF.
APPEND ls_bapi_item TO lt_bapi_item.
CLEAR: lt_bapi_ret, ls_bapi_item.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = ls_bapi_head
goodsmvt_code = '03'
testrun = p_test
IMPORTING
materialdocument = ls_mat_bel
TABLES
goodsmvt_item = lt_bapi_item
return = lt_bapi_ret.