Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

I need help checking if a bapi works .

Former Member
1,542

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             =

    .
1 ACCEPTED SOLUTION
Read only

BaerbelWinkler
SAP Champion
SAP Champion
1,200

Rachid - the answer to your question is actually spelled out in the detailed documention of the function module where it states:

Further information

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"

4 REPLIES 4
Read only

keremkoseoglu
Contributor
0 Likes
1,200

Try calling the function module BAPI_TRANSACTION_COMMIT after your BAPI.

Read only

BaerbelWinkler
SAP Champion
SAP Champion
1,201

Rachid - the answer to your question is actually spelled out in the detailed documention of the function module where it states:

Further information

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"

Read only

iftah_peretz
Active Contributor
1,200

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

Read only

RaymondGiuseppi
Active Contributor
1,200

Some beginner rules for BAPI

  • Read their documentation (from a transaction such as SE37, SE80 or BAPI or in online help)
  • Check RETURN parameter for error messages
  • Commit/Rollback with FM BAPI_TRANSACTION*

Rules for the forum