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 without plant

Former Member
0 Likes
1,842

Hello experts

I want to change the plant in some requisitions.

With ME52n it is possible. But with the bapi it don't work

Is there another BAPI to chnege the plant?

Is there another way to solve this problem?

Thank you for  answer

A. Bruy

1 ACCEPTED SOLUTION
Read only

SujeetMishra
Active Contributor
0 Likes
1,689

Hello Annette,

Please Refer to BAPI_PR_CHANGE Suggested by Raymond & Smruti.

Here is an example:

wa_pritemx-plant = 'ABC' " Your Plant Data..
append wa_pritemx to it_pritemx.

wa_pritem-plant          =  'Plant'

append wa_pritem to it_pritem.

CALL FUNCTION 'BAPI_PR_CHANGE'

    EXPORTING

      number                      = lv_banfn

*   PRHEADER                    =

*   PRHEADERX                   =

*   TESTRUN                     =

* IMPORTING

*   PRHEADEREXP                 =

TABLES

     return                      = it_change_return

     pritem                      = it_pritem

     pritemx                     = it_pritemx

*   PRITEMEXP                   =

*   PRITEMSOURCE                =

*   PRACCOUNT                   =

*   PRACCOUNTPROITSEGMENT       =

*   PRACCOUNTX                  =

*   PRADDRDELIVERY              =

*   PRITEMTEXT                  =

*   PRHEADERTEXT                =

*   EXTENSIONIN                 =

*   EXTENSIONOUT                =

*   PRVERSION                   =

*   PRVERSIONX                  =

*   ALLVERSIONS                 =

            .

 

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

* EXPORTING

*   WAIT          =

* IMPORTING

*   RETURN        =

Hello experts

I want to change the plant in some requisitions.

With ME52n it is possible. But with the bapi it don't work

Is there another BAPI to chnege the plant?

Is there another way to solve this problem?

Thank you for  answer

A. Bruy

10 REPLIES 10
Read only

Former Member
0 Likes
1,689

Hi Annette,

Check this BAPI "BAPI_PR_CHANGE"

Regard's

Smruti

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,689

BAPI_REQUISITION_CHANGE "Change Purchase Requisition" is related to ME52 now "outdated", BAPI_PR_CHANGE "Change Enjoy Purchase Requisition" is ME52N, use this one. (Also check notes like Note 582221 - FAQ: BAPIs for purchase orders)

Regards,

Raymond

Read only

SujeetMishra
Active Contributor
0 Likes
1,690

Hello Annette,

Please Refer to BAPI_PR_CHANGE Suggested by Raymond & Smruti.

Here is an example:

wa_pritemx-plant = 'ABC' " Your Plant Data..
append wa_pritemx to it_pritemx.

wa_pritem-plant          =  'Plant'

append wa_pritem to it_pritem.

CALL FUNCTION 'BAPI_PR_CHANGE'

    EXPORTING

      number                      = lv_banfn

*   PRHEADER                    =

*   PRHEADERX                   =

*   TESTRUN                     =

* IMPORTING

*   PRHEADEREXP                 =

TABLES

     return                      = it_change_return

     pritem                      = it_pritem

     pritemx                     = it_pritemx

*   PRITEMEXP                   =

*   PRITEMSOURCE                =

*   PRACCOUNT                   =

*   PRACCOUNTPROITSEGMENT       =

*   PRACCOUNTX                  =

*   PRADDRDELIVERY              =

*   PRITEMTEXT                  =

*   PRHEADERTEXT                =

*   EXTENSIONIN                 =

*   EXTENSIONOUT                =

*   PRVERSION                   =

*   PRVERSIONX                  =

*   ALLVERSIONS                 =

            .

 

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

* EXPORTING

*   WAIT          =

* IMPORTING

*   RETURN        =

Read only

0 Likes
1,689

Hello

Thank to all of you

I'll test it.

Annette

Read only

0 Likes
1,689

Hello

I just have some Problems of the used Table definitions:

'BAPI_PR_GETDETAIL'  

PRITEM =  BAPIMEREQITEM

'BAPI_PR_CHANGE'

PRITEM = BAPIMEREQITEMIMP ???

PRITEMX = BAPIMEREQITEMX  ???

I wanted to cast it but i failed.

What should i do?

Please help.

Thank for help

Annette

Read only

0 Likes
1,689

Hi,

Go to these BAPI and read the Long Text for these two tables.. hope it will help you to understand the purpose.

Regards,

Sujeet

Read only

0 Likes
1,689

Those are not the same structure than in the old BAPI

As with most current/standardized BAPI you have to fill only required fields in the first structure and pass value 'X' for field with same name in the second structure.

  • For first structure :  try some MOVE-CORRESPONDING statements (or build a mapper FM with transaction BDBS)
  • For second structure : just set to 'X' the fields which you want that the BAPI modifies.

(Read Change Parameters in Programming Standardized Parameters of BAPI Programming Guide Reference (CA-BFA) online documentation.)

Regards,

Raymond

Read only

0 Likes
1,689

Hello Raymond

Do i need BAPI_PR_GETDETAIL before using  'BAPI_PR_CHANGE'

When i used BAPI_REQUISITION_CHANGE i have first to use

BAPI_REQUISITION_GETDETAIL to fill the tables.

Thank you

Greets

Annette

Read only

0 Likes
1,689

No, you only have to fill the fields you want to change, no old/new values in recent BAPI.

Regards,

Raymond

Read only

0 Likes
1,689

Thank you

Thank you!

You are right!

I marked plant with x and filled the field with the new value.

Regards

Annette