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: 

Changing PR using BAPI

Former Member
0 Kudos

Can anyone answer me with code how to change pr using bapi (BAPI_REQUISITION_CHANGE)?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi divye, try this...




     DATA : wa_old TYPE BAPIEBANC,

                wa_new TYPE BAPIEBANC.

         DATA: rett TYPE TABLE OF BAPIRETURN,

               ret_wa TYPE BAPIRETURN.

         CALL FUNCTION 'BAPI_REQUISITION_CHANGE'

           EXPORTING

             number                        = wa_new-preq_no

           tables

             requisition_items_old         = it_old

             requisition_items_new         = it_new

            RETURN                        = rett.



for this bapi u need to send the old value of PR(wa_old) as well with the changed values of PR(wa_new) as well..........



Hope this will work........



Regards,

Adarsh



3 REPLIES 3

Former Member
0 Kudos

Hi divye, try this...




     DATA : wa_old TYPE BAPIEBANC,

                wa_new TYPE BAPIEBANC.

         DATA: rett TYPE TABLE OF BAPIRETURN,

               ret_wa TYPE BAPIRETURN.

         CALL FUNCTION 'BAPI_REQUISITION_CHANGE'

           EXPORTING

             number                        = wa_new-preq_no

           tables

             requisition_items_old         = it_old

             requisition_items_new         = it_new

            RETURN                        = rett.



for this bapi u need to send the old value of PR(wa_old) as well with the changed values of PR(wa_new) as well..........



Hope this will work........



Regards,

Adarsh



0 Kudos

Hello Adarsh

This code works....Thank you...!!

raymond_giuseppi
Active Contributor
0 Kudos

Note that this BAPI is a pre-enjoy BAPI associated with ME52, better use BAPI_PR_CHANGE which is the "enjoy" BAPI associated with ME52N.

Ref: 499627 - FAQ: BAPIs for purchase requisitions


The function modules BAPI_REQUISITION_CREATE and BAPI_REQUISITION_CHANGE do not cover all of the functions of the EnjoySAP purchase requisition transactions. This is because the two asynchronous BAPIs have been developed based on ME51 and ME52 (program SAPMM06B). The user exits from the function group MEREQ (for example, MEREQ001) are therefore not available.

In SAP R/3 Release 4.70, two new API methods are developed that are based on the EnjoySAP technology of the purchase requisition transactions ME51N and ME52N. The function modules BAPI_PR_CREATE and BAPI_PR_CHANGE are released in Release 6.00 (ERP2005).

Regards,

Raymond