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: 

Starting new SAP LUW inside ABAP method

anand_ajitsaria
Explorer
0 Kudos

I am calling a ABAP method and in that I want to start a new SAP LUW and do commit when leaving the method.

The requirement is that all update function modules called inside the method should only be committed and no other prior update FMu2019s(before calling the method) should not be committed.

Any idea if itu2019s possible to do that in ABAP OO and how do we do it.

Thanks & Regards,

Anand.

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Anand,

The requirement is that all update function modules called inside the method should only be committed and no other prior update FMu2019s(before calling the method) should not be committed.

Try using the SET UPDATE TASK LOCAL. This will ensure that the Update FM calls are registered in ABAP memory & not in VBLOG table. These calls will be executed in the local work process & not in a separate update work process when COMMIT WORK statement is encountered.

You can also try to create RFMs & use it in conjunction with IN BACKGROUND TASK ... AS SEPARATE UNIT. Wherein the registered FM will be called in a separate context of it's own.

As of release 7.0, you can group multiple RFMs using IN BACKGROUND UNIT addition. Read the F1 documentation for further details.

BR,

Suhas

6 REPLIES 6

Former Member
0 Kudos

Depending on what you need to do, it might be enough to open a secondary connection to the SAP database using the ADBC, like:

lo_con = cl_sql_connection=>get_connection( 'R/3*' ).

You would at least be able to update some tables using native SQL, without doing a commit in the calling LUW. For details about ADBC see sap help: http://help.sap.com/abapdocu_702/en/abenadbc.htm

Ramneek
Advisor
Advisor
0 Kudos

Hello,

I suppose you could also use the ABAP Object - [Transaction Services|http://help.sap.com/saphelp_nw70/helpdata/en/ab/9d0a3ad259cd58e10000000a11402f/frameset.htm] for this. It is very simillar to the classical transactions. Check out the report DEMO_TRANSACTION_SERVICE for a working example.

Thank you,

Ramneek

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Anand,

The requirement is that all update function modules called inside the method should only be committed and no other prior update FMu2019s(before calling the method) should not be committed.

Try using the SET UPDATE TASK LOCAL. This will ensure that the Update FM calls are registered in ABAP memory & not in VBLOG table. These calls will be executed in the local work process & not in a separate update work process when COMMIT WORK statement is encountered.

You can also try to create RFMs & use it in conjunction with IN BACKGROUND TASK ... AS SEPARATE UNIT. Wherein the registered FM will be called in a separate context of it's own.

As of release 7.0, you can group multiple RFMs using IN BACKGROUND UNIT addition. Read the F1 documentation for further details.

BR,

Suhas

0 Kudos

HI ,

Thanks for the quick replies. I tried using SET UPDATE TASK LOCAL but it was also committing all the prior update FM's before calling this method.

I also tried using the RFM - CALL FUNCTION 'ABC' IN BACKGROUND TASK DESTINATION 'NONE' . and then

COMMIT WORK AND WAIT.

Now when i do commit work it commits all the previous update tasks also.

And if i do not call COMMIT WORK right after the call to RFM, then the object that i am trying to create inside the RFM will not be committed.And then if i proceede some validations will fail as the objects were not created.

Is there a way to commit immediately when the RFM is called without commiting the calling transaction from where this RFM is called.

Any examples would be highly appreciated ..

Regards,

Anand.

Edited by: Anand Ajitsaria on Feb 4, 2011 9:54 AM

0 Kudos

Hello Anand,

When you do a COMMIT WORK all the previously registered update FMs(in the same LUW of course) would be executed.

Food for thought Try to register the current update module in a separate LUW by calling a wrapper RFM with STARTING NEW TASK addition.

BR,

Suhas

PS: Did you try the bgRFC option? (IN BACKGROUND UNIT)

anand_ajitsaria
Explorer
0 Kudos

Thanks Suhas..

I was able to do it by using RFM and STARTING NEW TASK..

REgards,

Anand.