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

Commit in Inbound FM

Former Member
0 Likes
2,380

Hi,

Is it allowed to have a commit work or FM call bapi_transaction_commit within an inbound function module? Would we get a negative effect?

Thanks!

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
1,542

Read some documentation like Modification Concepts: IDoc Inbound Processing or Processing BAPIs in ALE Inbound Processing, those documentations prohibit use of COMMIT-WORK.

If you create a function module or use customer exits, note that no COMMIT WORK command is set, as this can lead to errors in IDoc processing and to inconsistencies in error processing. The system returns to the ALE layer following processing, where the system updates any application errors that have occured, sets the IDoc status, and may even execute database rollbacks.

Regards,

Raymond

6 REPLIES 6
Read only

ThomasZloch
Active Contributor
0 Likes
1,542

The reason not to include it is that a COMMIT WORK marks the end of an LUW which might well consist of more than one BAPI call. So always let the outside caller decide whether the transaction can be closed or not, e.g. based on return messages or if there are more steps involved that still need to be started.

Thomas

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,542

Let us know your requirement please.

Read only

0 Likes
1,542

the requirement is that whenever a stock movement  idoc is triggered, I need to do a check and possibly change the PO depending on the condition.

It would seem it is really not allowed, but how do you deal with situation like this? If you need to call a bapi within the inbound function module?

Read only

0 Likes
1,542

Check the documentation of call function in background task/separate unit or a wrapper function with starting new task. It might help.

As suggested do not use a commit during a flow as it executes the previously registered update functions.

You can also go for a custom periodic background job which uses the IDOC data from the respective tables and posts it.

Read only

0 Likes
1,542

Hi,

I have used BAPI_TRANSACTION_COMMIT (after calling BAPI,similar to ur requirement) in inbound function module and acheived desired results..but note that I have called BAPI (and BAPI COMMIT) in an exit that is triggered after standard SAP COMMIT statement is executed.

Please check if it is the case with you.. let the standard inbound FM perform its own action and commit and check for exits after that(ex: check IDOC_INPUT_ORDERS for Inbound Sales Order creation in which exits are available after Commit).

Regards,

SG.

Read only

RaymondGiuseppi
Active Contributor
1,543

Read some documentation like Modification Concepts: IDoc Inbound Processing or Processing BAPIs in ALE Inbound Processing, those documentations prohibit use of COMMIT-WORK.

If you create a function module or use customer exits, note that no COMMIT WORK command is set, as this can lead to errors in IDoc processing and to inconsistencies in error processing. The system returns to the ALE layer following processing, where the system updates any application errors that have occured, sets the IDoc status, and may even execute database rollbacks.

Regards,

Raymond