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: 

Can 'BAPI_PO_CHANGE' be used to change GL account ?

Former Member
0 Kudos

Hi see below code. I get a success message that PO has been changed and the cost centre is updated however the GL account remain unchanged. Return table also has information message ME 664 Change G/L Account could not be effected.

Has anyone successfully change a GL if so how?

-Dana

  • update item

ls_poitem-item = '00010'.

ls_poitem-acc = 'K'.

append ls_poitem to lt_poitem.

ls_poitem-item = '00010'.

ls_poitem-acc = 'X'.

append ls_poitemx to lt_poitemx.

  • update account assignment

ls_poaccount-PO_ITEM = '00010'.

ls_poaccount-SERIAL_NO = '01'.

ls_poaccount-GL_ACCOUNT = '999999'.

ls_poaccount-COSTCENTER = 'AU9999999'.

append ls_poaccount ot lt_poaccount.

ls_poaccountx-PO_ITEM = '00010'.

ls_poaccountx-SERIAL_NO = '01'.

ls_poaccountx-PO_ITEMX = X

ls_poaccountx-SERIAL_NOX = 'X'

ls_poaccountx-GL_ACCOUNT = 'X'.

ls_poaccountx-COSTCENTER = 'X'.

append ls_poaccountx ot lt_poaccountx.

call function 'BAPI_PO_CHANGE'

exporting

purchaseorder = p_ebeln

tables

return = lt_return

poitem = lt_poitem

poitemx = lt_poitemx

poaccount = lt_poaccount

poaccountx = lt_poaccountx.

read table lt_return transporting no fields with key type = 'S' .

if sy-subrc = 0.

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = 'X'.

else.

  • put errors in a table.

endif.

6 REPLIES 6

Former Member
0 Kudos

Hi,

I think u missed 1 indicator....

  • update item

ls_poitem-item = '00010'.

ls_poitem-acc = 'K'.

append ls_poitem to lt_poitem.

ls_poitem-item = '00010'.

LS_POITEM-PO_ITEMX= 'X'. (This is field needs to be added to ur structure & then passed to BAPI)

ls_poitem-acc = 'X'.

append ls_poitemx to lt_poitemx.

  • update account assignment

ls_poaccount-PO_ITEM = '00010'.

ls_poaccount-SERIAL_NO = '01'.

ls_poaccount-GL_ACCOUNT = '999999'.

ls_poaccount-COSTCENTER = 'AU9999999'.

append ls_poaccount ot lt_poaccount.

.

.

.

.

.

.

.

.

Regards,

Bhargava

Former Member
0 Kudos

THanks for the reply but that didn't solve the problem.

The same issue. Cost Centre gets updated but GL Account doesn't. Same information message, ME 664 Change G/L Account could not be effected.

regards Dana

Edited by: Dana Hutchens on Jul 10, 2009 9:23 AM

Former Member

0 Kudos

Thanks for the code, but its not relevant to my questions. I am interested in know if GL Account can be change using this bapi. I have used BAPI_PO_CHANGE to already to change other fields before.

The problem I have is that I can udpate some account assignment fields like cost centre but not GL account. I wanted to know if anyone has successfully udpated GL account using this BAPI.

cheers, Dana

0 Kudos

Gl account can be update via the bapi as per the input I entered above.

In our situation the GL was in display mode for oline so it could not be updated. Once config was change this could be updated.

However as Ha had said in the link on sap fan we wanted to update the bapi without allowing GL to be editted oline.

SAP has confirm that this cannot be done.

regard. Dana

Former Member