2010 Feb 02 2:44 PM
Hi, I didn´t found any solution with this problem, even with search function and in google ;).
I am using BAPI BAPI_GOODSMVT_CREATE for posting GR on PO and I allways get the error: can´t post GR for purchasing order 5012134.
If I execute the BAPI with transaction SE37 it works. And if I GR with MB01 it also works.
Here is the code:
data:
L_HEAD LIKE BAPI2017_GM_HEAD_01,
L_CODE LIKE BAPI2017_GM_CODE,
L_TESTRUN LIKE BAPI2017_GM_GEN-TESTRUN,
L_MBLNR TYPE BAPI2017_GM_HEAD_RET-MAT_DOC,
L_MJAHR TYPE BAPI2017_GM_HEAD_RET-DOC_YEAR,
LT_ITEM TYPE TABLE OF BAPI2017_GM_ITEM_CREATE,
wa_item like line of LT_ITEM,
LT_RETURN TYPE TABLE OF BAPIRET2.
L_HEAD-PSTNG_DATE = sy-datum.
L_HEAD-DOC_DATE = sy-datum.
L_HEAD-HEADER_TXT = 'test'.
L_CODE-GM_CODE = '01'.
loop at itab.
wa_item-material = itab-matnr.
wa_item-plant = itab-werks.
wa_item-stge_loc = itab-lgort.
wa_item-move_type = '101'.
wa_item-po_number = itab-ebeln.
wa_item-po_item = itab-posnr.
wa_ITEM-MVT_IND = 'B'.
wa_ITEM-ENTRY_QNT = itab-MENGE.
append wa_item to lt_item.
endloop.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = L_HEAD
GOODSMVT_CODE = L_CODE
TESTRUN = L_TESTRUN
IMPORTING
MATERIALDOCUMENT = L_MBLNR
MATDOCUMENTYEAR = L_MJAHR
TABLES
GOODSMVT_ITEM = LT_ITEM
RETURN = LT_RETURN.
.
IF SY-SUBRC = 0.
COMMIT WORK AND WAIT.
ENDIF.
=> I don´t have any idea how to solve the problem. As I just enter the same values in SE37 and it works. If i debug the returnmessage gives me the error code E 036.
Anyone has an idea?
Best regards,
Christian
2010 Feb 02 3:00 PM
Hello,
M7/036 - No goods receipt possible for purchase order & &. So please make sure that you are using an open PO ready for Goods Receipt and uncomment the COMMIT statement.
Thanks,
Venu
2010 Feb 02 3:00 PM
Hello,
M7/036 - No goods receipt possible for purchase order & &. So please make sure that you are using an open PO ready for Goods Receipt and uncomment the COMMIT statement.
Thanks,
Venu
2010 Feb 02 3:09 PM
Hi,
thanks for the answer,
but the PO is ready for GR. I can GR with MB01 or with this BAPI and SE17.
And I don´t need to uncomment this commit line, because I debug and I see the returning table with error. He doesn´t post anything, even with commit. I already tried it.
Edited by: Christian Schoenen on Feb 2, 2010 4:10 PM
2010 Feb 02 3:52 PM
Hi,
Maybe this example can help you.
http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm
Regards,
Gilberto Li
2019 Jul 23 9:31 AM
Hi Christian,
Have you solved this issue? i am also facing same issue. i could do GR in MIGO, SE37 BAPI is also working. but in code, i am also getting the same error which you have mentioned. Please help if you know the solution for this
Thanks
Rani