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 costcenter error

Former Member
0 Likes
2,706

Hi,

I try to use BAPI_GOODSMVT_CREATE for goods movement of type 201.

When I had to send COSTCENTER parameter with the BAPI, Iit started to give errors such like "Cost center xxxx/yyyy does not exist on dd.mm.yyyy." but I'm sure that cost center exists in this period. Probabily error is something else. So I think I have to send some other parameters to BAPI but I'm not sure which one. Here I my parameters :

gmhead-pstng_date = sy-datum.

gmhead-doc_date = sy-datum.

gmhead-pr_uname = sy-uname.

gmhead-ref_doc_no = DOC_ID.

gmcode-gm_code = GM_CODE.

itab-mvt_ind = ''.

itab-plant = '0001'.

itab-material = PART_NO.

itab-entry_qnt = AMOUNT.

itab-entry_uom = ''.

itab-move_type = MOVE_TYPE.

itab-stge_loc = STORAGE.

itab-move_stloc = STORAGE_MOVE.

itab-batch = BATCH.

itab-spec_stock = SPEC_STOCK.

itab-vendor = CONS.

itab-costcenter = COSTCENTER.

So do you have any idea what can be the error? Before I sent costcenter to the BAPI, everything was correct.

Thanks...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,610

hi Cenk,

You would require to have <b>leading zeroes for the cost center</b> before you call the BAPI.

for example, if your KOSTL = '95320', then it has to be formatted to the

form '0000095320' with length 10. you can use the overlay statement or you can prefix with zeros based on the current length.

Hope this helps,

Sajan Joseph.

5 REPLIES 5
Read only

Former Member
0 Likes
1,610

HI,

Welcome to SDN...

check this... it might be useful for u..

http://sap4.com/wiki/index.php?title=BAPI_GOODSMVT_CREATE&printable=yes

Regards

SAB

Read only

Former Member
0 Likes
1,611

hi Cenk,

You would require to have <b>leading zeroes for the cost center</b> before you call the BAPI.

for example, if your KOSTL = '95320', then it has to be formatted to the

form '0000095320' with length 10. you can use the overlay statement or you can prefix with zeros based on the current length.

Hope this helps,

Sajan Joseph.

Read only

0 Likes
1,610

Yes you are right Sajan. Thank you...

Read only

0 Likes
1,610

You are right. Thanks.

Read only

Former Member
0 Likes
1,610

Unfortunately I have another problem now.

When the SPEC_STOCK is "K", I give the vendor to the BAPI. But this time I get error

"Account XXXXXXXXXX requires an assignment to a CO object"

And again it is possible to make goods movement by MB1A transaction. And also it was possible to run BAPI before I give COSTCENTER parameter with special stock "K". So I think it has to be given a default value for some parameter. But I have no idea which one..

Thanks...