2013 Nov 02 5:03 PM
Hello Gurus,
I am trying to use BAPI_ACC_GL_POSTING_POST to post using an internal order .
The profit center on the order is changed and BAPI_ACC_GL_POSTING_POST is used again to post to the same order.
The second time , instead of picking the new profit center , the BAPI_ACC_GL_POSTING_POST is defaulting the old profit center only.
I tried using all the below techniques to clear buffer , but none worked. How to avoid the BAPI from picking the old profit center on the order.
PLease advise.
CALL FUNCTION 'OIUP_REFRESH_TABLE_BUFFER'
EXPORTING
tabname = 'COAS'
* EXCEPTIONS
* REFRESH_ERROR = 1
* OTHERS = 2
CALL FUNCTION 'AIA_BAPI_APPREQ_CLEAR_BUFFER'.
CALL FUNCTION 'BUS_BAPI_CLEARBUFFER'. .
CALL FUNCTION 'K_COSTELEMENT_REFRESH_BUFFERS'.
CALL FUNCTION 'K_COSTCENTER_REFRESH_BUFFERS'.
SUBMIT ESH_REFRESH_RUNTIME_BUFFER AND RETURN.
CALL FUNCTION 'K_ORDER_BUFFER_REFRESH'
CALL FUNCTION 'BUFFER_REFRESH_ALL'.
Regards,
Archana
Hello Gurus,
I am trying to use BAPI_ACC_GL_POSTING_POST to post using an internal order .
The profit center on the order is changed and BAPI_ACC_GL_POSTING_POST is used again to post to the same order.
The second time , instead of picking the new profit center , the BAPI_ACC_GL_POSTING_POST is defaulting the old profit center only.
I tried using all the below techniques to clear buffer , but none worked. How to avoid the BAPI from picking the old profit center on the order.
PLease advise.
CALL FUNCTION 'OIUP_REFRESH_TABLE_BUFFER'
EXPORTING
tabname = 'COAS'
* EXCEPTIONS
* REFRESH_ERROR = 1
* OTHERS = 2
CALL FUNCTION 'AIA_BAPI_APPREQ_CLEAR_BUFFER'.
CALL FUNCTION 'BUS_BAPI_CLEARBUFFER'. .
CALL FUNCTION 'K_COSTELEMENT_REFRESH_BUFFERS'.
CALL FUNCTION 'K_COSTCENTER_REFRESH_BUFFERS'.
SUBMIT ESH_REFRESH_RUNTIME_BUFFER AND RETURN.
CALL FUNCTION 'K_ORDER_BUFFER_REFRESH'
CALL FUNCTION 'BUFFER_REFRESH_ALL'.
Regards,
Archana
2013 Nov 02 6:24 PM
Hi Archana
There are two fields for profit center in the parameter BAPIACGL08.
Can you show me your code, where you are passing the value for profit center.
PROCT_CTR, PART_PRCTR.
Regards,
Venkat
2013 Nov 03 2:16 PM
Hi Venkat ,
Am not passing profit center; it must pick it from the order master , The order master correctly reflects the new profit center ; but in BAPI the defaulting is happening as old.
The Profit center passed in PROFIT_CTR is not considered , I tried it.
Hence got a doubt that this must be picked from some buffers; so trying to clear the buffers.
Please let me know if there is a way to force the profit center when order is passed .
Regards,
Archana
2013 Nov 02 6:30 PM
Hi Archana,
Are you calling 'BAPI_TRANSACTION_COMMIT' after your first BAPI call? If not please try this... If this doesn't work please try like COMMIT WORK AND WAIT.
-Venkat
2013 Nov 03 2:18 PM
Hi Venkat,
I am using this commit . The Order master also reflects new profit center, but problem is inside BAPI the profit center on order is being defaulted to old one.
-Archana
2013 Nov 03 2:34 PM
Hello Archana,
Could you paste your related code?
Kindly check below link:
https://scn.sap.com/message/8183354
Could you pass New Profit center manually in BAPI call rather than defaulting from Internal Order? Just give a trial and let us know your test results.
-Venkat
2013 Nov 03 2:54 PM
Hi Archana,
Can you debug your code and delete the first row in internal table and then pass the value to BAPI.
Then you can able to find the prob, whether the code or BAPI.
Arivazhagan S
2013 Nov 03 3:56 PM
Hi Venkat,
I tried passing this in BAPI manually, Still doesnt work, picks up the old profit center only.
Archana
2013 Nov 03 4:27 PM
OK, Could you please explain your exact requirement in short, also can you paste your code?
-Venkat
2013 Nov 04 12:08 PM
Hi,
Am changing the profit center on the order O from lets say P1 to P2.
After this step , am trying to do the postings passing this order O using passing BAPI_ACC_GL_POSTING_POST. Am also passing the profit center as P2.
But when the posting is complete I see that the posting has happened to order O and profit center P1 which is the old profit center.
In Order Master ( KO03 ) the Profit center set for order O is P2 but inside the BAPI its getting defaulted to old Profit center P1 which is wrong.
I assume that this is being picked from some buffer which is not cleared , so am trying to clear the buffers before using the BAPI.
This is strange as all master data correctly reflects the new profit center P2.
I hope this has given you idea of the issue am trying to resolve. Please let me know if you know of any alternate way of forcing the profit center .
-Archana
2013 Nov 04 5:07 PM
Hello Archana,
Thanks for your explanation.
How are you changing your Profit Center say from P1 to P2? Are you using any BAPI/FM to meet this purpose? If so kindly share your BAPI/FM name. Paste your code...
-Venkat
2013 Nov 06 10:15 AM
Hi,
Am using KAUF_ORDER_CHANGE_BAPIFIELDS to changethe prfit center on order and after the commit I see that the new profit center is updated in order.
-Archana
2013 Nov 06 12:42 PM
2013 Nov 06 3:18 PM
Hi-
Try below approach.
KAUF_ORDER_CHANGE_BAPIFIELDS
COMMIT WORK AND WAIT.
BAPI_ACC_GL_POSTING_POST
COMMIT WORK AND WAIT.
-Venkat
2013 Nov 06 3:28 PM
Hi Archana
In your System, Is the Profit Center assigned to a Cost Center ? IF SO, Try passing the Cost center of the the Profit center you want to update in the BAPI,the respective Profit center will be taken automatically.
For e.g If the Profit Center you pass in BAPI is PC1, fetch the Cost Center (C1) of the Profit Center from Table "CSKS" and pass that in the BAPI
Selection conditions would be Controlling Area,COmpany COde and the Profit Center that you want to update ,fetch the Cost Center with the above conditions and update this COst Center.(as a Practice they usually assign one cost center to one Profit center)