Application Development 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: 

BAPI_PR_CHANGE not updating table EBAN

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

former_member188827
Active Contributor
0 Kudos

PR number has 10 characters.try giving leading zeros with PR number.

9 REPLIES 9

former_member188827
Active Contributor
0 Kudos

PR number has 10 characters.try giving leading zeros with PR number.

0 Kudos

Hi AbapUser,

Thanks for the reply. I did try with that before. But still of no use.

Regards,

Barada

0 Kudos

try passing parameter TESTRUN = ' '.

0 Kudos

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

Former Member
0 Kudos

Hi Badra,

After appending the internal tables why you are clearing it. may be it will the problem for sure....

Regards

Nikhil...

Former Member
0 Kudos

Change Following lines in the code.

it_pritemx-preq_item = '00010'.          "'X' changed to '00010'
it_pritemx-preq_itemx = 'X'.               "Line Added"

0 Kudos

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

0 Kudos

This message was moderated.

0 Kudos

when I have the PR aproved it doenst work, only works when it has not aproval