07-10-2009 7:59 AM
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.
07-10-2009 8:13 AM
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
07-10-2009 8:22 AM
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
07-11-2009 11:33 AM
07-13-2009 2:38 AM
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
07-31-2009 4:53 AM
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
07-13-2009 9:11 AM