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_REQUISITION_CHANGE

Former Member
0 Likes
449

Hi!!

I`m tried the bapi BAPI_REQUISITION_CHANGE,it´s about modify an purchase requisition.

When I executed this bapi, it noticed me " doesn´t exist the requisition xxx".

This purcharse requisition exits.

The similar case happens me with the follow bapi: BAPI_REQUISITION_DELETE.

what is the trouble?

what is wrong?

grettings.

2 REPLIES 2
Read only

Former Member
0 Likes
392

before calling BAPI_REQUISITION_CHANGE you should read current data into ITEM (requisition_items and requisition_account_assignment).to do so :

data:

prnum TYPE bapieban-preq_no ,

i_pritem LIKE bapieban OCCURS 0 WITH HEADER LINE ,

i_acc LIKE bapiebkn OCCURS 0 WITH HEADER LINE ,

pritem LIKE bapiebanv OCCURS 0 WITH HEADER LINE ,

pritem_new LIKE bapiebanv OCCURS 0 WITH HEADER LINE ,

req_acc_old LIKE bapiebknv OCCURS 0 WITH HEADER LINE ,

req_acc_new LIKE bapiebknv OCCURS 0 WITH HEADER LINE

.

CALL FUNCTION 'BAPI_REQUISITION_GETDETAIL'

EXPORTING

number = prnum

account_assignment = 'X'

  • ITEM_TEXTS = ' '

  • SERVICES = ' '

  • SERVICE_TEXTS = ' '

TABLES

requisition_items = i_pritem

requisition_account_assignment = i_acc

  • REQUISITION_TEXT =

  • REQUISITION_LIMITS =

  • REQUISITION_CONTRACT_LIMITS =

  • REQUISITION_SERVICES =

  • REQUISITION_SERVICES_TEXTS =

  • REQUISITION_SRV_ACCASS_VALUES =

  • RETURN =

.

know you have data in internal tables and you can change these tables, you can loop in tables , but before change data MOVE these tables into New tables :

MOVE-CORRESPONDING i_pritem TO pritem .

MOVE-CORRESPONDING i_pritem TO pritem_new .

NOTE: dont change data in pritem ,just change pritem_new because we want to call BAPI_REQUISITION_CHANGE and we will send pritem_new and pritem.BAPI_REQUISITION_CHANGE will read pritem_new to change PR items.

also for account assingment:

MOVE-CORRESPONDING i_acc TO req_acc_old .

MOVE-CORRESPONDING req_acc_old TO req_acc_new.

APPEND req_acc_old.

" CHANGE VALUE IN req_acc_new (NOT IN req_acc_old)

req_acc_new-funds_ctr = 1000.

req_acc_new-cmmt_item = 482000.

append req_acc_new.

"----


NOW CALL bapi fm -


DATA: c_x LIKE bapita-wait .

c_x = 'X'.

DATA:ret TYPE TABLE OF bapiret2 WITH HEADER LINE .

CALL FUNCTION 'BAPI_REQUISITION_CHANGE'

EXPORTING

number = prnum

TABLES

requisition_items_old = pritem

requisition_items_new = pritem_new

requisition_account_old = req_acc_old

requisition_account_new = req_acc_new

  • REQUISITION_TEXT_OLD =

  • REQUISITION_TEXT_NEW =

return = ret

.

break rrostami.

READ TABLE ret INTO ret WITH KEY type = 'E' .

IF sy-subrc NE 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = c_x.

ENDIF.

Read only

Former Member
0 Likes
392

DEAR ,

SOMETIMES THIS PROBLEM HAPPENS BEACUSE PR NUMBER IN YOUR SYSTEM ARE LIKE 0012345458 BUT YOU SEND DATA IN BAPI_REQUISITION_CHANGE 12345458 (WITHOUT 2 ZERO)

PR NUMBER IS A 10 CHAR DATA TYPE .

Edited by: reza rostami on Jun 13, 2010 10:21 AM