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: 

How to call function BAPI_GOODSMVT_CREATE ?

Former Member
0 Kudos
716

Hi all,

I want to create a material document by calling the function BAPI_GOODSMVT_CREATE

I don't know what to pass although I know I have to export something (GOODSMVT_HEADER and GOODSMVT_CODE) in my ABAP. But what should I actually pass to the function?

Thanks.

6 REPLIES 6

Former Member
0 Kudos
152

What you pass to this BAPI is dependent on what movement you want to do. There is excellent documentation associated with it, please go through it. You need to pass goods movement item structure apart from the structures you already identified.

0 Kudos
152

I'm moving the own stock to vendor consignment stock.

What is the goods movement item structure?

where can I find it?

Oh. I got it in the tables of the function. Thanks.

but what is GM_CODE ?

Message was edited by: Macy Lo

Message was edited by: Macy Lo

0 Kudos
152

Hi,

Try with this

data : gt_header like bapi2017_gm_head_01 ,

gt_code like bapi2017_gm_code,

gt_item like bapi2017_gm_item_create occurs 0,

gt_sno like bapi2017_gm_serialnumber occurs 0.

gt_code-gm_code ='03'. "goods issue

In the header pass the posting date, header text etc...

and in the line item populate material, plant, storage location, movement type.....

IF necessary pass the serial number in the gt_sno table

call function 'BAPI_GOODSMVT_CREATE'

exporting

goodsmvt_header = gt_header

goodsmvt_code = gt_code

tables

goodsmvt_item = gt_item

goodsmvt_serialnumber = gt_sno

return = gt_return.

Cheers

Sasi

0 Kudos
152

HI,

GM code used to determine whether is goods issue, transfer posting or Goods receipt for purchase order like that.

GM code 01: Goods receipt for purchase order

GM_Code 02: Goods receipt for production order

GM_Code 03: Goods issue

GM_Code 04: Transfer posting

GM_Code 05: Other goods receipts

GM_Code 06: Reversal of goods movements

Cheers,

Sasi

0 Kudos
152

Hi all,

I can call the function and finally got the material doc. and material doc. year.

but when I use MB03 to display the material doc with the doc year, the material doc is not found. what's wrong with it?

0 Kudos
152

Hi Macy,

The reason for that is you didn't do a commit after your bapi call. If the call to the BAPI is successful, do another call right after that to the BAPI

'BAPI_TRANSACTION_COMMIT'.

If you are doing this through SE37, then you need to do the following.

In the initial screen of SE37, in the menu choose 'Function Module'>'Test'>'Test Sequences'. This will allow you to enter more than one function module in sequence. Enter 'BAPI_GOODSMVT_CREATE' first and then enter 'BAPI_TRANSACTION_COMMIT'. Once you execute the sequence, you should be able to see the material document in MB03.

Please reward and close, if it helps.

Srinivas