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 not update eban

Former Member
0 Likes
839

hi all,

i coded this:

CALL FUNCTION 'BAPI_REQUISITION_GETDETAIL'

EXPORTING

number = w_banfn

tables

requisition_items = ieban

RETURN = ireturn

.

if sy-subrc = 0.

refresh: iebano,iebann.

iebano[] = ieban[].

iebann[] = ieban[].

clear: iebann.

read table iebann index 1.

iebann-TRACKINGNO = 'abc123'.

modify iebann index 1.

CALL FUNCTION 'BAPI_REQUISITION_CHANGE'

EXPORTING

number = w_banfn

tables

requisition_items_old = iebano

requisition_items_new = iebann

RETURN = ireturn

.

COMMIT WORK .

endif.

error msg happens after commit work: E W5030 Purchase requisition 010108039 does not exist 0010108039

did i miss anyhing

hi all,

i coded this:

CALL FUNCTION 'BAPI_REQUISITION_GETDETAIL'

EXPORTING

number = w_banfn

tables

requisition_items = ieban

RETURN = ireturn

.

if sy-subrc = 0.

refresh: iebano,iebann.

iebano[] = ieban[].

iebann[] = ieban[].

clear: iebann.

read table iebann index 1.

iebann-TRACKINGNO = 'abc123'.

modify iebann index 1.

CALL FUNCTION 'BAPI_REQUISITION_CHANGE'

EXPORTING

number = w_banfn

tables

requisition_items_old = iebano

requisition_items_new = iebann

RETURN = ireturn

.

COMMIT WORK .

endif.

error msg happens after commit work: E W5030 Purchase requisition 010108039 does not exist 0010108039

did i miss anyhing

1 REPLY 1
Read only

Former Member
0 Likes
581

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.