Application Development 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: 

Commit work inside a BADI

Former Member
0 Kudos

Hi

I am writing code in Badi-WORKORDER_UPDATE, implementation name:ZPU_WORKORDER_UPDATE, method:AT_SAVE.

inside this i am calling a function module CLOI_MASTERIDOC_CREATE_LOIPRO.

this FM uses commit work. whenever a production order is released this BADI should be triggered and an idoc should be sent to external system.

all are fine till commit work statement. once commit work is executed, it is going to dump and saying that u cannot use a function which uses Commit work inside a BADI or user exit.

can anybody help me to solve this issue..

thanks

vennila.

7 REPLIES 7

Former Member
0 Kudos

Hi,

You cannot use COMMIT work inside a BADI or enhancements..

Remove that before your boss see's.

Thanks

Dan

Former Member
0 Kudos

You need to find an alternative of CLOI_MASTERIDOC_CREATE_LOIPRO.

Commit work should not be used in any enhancement because SAP transaction is still incomplete at this point.

Commit Work will cause the database commit that will leave the SAP transaction inconsistent.

G@urav.

Former Member
0 Kudos

It's a wild guess. But, try out this : Call the functioon module in BACKGROUND TASK.

CALL FUNCTION CLOI_MASTERIDOC_CREATE_LOIPRO IN BACKGROUND TASK .......

- Sameej

Former Member
0 Kudos

Hi,

Welcome To SDN!!.

commit statement in userexit/BADI:

You should not do that.

After the user exits/BADI code is triggered, the transaction's own commits statements will commit the database anyway

Regards

Kiran Sure

0 Kudos

Hi!

Do you solve this problem?

Former Member
0 Kudos

Hi..!!

1) First go to User exit EXIT_SAPLCOBT_001

2) Inside the above user exit

              SUBMIT rcclord WITH opt_sys  EQ opt_sys

                  WITH mestyp   EQ mestyp

                  WITH s_aufnr  IN aufnr_rg

                  WITH p_autyp  EQ autyp

                  WITH s_matnr  IN matnr_rg

                  AND RETURN.

3) This report rcclord calls CLOI_MASTERIDOC_CREATE_LOIPRO which has user exit EXIT_SAPLLOI1_002.

4) Inside the user exit EXIT_SAPLLOI1_002 you can write logic to append your custom segment.

0 Kudos

This message was moderated.