‎2010 Nov 17 7:32 PM
Hello,
I am using BAPI_GOODSMVT_CREATE and doing good receipt vs., a Purchase Order, GM 01. The material is auto batch managed and I see the batches are generated when I go into MSEG for the good receipt line items. However, batch numbers are not returned in the bapi return information.
Is there a way to get the batch numbers to return in the BAPI_GOODSMVT_CREATE bapi? If so, please let me know. If not, please also let me know and I will do a subsequent look-up to get that info.
Thanks
‎2010 Nov 18 1:36 AM
Hi,
As far as I know, BAPI_GOODSMVT_CREATE will not return the batch number, You need to do a subsequent look-up.
‎2011 Jan 20 6:20 AM
BAPI_GOODSMVT_CREATE will return the material document number posted. Use that to get the batch number from table MSEG.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = LS_GOODSMVT_HEADER
GOODSMVT_CODE = LS_GOODSMVT_CODE
IMPORTING
GOODSMVT_HEADRET = LS_GOODSMVT_HEADRET
TABLES
GOODSMVT_ITEM = LT_GOODSMVT_ITEM
RETURN = LT_RETURN.
IF LS_GOODSMVT_HEADRET-MAT_DOC IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = GC_TRUE
IMPORTING
RETURN = LS_RETURN.
SELECT SINGLE CHARG FROM MSEG INTO LV_CHARG
WHERE MBLNR EQ LS_GOODSMVT_HEADRET-MAT_DOC
AND ZEILE EQ '0001'.
ENDIF.
*Assumes single item document posted