‎2008 Aug 14 1:29 PM
Hi Experts,
Could somebody please help me with updating the account assignment recipient field in purchase requisition using FM
BAPI_PR_CHANGE. Its running without any errors but not updating the field ebkn-wempf.
TABLES: eban.
DATA: i_ac LIKE bapimereqaccount OCCURS 0 WITH HEADER LINE,
i_acx LIKE bapimereqaccountx OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF i_eban,
banfn LIKE eban-banfn,
bnfpo LIKE eban-bnfpo,
wempf LIKE ebkn-wempf,
END OF i_eban.
i_eban-banfn = '0010008176'.
i_eban-bnfpo = '00040'.
i_eban-wempf = 'KYSH'.
i_ac-preq_item = i_eban-bnfpo.
i_ac-serial_no = '01'.
i_ac-gr_rcpt = i_eban-wempf.
APPEND i_ac. CLEAR i_ac.
i_acx-preq_item = i_eban-bnfpo.
i_acx-serial_no = '01'.
i_acx-preq_itemx = 'X'.
i_acx-serial_nox = 'X'.
i_acx-gr_rcpt = 'X'.
APPEND i_acx. CLEAR i_acx.
CALL FUNCTION 'BAPI_PR_CHANGE'
EXPORTING
prnumber = i_eban-banfn
TABLES
return = i_ret2
praccount = i_ac
praccountx = i_acx.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
It works perfectly fine for the same chnage for Purchase orders using BAPI_PO_CHANGE.
I don't understand where I am getting it wrong. Can somebody please help me out.
Regards,
Kiran.
‎2008 Aug 14 2:17 PM
Checking IF sy-subrc NE 0. may not be sufficient, execute a
LOOP AT i_ret2 WHERE TYPE = 'E' OR TYPE = 'A'.
EXIT.
ENDLOOP.if sy-subrc EQ 0, then there is an error message.
Try also to remove the
i_acx-preq_itemx = 'X'.You don't provide pertinent values to change that field, so don't put 'X' in the corresponding fields.
Regards