Application Development and Automation 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: 
Read only

BAPI_ACC_GL_POSTING_POST defaulting profit center , from buffer ?

Former Member
0 Likes
2,548

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


14 REPLIES 14
Read only

venkateswaran_k
Active Contributor
0 Likes
2,155

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

Read only

0 Likes
2,155

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

Read only

venkat_aileni
Contributor
0 Likes
2,155

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

Read only

0 Likes
2,155

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

Read only

0 Likes
2,155

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

Read only

0 Likes
2,155

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

Read only

0 Likes
2,155

Hi Venkat,

I tried passing this in BAPI manually, Still doesnt work, picks up the old profit center only.

Archana

Read only

0 Likes
2,155

OK, Could you please explain your exact requirement in short, also can you paste your code?

-Venkat

Read only

0 Likes
2,155

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

Read only

0 Likes
2,155

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

Read only

0 Likes
2,155

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

Read only

0 Likes
2,155

After the commit, and wait ?

Regards,

Raymond

Read only

0 Likes
2,155

Hi-

Try below approach.

KAUF_ORDER_CHANGE_BAPIFIELDS

COMMIT WORK AND WAIT.

BAPI_ACC_GL_POSTING_POST

COMMIT WORK AND WAIT.

-Venkat

Read only

0 Likes
2,155

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)