Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Purchase requisition via BAPI

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.

replied

Hi Dexter,

If you specify values for Cost Center and GL account in this way be sure to include any suppressed zero's.

For instance: Cost Center is CHAR 10, so your coding should be:

t_pritadd-COST_CTR = '0000640210'.

Regards,

John.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question