Skip to Content
0
Former Member
May 13, 2010 at 09:40 AM

Can not add partner to PO using BAPI_po_change

253 Views

Dear all

I want add a partner to PO using BAPI_po_change. But it always "please enter a partner role".

But i can manually add the partner "2201237" to PO "4510039189" using Txn ME22N。

Anyone encounter the same problem ? Please give me your hand. Thanks.

Below is a sample to reproduce the problem.

REPORT ZTESTPO.

DATA: iHEAD LIKE BAPIMEPOHEADER-PO_NUMBER.

DATA: iPARTNER LIKE BAPIEKKOP OCCURS 0 WITH HEADER LINE.

DATA: iRETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.

START-OF-SELECTION.

iHEAD = '4510039189'.

iPARTNER-PARTNERDESC = 'Z3'.

iPARTNER-BUSPARTNO = '0002201237'.

iPARTNER-LANGU = SY-LANGU.

APPEND iPARTNER .

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

PURCHASEORDER = iHEAD

TABLES

RETURN = iRETURN

POPARTNER = iPARTNER .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

COMMIT WORK.