cancel
Showing results for 
Search instead for 
Did you mean: 

commit work for last work - bapi_transaction_commit

Former Member
0 Kudos

Hi Experts

I have a specfic program to create a lot of shoping cars in excel files.

I use "BAPI_TRANSACTION_COMMIT" after calling BAPI_SCEC_CREATE.

Here the code:

loop at ...

CALL FUNCTION 'BAPI_SCEC_CREATE'

...

if ...

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

else.

rollback work

endif.

endloop.

My problem is when i user "rollbakc work",n the data is inconsistents, and when i delete "rollback work" the code "BAPi_TRANSACTION_COMMIT is executes for all cases.. So i have too many shopping card created.

I can I do a 'BAPI_TRANSACTION_COMMIT" only for my last workf and not for all ?

Thank you very muche for your help.

Regards,

Peggy.

Edited by: peggy delvincourt on Jan 4, 2010 9:25 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I can I do a 'BAPI_TRANSACTION_COMMIT" only for my last workf and not for all ?

Yes, you could, if you are satisfied with "all or nothing" result, meaning either you get to have all the SC successfully created or none at all.

If you are running the report in the same system as your SCs, I'd suggest that in the loop, you use FM BBP_PD_SC_CREATE, and only if successful, call FM BBP_PD_SC_SAVE. Then after the loop, commit work and wait or roll back. Give it a try.

Former Member
0 Kudos

Thank you for your response..

So no way to do a "Commit wok" only for ma last work : it is for nothing or for all...

So shame..

I wanted to avoid to do again the entire program by using others MF so others structures..

Former Member
0 Kudos

BAPI_SCEC_CREATE is essentially a wrapper function module for BBP_PD_SC_CREATE. The structures involved should be rather similar between the two.

Former Member
0 Kudos

Thank you.

it works while using BBP_PD_SC_CREATE and BBP_PD_SAVE.

It is needed to user COMMTI WORK after BBP_PD_SAVE but after the COMMIT work is OK and COMMIT only for last work!

Great!

Answers (0)