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

Error in BAPI_GOODSMVT_CREATE

Former Member
0 Likes
2,715

hi,

i am doing a goods reversal from production order using movement type 262 in BAPI_GOODSMVT_CREATE. For the qty not yet produce i want to reverse the components. Every thing working fine except

for the discontinued component and follow on component in a production order i am getting only the follow on component to reverse.

but when i pass through bapi it returns the discontinued component with error as follows.

follow-on component = HWXC019-03357-0000REVA

discontinued comp = HWXC139-01004-0000

i am passing the follow-on component but gets the error with discontinued component.

TYPE-E ID-M7 NUMBER-022

MESSAGE-RE Quantity moved exceeded by 5.00 EA : HWXC139-01004-0000 8120 SM20 08

MESSAGE_V1 RE Quantity moved

MESSAGE_V2 5.00

MESSAGE_V3 EA

MESSAGE_V4 : HWXC139-01004-0000 8120 SM20 08

PARAMETER GOODSMVT_ITEM

For those components without discontinuation indicator works fine.

Please give me some solution

Thanks,

4 REPLIES 4
Read only

Former Member
0 Likes
1,218

Hi,

Here is some sample code from one of my programs, which does a 551 movement type. This should get you started. Just check the RETURN table for messages, they should tell you what you are missing.

code

Structures for BAPI

data: gm_header type bapi2017_gm_head_01.

data: gm_code type bapi2017_gm_code.

data: gm_headret type bapi2017_gm_head_ret.

data: gm_item type table of

bapi2017_gm_item_create with header line.

data: gm_return type bapiret2 occurs 0.

data: gm_retmtd type bapi2017_gm_head_ret-mat_doc.

clear: gm_return, gm_retmtd. refresh gm_return.

Setup BAPI header data.

gm_header-pstng_date = sy-datum.

gm_header-doc_date = sy-datum.

gm_code-gm_code = '06'. " MB11

Write 551 movement to table

clear gm_item.

move '551' to gm_item-move_type .

move '000000000040001234' to gm_item-material.

move '1' to gm_item-entry_qnt.

move 'EA' to gm_item-entry_uom.

move '0004' to gm_item-plant.

move '4000' to gm_item-stge_loc.

move '201' to gm_item-move_reas.

Determine cost center per plant

case xresb-werks.

when '0004'.

move '0000041430' to gm_item-costcenter.

when '0006'.

move '0000041630' to gm_item-costcenter.

when '0007'.

move '0000041731' to gm_item-costcenter.

when '0008'.

move '0000041830' to gm_item-costcenter.

endcase.

append gm_item.

Call goods movement BAPI

call function 'BAPI_GOODSMVT_CREATE'

exporting

goodsmvt_header = gm_header

goodsmvt_code = gm_code

importing

goodsmvt_headret = gm_headret

materialdocument = gm_retmtd

tables

goodsmvt_item = gm_item

return = gm_return.

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = 'X'.

[/code]

Welcome to SDN! Please remember to award points for helpful answers and mark you post as solved when solved completely. Thanks.

REgards,

Raj.

Read only

Former Member
0 Likes
1,218

Hi Madhu,

Please take a look at this links for sample coding of BAPI_GOODSMVT_CREATE.

http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm

http://www.4ap.de/abap/bapi_goodsmvt_create.php

Regards

Kiran Sure

Read only

Former Member
0 Likes
1,218

hi

i don't want program. i am already having it. i want to know the solution for the bapi return error which i stated above.

thanks

Read only

Former Member
0 Likes
1,218

hi all,

solved myself.

need to pass this parameter.

i_goodsmvt_item-res_type = ichgcnt-rsart.

thanks.