‎2018 Oct 19 1:18 PM
I am using bapi_goodsmvt_create and I don't know if I execute it if it works because it's not creating new movements .
Here is my code:
data lv_return type table of bapiret2 .
data :it_goodsmvt_item type table of bapi2017_gm_item_create,
wa_goodsmvt_item type bapi2017_gm_item_create.
data: ls_goodsmvt_header TYPE BAPI2017_GM_HEAD_01 .
data ls_zgo_lgort type zgo_mes_lgort .
data ls_zgo_resb type zgo_mes_resb .
ls_goodsmvt_header-pstng_date = sy-datum.
ls_goodsmvt_header-pr_uname = sy-uname.
wa_goodsmvt_item-move_type = 'Z61' .
wa_goodsmvt_item-stge_loc = ls_zgo_lgort-lgort .
wa_goodsmvt_item-item_text = ls_zgo_resb-maktx.
wa_goodsmvt_item-orderid = aufnr . "Input parameter of the function module
wa_goodsmvt_item-entry_qnt = quantity . "Input parameter of the FM
wa_goodsmvt_item-RESERV_NO = ls_zgo_resb-rsnum .
wa_goodsmvt_item-RES_ITEM = ls_zgo_resb-rspos .
wa_goodsmvt_item-material = ls_zgo_resb-matnr .
append wa_goodsmvt_item to it_goodsmvt_item.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = ls_goodsmvt_header
goodsmvt_code = '01'
* TESTRUN = ' '
* GOODSMVT_REF_EWM =
* GOODSMVT_PRINT_CTRL =
* IMPORTING
* GOODSMVT_HEADRET =
* MATERIALDOCUMENT =
* MATDOCUMENTYEAR =
tables
goodsmvt_item = it_goodsmvt_item
* GOODSMVT_SERIALNUMBER =
return = lv_return
* GOODSMVT_SERV_PART_DATA =
* EXTENSIONIN =
* GOODSMVT_ITEM_CWM =
.
‎2018 Oct 19 3:03 PM
Rachid - the answer to your question is actually spelled out in the detailed documention of the function module where it states:
The method can only perform your function if no error messages were generated in the Return table. This is the case if the header data and all the items were processed successfully.
Transaction control is not implemented. The calling program therefore has to execute the Commit Work itself after this method has been successfully invoked (in other words, if no errors were reported in the Return parameter).
----------
This information is just a click away in SE37 where it says "Function Module Documentation"
‎2018 Oct 19 1:39 PM
Try calling the function module BAPI_TRANSACTION_COMMIT after your BAPI.
‎2018 Oct 19 3:03 PM
Rachid - the answer to your question is actually spelled out in the detailed documention of the function module where it states:
The method can only perform your function if no error messages were generated in the Return table. This is the case if the header data and all the items were processed successfully.
Transaction control is not implemented. The calling program therefore has to execute the Commit Work itself after this method has been successfully invoked (in other words, if no errors were reported in the Return parameter).
----------
This information is just a click away in SE37 where it says "Function Module Documentation"
‎2018 Oct 20 8:40 PM
Hi,
Welcome to the SAP Community and thank you for coming for answers! I was able to find the answer to your question, as the same question occurred in the community before. See the answers that were already offered here or see this. If you haven’t tried this yet, I recommend searching in the community next time before you ask a question again. If you need further assistance feel free to reach out to moderators(at)sap(dot)com.
Best regards,
Iftah,
SAP Community moderator
‎2018 Oct 22 8:18 AM
Some beginner rules for BAPI
Rules for the forum