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 Commit Work Database Update

Former Member
0 Likes
477

We have Project Structre that looks like this:

Proj1

bwbs1 prctr1

wbs1 prctr1

bwbs2 prctr2

wbs2 prctr2...

( Tcode: CJ02 or CJ20 )

I try to use PS substitution to accomplish the above. When SAP loops to the line

bwbs1, I use 'BAPI_PROFITCENTER_CREATE' to create the profit center( prctr1 ) and

substituted into prps-prctr for bwbs1.

When it looped to the next line( wbs1 ), since it is a wbs, i find its parent( bwbs1 ) and

copy the profit center( prctr1 ) into the profit center field( prps-prctr ) of wbs1.

Repeat the same for bwbs2.

Problem: If i do not use 'BAPI_TRANSACTION_COMMIT' at the end of each 'BAPI_PROFITCENTER_CREATE', in the end, SAP will return a message saying

profit center does not exist. Therefore, it cannot be substituted. If I do use

'BAPI_TRANSACTION_COMMIT', it will create prctr1 in CEPC when it is looping to the line for bwbs1. However, it will also immediately create all the bwbs1, wbs1, bwbs2, wbs2 all into prps. This means that

none of the profit center can further be substituted by the custom profit center. Is there any way we can commit to database only the profit center created but not the list of BWBS/WBS that need further substitution?

2 REPLIES 2
Read only

Former Member
0 Likes
393

Any idea?

Read only

0 Likes
393

I can not see your program design entirely but check this:

Why dont you create all Profit centers first then COMMIT and then create related Projects/WBSs.