CLEAR gmhead.
gmhead-pstng_date = ls_table-gzdate."sy-datum .
gmhead-doc_date = sy-datum .
gmhead-pr_uname = sy-uname.
gmhead-GR_GI_SLIP_NO = l_no.
* ***oode
CLEAR gmcode.
gmcode-gm_code = '01'.
select single MATNR VGBEL VGPOS
INTO (itab-material,itab-po_number,itab-po_item)
from LIPS
WHERE VBELN = l_no AND
POSNR = l_item.
* *****
select single werks LGORT into (itab-plant,itab-stge_loc)
from EKPO
where EBELN = itab-po_number and
EBELP = itab-po_item.
itab-mvt_ind = 'B'.
itab-DELIV_NUMB = l_no .
itab-DELIV_ITEM = l_item.
itab-entry_qnt = ls_table-recqty.
itab-QUANTITY = ls_table-recqty.
if ls_table-BATCH = 'CXNOTBATCH'.
itab-BATCH = ''.
ELSE.
itab-BATCH = ls_table-BATCH.
endif.
itab-move_type = '101'. "101 ,102 .
APPEND itab .
CLEAR itab .
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = gmhead
goodsmvt_code = gmcode
IMPORTING
goodsmvt_headret = mthead
materialdocument = mat_doc
TABLES
goodsmvt_item = itab
return = return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
手机扫一扫
移动阅读更方便
你可能感兴趣的文章