12-07-2010 5:08 AM
Hi All,
DATA:it_returnreq TYPE STANDARD TABLE OF bapiret2 with header line,
it_pritem TYPE STANDARD TABLE OF bapimereqitemimp with header line,
it_pritemx TYPE STANDARD TABLE OF bapimereqitemx with header line,
it_pritemxp TYPE STANDARD TABLE OF bapimereqitem with header line.
it_pritem-preq_item = '00010'.
it_pritem-material = '3000000000029'.
it_pritem-quantity = '100'.
APPEND it_pritem.
CLEAR it_pritem.
it_pritemx-material = 'X'.
it_pritemx-quantity = 'X'.
it_pritemx-preq_item = 'X'.
APPEND it_pritemx.
CALL FUNCTION 'BAPI_PR_CHANGE'
EXPORTING
prnumber = '10008991'
TABLES
return = it_returnreq
pritem = it_pritem
pritemx = it_pritemx
pritemexp = it_pritemxp.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
Im using FM BAPI_PR_CHANGE to upadate table EBAN with new values. it_returnreq shows status as SUCCESS. But when i check the values in EBAN it doesn't show the new values that we need to update.
Thanks,
Barada
12-07-2010 5:22 AM
PR number has 10 characters.try giving leading zeros with PR number.
12-07-2010 5:22 AM
PR number has 10 characters.try giving leading zeros with PR number.
12-07-2010 5:25 AM
Hi AbapUser,
Thanks for the reply. I did try with that before. But still of no use.
Regards,
Barada
12-07-2010 5:29 AM
12-07-2010 6:05 AM
Nikhil & Abapuser,
Thanks for your time. Sorry to say but still it's not working.
These are the steps i followed further:
a) I removed the clear statement. b) Used TEST_RUN c) Instead of hard-coding the values i used a select statement on EBAN table and fetched the required fields and used the internal table values as below
DATA:it_returnreq TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE,
it_pritem TYPE STANDARD TABLE OF bapimereqitemimp WITH HEADER LINE,
it_pritemx TYPE STANDARD TABLE OF bapimereqitemx WITH HEADER LINE,
it_pritemxp TYPE STANDARD TABLE OF bapimereqitem WITH HEADER LINE.
TYPES : BEGIN OF i_eban,
banfn TYPE eban-banfn,
bnfpo TYPE eban-bnfpo,
matnr TYPE eban-matnr,
menge TYPE eban-menge,
werks TYPE eban-werks,
END OF i_eban.
DATA : it_eban TYPE STANDARD TABLE OF i_eban WITH HEADER LINE.
PARAMETER : p_banfn LIKE eban-banfn.
SELECT SINGLE banfn bnfpo matnr menge werks
FROM eban
INTO CORRESPONDING FIELDS OF it_eban
WHERE banfn = p_banfn.
it_pritem-preq_item = it_eban-bnfpo.
it_pritem-material = it_eban-matnr.
it_pritem-plant = it_eban-werks.
it_pritem-quantity = '5.000'. <<- I'm changing MENGE from 2.000 to 5.000.
APPEND it_pritem.
it_pritemx-preq_item = 'X'.
it_pritemx-material = 'X'.
it_pritemx-plant = 'X'.
it_pritemx-quantity = 'X'.
APPEND it_pritemx.
CALL FUNCTION 'BAPI_PR_CHANGE'
EXPORTING
prnumber = p_banfn
TABLES
return = it_returnreq
pritem = it_pritem
pritemx = it_pritemx
pritemexp = it_pritemxp.0
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
endif
12-07-2010 5:28 AM
Hi Badra,
After appending the internal tables why you are clearing it. may be it will the problem for sure....
Regards
Nikhil...
12-07-2010 6:07 AM
Change Following lines in the code.
it_pritemx-preq_item = '00010'. "'X' changed to '00010'
it_pritemx-preq_itemx = 'X'. "Line Added"
12-07-2010 6:24 AM
Hi All,
Got it Solved
The issue was with item level details. I used BAPI__PR_GETDETAILS. This FM gets all item level details and i passed it to BAPI_PR_CHANGE and marked 'X' for the fields that we need to change.
Thanks for all your help and time.
Regards,
Barada
09-01-2014 4:34 PM
09-01-2014 4:55 PM
when I have the PR aproved it doenst work, only works when it has not aproval