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

BAPI_GOODSMVT_CREATE

Former Member
0 Likes
1,644

hello all,

I have a requirement where I need to use the BAPI "BAPI_GOODSMVT_CREATE" to post stock from unrestricted to QI (using batch movement 349). All I have is a material number and a batch number. Can you please help me in using this BAPI?

Thanks verymuch in advance...

-Venky

11 REPLIES 11
Read only

Former Member
0 Likes
1,339

It appears to be well documented. Have you checked that?

Rob

Read only

Former Member
0 Likes
1,339

yes Rob..I was able to write the code but Iam getting the error

'Error in function Goods movement not possible with mvmt type 349'

here is my sample code

**************************************

tables: mchb, mard.

parameters: p_matnr like mchb-matnr,

p_werks like mchb-werks,

p_charg like mchb-charg,

p_lgort like mard-lgort.

data: begin of gmhead.

include structure bapi2017_gm_head_01.

data: end of gmhead.

data: begin of gmcode.

include structure bapi2017_gm_code.

data: end of gmcode.

data: begin of mthead.

include structure bapi2017_gm_head_ret.

data: end of mthead.

data: begin of itab occurs 100.

include structure bapi2017_gm_item_create.

data: end of itab.

data: begin of errmsg occurs 10.

include structure bapiret2.

data: end of errmsg.

data: wmenge like iseg-menge,

errflag.

data: v_labst like mard-labst.

start-of-selection.

itab-material = p_matnr.

itab-plant = p_werks.

itab-batch = p_charg.

itab-stge_loc = p_lgort.

select single labst from mard

into v_labst

where matnr = p_matnr

and werks = p_werks

and lgort = p_lgort.

gmhead-pstng_date = sy-datum.

gmhead-doc_date = sy-datum.

gmhead-pr_uname = sy-uname.

gmcode-gm_code = '02'.

*loop at itab.

itab-move_type = '349'.

itab-mvt_ind = 'F'.

itab-entry_qnt = v_labst.

append itab.

*endloop.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

GOODSMVT_HEADER = gmhead

GOODSMVT_CODE = gmcode

  • TESTRUN = ' '

  • IMPORTING

  • GOODSMVT_HEADRET = mthead

  • MATERIALDOCUMENT =

  • MATDOCUMENTYEAR =

TABLES

GOODSMVT_ITEM = itab

  • GOODSMVT_SERIALNUMBER =

RETURN = errmsg

.

clear errflag.

loop at errmsg.

if errmsg-type eq 'E'.

write:/'Error in function', errmsg-message.

errflag = 'X'.

else.

write:/ errmsg-message.

endif.

endloop.

if errflag is initial.

commit work and wait.

if sy-subrc ne 0.

write:/ 'Error in updating'.

exit.

else.

write:/ mthead-mat_doc, mthead-doc_year.

  • perform upd_sta.

endif.

endif.

Read only

0 Likes
1,339

Have you checked the long text for the message?

Rob

Read only

0 Likes
1,339

"Goods movement not possible with mvmt type 349"

This is the error mssg I found in the "return" table (errmsg-message) of the BAPI.

Read only

0 Likes
1,339

There will be a message id and number with the error. Can you see what these are?

Rob

Read only

Former Member
0 Likes
1,339

If you were to do this online, which transaction (other than MIGO), would you use? Depending on that you will have to decide the GM_CODE. Not all goods movements are possible using this BAPI. Also some movement types are configured as automatic postings and you cannot use BAPI for such movements.

Read only

Former Member
0 Likes
1,339

Also, 349 is not "unrestricted to QI", it is "blocked to QI". Check with your functional person to get the correct movement type or the requirement.

Read only

Former Member
0 Likes
1,339

hi Venky,

this rather sounds like an application error. Are you sure that movement type 389 (or whatever this was...) can be used in your system?

Did you debug where this error is raised? This might help you to limit the root cause of your issue.

Regards

Wolfgang

Read only

0 Likes
1,339

I just found out that the movement type is actually 322 and not 349. The transaction they use id ZMIGO (copied from MIGO).

Can anyone please suggest me what would be the next step? Can I still use the same BAPI? or do u suggest me to go for a BDC?

Please let me know.

Thanks,

-Venky

Read only

0 Likes
1,339

I got it..thanks all for the replies.

Read only

0 Likes
1,339

thanks