Bapi_goodsmvt_create
Prueba con lo siguiente, espero te sirva.
*---- Llenamos data de la Cabacera
wa_goodsmvt_header-pstng_date = doc_date.
wa_goodsmvt_header-doc_date = doc_date.
wa_goodsmvt_code-gm_code = '03'.
LOOP AT consuor.
*---- Llenamos data del Detalle
wa_goodsmvt_item-material = consuor-matnr.
wa_goodsmvt_item-orderid = consuor-aufnr.
wa_goodsmvt_item-plant = plant.
wa_goodsmvt_item-stge_loc = stge_loc.
wa_goodsmvt_item-batch = batch.
wa_goodsmvt_item-move_type = move_type.
wa_goodsmvt_item-entry_qnt = consuor-menge.
wa_goodsmvt_item-entry_uom = entry_uom.
APPEND wa_goodsmvt_item TO t_goodsmvt_item.
AT END OF aufnr.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = wa_goodsmvt_header
goodsmvt_code = wa_goodsmvt_code
IMPORTING
goodsmvt_headret = wa_goodsmvt_headret
TABLES
goodsmvt_item = t_goodsmvt_item
return = t_return.
IF t_return-type NE 'E'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'W'.
Saludos
|