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_PO_CHANGE problem

milascon_daniel
Participant
0 Kudos
890

Hi,

I want to modify a PO but it's not working ... when I execute this code nothing happened, i've checked in PO (ME23N). Please someone help me. Thank you.

PARAMETER ebeln TYPE ekpo-ebeln OBLIGATORY.

DATA: BEGIN OF it_pointem OCCURS 0.
        INCLUDE STRUCTURE  bapimepoitem.
DATA: END OF it_pointem.

DATA: BEGIN OF it_pointemx OCCURS 0.
        INCLUDE STRUCTURE bapimepoitemx.
DATA: END OF it_pointemx.

it_pointem-vend_mat = 'EAN1234'.
APPEND it_pointem.
it_pointemx-vend_mat = 'X'.
APPEND it_pointemx.

CALL FUNCTION 'BAPI_PO_CHANGE'
  EXPORTING
    purchaseorder = ebeln
*   poheader      = 
*   POHEADERX                    =
*   POADDRVENDOR                 =
*   TESTRUN                      =
*   MEMORY_UNCOMPLETE            =
*   MEMORY_COMPLETE              =
*   POEXPIMPHEADER               =
*   POEXPIMPHEADERX              =
*   VERSIONS                     =
*   NO_MESSAGING                 =
*   NO_MESSAGE_REQ               =
*   NO_AUTHORITY                 =
*   NO_PRICE_FROM_PO             =
* IMPORTING
*   EXPHEADER                    =
*   EXPPOEXPIMPHEADER            =
 TABLES
*   RETURN                       =
poitem                       = it_pointem
POITEMX                      = IT_POINTEMX
*   POADDRDELIVERY               =
*   POSCHEDULE                   =
*   POSCHEDULEX                  =
*   POACCOUNT                    =
*   POACCOUNTPROFITSEGMENT       =
*   POACCOUNTX                   =
*   POCONDHEADER                 =
*   POCONDHEADERX                =
*   POCOND                       =
*   POCONDX                      =
*   POLIMITS                     =
*   POCONTRACTLIMITS             =
*   POSERVICES                   =
*   POSRVACCESSVALUES            =
*   POSERVICESTEXT               =
*   EXTENSIONIN                  =
*   EXTENSIONOUT                 =
*   POEXPIMPITEM                 =
*   POEXPIMPITEMX                =
*   POTEXTHEADER                 =
*   POTEXTITEM                   =
*   ALLVERSIONS                  =
*   POPARTNER                    =
      .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    wait          = ' '
* IMPORTING
*   RETURN        =
          .

1 ACCEPTED SOLUTION

Former Member
0 Kudos
303

Hi Dan,

You have to include the position number you want to change.

Regards,

John.

14 REPLIES 14

Former Member
0 Kudos
304

Hi Dan,

You have to include the position number you want to change.

Regards,

John.

0 Kudos
303

ups ...

0 Kudos
303

John, it's not working, i've append to it possition number and also i've checked the return message and no message is returned;

any idea?

PARAMETER ebeln TYPE ekpo-ebeln OBLIGATORY.

DATA: BEGIN OF it_pointem OCCURS 0.
        INCLUDE STRUCTURE  bapimepoitem.
DATA: END OF it_pointem.

DATA: BEGIN OF it_pointemx OCCURS 0.
        INCLUDE STRUCTURE bapimepoitemx.
DATA: END OF it_pointemx.

DATA : BEGIN OF it_return OCCURS 0.
        INCLUDE STRUCTURE bapiret2.
DATA : END OF it_return.

DATA: mesg TYPE string.


it_pointem-vend_mat = 'EAN1234'.
it_pointem-po_item = '00010'.
APPEND it_pointem.
it_pointemx-vend_mat = 'X'.
APPEND it_pointemx.

CALL FUNCTION 'BAPI_PO_CHANGE'
  EXPORTING
    purchaseorder = ebeln
*   poheader      = it_expheader
*   POHEADERX                    =
*   POADDRVENDOR                 =
*   TESTRUN                      =
*   MEMORY_UNCOMPLETE            =
*   MEMORY_COMPLETE              =
*   POEXPIMPHEADER               =
*   POEXPIMPHEADERX              =
*   VERSIONS                     =
*   NO_MESSAGING                 =
*   NO_MESSAGE_REQ               =
*   NO_AUTHORITY                 =
*   NO_PRICE_FROM_PO             =
* IMPORTING
*   EXPHEADER                    =
*   EXPPOEXPIMPHEADER            =
 TABLES
   return                       = it_return
poitem                       = it_pointem
poitemx                      = it_pointemx
*   POADDRDELIVERY               =
*   POSCHEDULE                   =
*   POSCHEDULEX                  =
*   POACCOUNT                    =
*   POACCOUNTPROFITSEGMENT       =
*   POACCOUNTX                   =
*   POCONDHEADER                 =
*   POCONDHEADERX                =
*   POCOND                       =
*   POCONDX                      =
*   POLIMITS                     =
*   POCONTRACTLIMITS             =
*   POSERVICES                   =
*   POSRVACCESSVALUES            =
*   POSERVICESTEXT               =
*   EXTENSIONIN                  =
*   EXTENSIONOUT                 =
*   POEXPIMPITEM                 =
*   POEXPIMPITEMX                =
*   POTEXTHEADER                 =
*   POTEXTITEM                   =
*   ALLVERSIONS                  =
*   POPARTNER                    =
      .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    wait          = ' '
* IMPORTING
*   RETURN        =
          .

0 Kudos
303

Hi Dan,

You have to include the position number in the it_pointemx table as well:


it_pointemx -po_item  = '00010'.

Could you try again?

Regards,

John.

0 Kudos
303

not working , why ???

it_pointem-vend_mat = 'EAN1234'.
it_pointem-po_item = '00010'.
APPEND it_pointem.
it_pointemx-vend_mat = 'EAN1234'.
it_pointemx-po_item = '00010'.
it_pointemx-vend_mat = 'X'.
it_pointemx-po_item = 'X'.
APPEND it_pointemx.

0 Kudos
303

it_pointem-vend_mat = 'EAN1234'.

it_pointem-po_item = '00010'.

APPEND it_pointem.

it_pointemx-vend_mat = 'EAN1234'.

it_pointemx-po_item = '00010'.

it_pointemx-vend_mat = 'X'.

it_pointemx-po_item = 'X'. <----- Remove this line

APPEND it_pointemx

John.

0 Kudos
303

it_pointemx-po_item = 'X'. <----- Remove this line

I've removed that line ... because I don't want to modify po_item, my fault ;

Not working... why? i cant' understand ;

john, copy my program into your DEV SAP system and try it ... , please.

0 Kudos
303

Hi Dan,

This is what I have copied:


PARAMETER ebeln TYPE ekpo-ebeln OBLIGATORY.

DATA: BEGIN OF it_pointem OCCURS 0.
        INCLUDE STRUCTURE  bapimepoitem.
DATA: END OF it_pointem.

DATA: BEGIN OF it_pointemx OCCURS 0.
        INCLUDE STRUCTURE bapimepoitemx.
DATA: END OF it_pointemx.

DATA : BEGIN OF it_return OCCURS 0.
        INCLUDE STRUCTURE bapiret2.
DATA : END OF it_return.

DATA: mesg TYPE string.


it_pointem-vend_mat = 'EAN1234'.
it_pointem-po_item = '00010'.
APPEND it_pointem.
it_pointemx-po_item = '00010'.
it_pointemx-vend_mat = 'X'.
APPEND it_pointemx.

CALL FUNCTION 'BAPI_PO_CHANGE'
  EXPORTING
    purchaseorder = ebeln
*   poheader      = it_expheader
*   POHEADERX                    =
*   POADDRVENDOR                 =
*   TESTRUN                      =
*   MEMORY_UNCOMPLETE            =
*   MEMORY_COMPLETE              =
*   POEXPIMPHEADER               =
*   POEXPIMPHEADERX              =
*   VERSIONS                     =
*   NO_MESSAGING                 =
*   NO_MESSAGE_REQ               =
*   NO_AUTHORITY                 =
*   NO_PRICE_FROM_PO             =
* IMPORTING
*   EXPHEADER                    =
*   EXPPOEXPIMPHEADER            =
 TABLES
   return                       = it_return
poitem                       = it_pointem
poitemx                      = it_pointemx
*   POADDRDELIVERY               =
*   POSCHEDULE                   =
*   POSCHEDULEX                  =
*   POACCOUNT                    =
*   POACCOUNTPROFITSEGMENT       =
*   POACCOUNTX                   =
*   POCONDHEADER                 =
*   POCONDHEADERX                =
*   POCOND                       =
*   POCONDX                      =
*   POLIMITS                     =
*   POCONTRACTLIMITS             =
*   POSERVICES                   =
*   POSRVACCESSVALUES            =
*   POSERVICESTEXT               =
*   EXTENSIONIN                  =
*   EXTENSIONOUT                 =
*   POEXPIMPITEM                 =
*   POEXPIMPITEMX                =
*   POTEXTHEADER                 =
*   POTEXTITEM                   =
*   ALLVERSIONS                  =
*   POPARTNER                    =
      .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    wait          = ' '
* IMPORTING
*   RETURN        =
          .

In table IT_RETURN I get 2 messages:

- Standard PO 3126459 changed

- Change Vendor Mat. No. could not be effected

which is correct as we don't use EAN numbers in our system.

Regards,

John.

0 Kudos
303

John, this is the content of it_return:

- I | |000 |Changing of PO using Enjoy BAPI unsuccess<

- E |MEPO |000 |Purchase order still contains faulty item<

- W |06 |698 |Import data incomplete or does not exist <

- E |ME |082 |Material group OP not defined (please che<

it seems that PO contains faulty items ... which field is material group?

0 Kudos
303

Dan,

If you execute this change using the transaction, do you have the same problems?

Regards,

John.

0 Kudos
303

John, it's working...thanks a lot; you deserve those 10 points

it was a problem with that PO, so I try on another PO number

Thank you!

Former Member
0 Kudos
303

Hi,

Give a RETURN parameter table name ans check what messges you get in that .

Former Member
0 Kudos
303

hiii

refer sample code for this FM in given link..it iwll help you to solve..

http://www.sap-img.com/abap/sample-abap-code-on-bapi-po-change.htm

regards

twinkal

former_member194669
Active Contributor
0 Kudos
303

Dan,

Please read the BAPI (function module) documentation. This bapi have some restrictions.