Skip to Content
0
Former Member
Oct 17, 2008 at 12:40 PM

Purchase requisition via BAPI

24 Views

Hi im trying to create a purchase requisition using the bapi BAPI_REQUISITION_CREATE.

My code is given below.

REPORT ZMM_PR_CREATE1_DEX1 .

data:t_pritem like standard table of BAPIEBANC with header line,

t_pritadd like standard table of BAPIEBKN with header line,

t_return like BAPIRETURN occurs 0 with header line,

v_ponumber(10).

t_pritem-DOC_TYPE = 'NB'.

t_pritem-MATERIAL = '91237'.

t_pritem-QUANTITY = '1'.

t_pritem-UNIT = 'ACR'.

t_pritem-DELIV_DATE = '20090120'.

t_pritem-PLANT = '6400'.

*t_pritem-STORE_LOC = '0132'.

t_pritem-ACCTASSCAT = 'K'.

append t_pritem.

t_pritadd-COST_CTR = '640210'.

*t_pritadd-G_L_ACCT = '512000120'.

append t_pritadd.

CALL FUNCTION 'BAPI_REQUISITION_CREATE'

EXPORTING

skip_items_with_error = 'X'

IMPORTING

NUMBER = v_ponumber

TABLES

REQUISITION_ITEMS = t_pritem

REQUISITION_ACCOUNT_ASSIGNMENT = t_pritadd

return = t_return.

loop at t_return.

write : t_return-MESSAGE.

endloop.

write : v_ponumber.

Now the problem is.

When i put all this data manually ie. through transaction ME51 it seems to go in just fine .

However when i send it as above it gives me the error message "Cost center 1000/640210 does not exist.

i just can't figure out why.

Pleas help guys. Relevent answers will be rewarded.