Skip to Content
0
Former Member
Jul 10, 2009 at 06:59 AM

Can 'BAPI_PO_CHANGE' be used to change GL account ?

687 Views

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.