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 work when calling FUNC via RFC using .NET Connector?

Former Member
0 Likes
983

Dear all!

I am using a .NET program to call a RFC-enabled function module within my SAP CRM (4.0SP10). I use MS .NET Connector for SAP, version 2.x

The whole thing is about loading/updating customer master data from an external data source (MS SQL Server) into mySAP CRM, using a .NET program and the .NET connector. The program is scheduled to run once a week (the SQL database is updated weekly - these updates should be reflected in SAP as well)

I am able to call the function module successfully and the data is passed along correctly. If I am testing the whole synchronisation with only limited amount of data (a couple of hundred records), everything is fine -> the data is inserted / updated in SAP as expected.

When i mass-tested the program though (10.000 records), I am having trouble with the lock table (entries in SM12). Though the .NET program calls the RFC-function module only with 100 records at a time, those records are staying in SM12, even after execution of function module is finished.

I tried calling "commit work" from within the function module (before ENDFUNCTION), and also tried to call BAPI_TRANSACTION_COMMIT via RFC from within my .NET program.

Anyway I try, the lock table entries are not released, and after approx. 5.000 records, I get a short dump with type "Lock table overflow".

Any ideas / inputs from all the experts out there?

Thank you & Kind regards

Christoph

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
642

Hi christoph,

1. make sure u are calling BAPI_TRANSACTION_COMMIT

from ur .NET program,

AFTER every 100 calls.

(and not at the end of the loop of 10000 records)

regards,

amit m.

3 REPLIES 3
Read only

Former Member
0 Likes
643

Hi christoph,

1. make sure u are calling BAPI_TRANSACTION_COMMIT

from ur .NET program,

AFTER every 100 calls.

(and not at the end of the loop of 10000 records)

regards,

amit m.

Read only

0 Likes
642

Hi Amit!

Thank you for your suggestion! I am calling BAPI_TRANSACTION_COMMIT after each and every call (each of which consits of a 100 records). So, from a control flow viewpoint from the .NET program, it looks like:

-> RFC call <<UpdateFunctionModule>> (first 100 records)

-> RFC call BAPI_TRANSACTION_COMMIT

-> RFC call <<UpdateFunctionModule>> (next 100 records)

-> RFC call BAPI_TRANSACTION_COMMIT

... and so on

Regards

Christoph

Read only

Former Member
0 Likes
642

Hi Guys!

Thank you for your suggestions. I was in the meantime able to figure it out myself.

If someone ever faces a similar problem, be sure to close the connection to the SAP system from within your .NET program after every call to the function module. SAP commits data to the DB only after a logical unit of work (LUW) is finished.

As long as the connection between the .NET program and the SAP is up, everything that happens during the lifetime of this connection is treated as content of one LUW!!

So, for our problem here, we simply closed the connection to SAP in our .NET program after every call of the function module. Now it works...

Regards

Christoph