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

Problem in committing the bapi /AFS/BAPI_GOODSMVT_CREATE

Former Member
0 Likes
765

Hi Friends,

I am doing an object to create the goods movement for the transfer posting by the Reservation No. i am able to create the BAPI and generate the Document No for corresponding data. The problem is with commiting the data. I called the function module Bapi_transaction_commit and passed the necessary parameters. But not able to commit the transaction. Also i created the test data with the same values as in my program. when i am trying to commit then, it is doing perfectly. I am unable to get what is the problem with my BAPI.

Here is the code I wrote for my BAPI.

goodsmvt_header TYPE bapi2017_gm_head_01,

goodsmvt_code TYPE bapi2017_gm_code,

goodsmvt_headret TYPE bapi2017_gm_head_ret,

materialdocument TYPE bapi2017_gm_head_ret-mat_doc,

matdocumentyear TYPE bapi2017_gm_head_ret-doc_year,

reservation TYPE bapirkpf-res_no,

wa_reservation_items TYPE /afs/bapiresb,

DATA BEGIN OF messtab OCCURS 10.

INCLUDE STRUCTURE bdcmsgcoll.

DATA END OF messtab.

DATA: BEGIN OF itab OCCURS 100.

INCLUDE STRUCTURE /afs/bapi2017_gm_item_create.

DATA: END OF itab.

DATA: reservation_items TYPE TABLE OF /afs/bapiresb WITH HEADER LINE,

reservation_items1 TYPE TABLE OF /afs/bapiresb WITH HEADER LINE,

afs_goodsmvt_item TYPE TABLE OF /afs/bapi2017_gm_item_create WITH

HEADER LINE,

goodsmvt_header-pstng_date = sy-datum.

goodsmvt_header-doc_date = sy-datum.

LOOP AT gt_out INTO wa_out WHERE sel = 'X'.

MOVE: wa_out-material TO itab-material,

wa_out-req_unit TO itab-entry_uom,

wa_out-unload_pt TO itab-unload_pt,

wa_out-short_text TO itab-item_text,

wa_out-batch TO itab-batch,

wa_out-sloc TO itab-stge_loc,

wa_out-mloc TO itab-move_stloc,

wa_out-grid_value TO itab-grid_value,

wa_out-stock_cat TO itab-stock_cat,

wa_out-orderid TO itab-orderid,

wa_out-batch TO itab-move_batch,

wa_out-unqty TO itab-entry_qnt.

itab-plant = io7.

itab-move_plant = io7.

itab-move_mat = wa_out-material.

IF listvalue = 'A'.

itab-move_type = '311'.

ELSE.

itab-move_type = '911'.

ENDIF.

APPEND itab.

clear wa_out.

ENDLOOP.

CALL FUNCTION '/AFS/BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header = goodsmvt_header

goodsmvt_code = goodsmvt_code

TESTRUN = ' '

IMPORTING

GOODSMVT_HEADRET = GOODSMVT_HEADRET

MATERIALDOCUMENT = MATERIALDOCUMENT

MATDOCUMENTYEAR = MATDOCUMENTYEAR

tables

afs_goodsmvt_item = itab

GOODSMVT_SERIALNUMBER =

return = errmsg

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'

IMPORTING

RETURN =

.

4 REPLIES 4
Read only

Former Member
0 Likes
595

Did u try this way??

Data st_return TYPE bapiret2.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = st_return.

Read only

0 Likes
595

Yes i tried like that also. I am not getting any errors in return table in BAPI_TRANSACTION_COMMIT

Read only

Former Member
0 Likes
595

Check the FM documentation and make sure that you are passing all the required parameters for this BAPI.

Also - I am not sure what you exact requirements are but there is a standard object in LSMW for goods movements.

Object = 0110

Method = 0000

Program = RM07MMBL

Batch Input

Try that and see if it meets your needs.

Read only

Former Member
0 Likes
595

Did you get any express mail?

Do transactions SM13 or SM14 show anything?

Rob