Application Development 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: 

BAPI_GOODSMVT_CREATE Goods Issue 261 will not post

Former Member
0 Kudos

Hi

I'm using the  BAPI_GOODSMVT_CREATE bapi to perform a Goods Issue 261. The material document gets created just fine but it does not Post. I have to go into MIGO, select the item OK check box and then Post the document. Is there a way the  BAPI_GOODSMVT_CREATE will create and post the doc for us? My sample code is below:

" Tables

   DATA: lt_header  TYPE TABLE OF bapi2017_gm_head_01.

   DATA: gm_code    TYPE bapi2017_gm_code.

   DATA: lt_headret TYPE TABLE OF bapi2017_gm_head_ret.

   DATA: lt_item    TYPE TABLE OF bapi2017_gm_item_create.

   DATA: gm_return  TYPE TABLE OF bapiret2.

   DATA: gm_retmtd  TYPE bapi2017_gm_head_ret-mat_doc.

   "Structures

   DATA: ls_item LIKE LINE OF lt_item.

   DATA: ls_headret LIKE LINE OF lt_headret.

   DATA: ls_header LIKE LINE OF lt_header.

   CLEAR: gm_return, gm_retmtd.

   REFRESH gm_return.

* Setup BAPI header data.

   ls_header-pstng_date = sy-datum.

   ls_header-doc_date   = sy-datum.

   gm_code-gm_code      = '03'. " MB1A Goods issue

   " Write 261 movement to table

   CLEAR ls_item.

   ls_item-move_type = '261'.

   ls_item-material = '000000000000100001'.

   ls_item-entry_qnt = '1'.

   ls_item-entry_uom = 'EA'.

   ls_item-plant = '1000'.

   ls_item-stge_loc = '1001'.

****  ls_item-costcenter = '42020'.

   ls_item-orderid = '000003309717'.

   APPEND ls_item TO lt_item.

* Call goods movement BAPI

   CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

     EXPORTING

       goodsmvt_header  = ls_header

       goodsmvt_code    = gm_code

     IMPORTING

       goodsmvt_headret = ls_headret

       materialdocument = gm_retmtd

     TABLES

       goodsmvt_item    = lt_item

       return           = gm_return.

   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

     EXPORTING

       wait = ''.

1 ACCEPTED SOLUTION

TanmayVerma
Active Participant
0 Kudos

Hi Scott,

Please let us know what messages are returned in the return table after BAPI_GOODSMVT_CREATE call.

Also as a suggestion , try calling the BAPI_TRANSACTION_COMMIT without exporting the wait parameter as it is having a default value.

Regards,

Tanmay.

2 REPLIES 2

TanmayVerma
Active Participant
0 Kudos

Hi Scott,

Please let us know what messages are returned in the return table after BAPI_GOODSMVT_CREATE call.

Also as a suggestion , try calling the BAPI_TRANSACTION_COMMIT without exporting the wait parameter as it is having a default value.

Regards,

Tanmay.

0 Kudos

Looks like the wait parm might have been the issue. All is well now. Thanks Tanmay!