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

Separate LUW

Former Member
0 Likes
4,757

Hi,

Can any one tell me weather it is possible to create a separate LUW inside another LUW, wherein if i write commit statement, only the nested LUW should be commited. Please find below explanation of problem:

I have to use a code which updates a 'Z' table inside a user exit. After updation i have to utilise this 'Z' table entries in my code. But if i write commit in the updation code then the whole transaction will be commited, and if i don't write commit, records will not be updated in the table for furthur utilisation. So i thought of writing this updation code in a seperate LUW, where in if i write commit statement only the 'Z' table updation will be commited, rather than the hole transaction. Although i have written to save the updated records in a internal table, and utilise this table for furthur use, but i wan't to know weather it is possible to write a set of code as a seperate LUW inside another LUW.

Thanks in advance.

Zafar Ali

E-mail: zali@essar.com

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,460

Hi Zafar,

One approach is (can be) to create a new LUW by using two approaches:

1. SUBMIT PROGRAM AND RETURN and within the program you code and use COMMIT and then RETURN

2. CALL FUNCTION <function> DESTINATION 'NONE' -this simulates the same function as SUBMIT, but here the module needs to be RFC enabled.

However, having said this, I think your current approach of using a internal table is the best way to go.

Regards,

Aditya

7 REPLIES 7
Read only

Former Member
0 Likes
2,461

Hi Zafar,

One approach is (can be) to create a new LUW by using two approaches:

1. SUBMIT PROGRAM AND RETURN and within the program you code and use COMMIT and then RETURN

2. CALL FUNCTION <function> DESTINATION 'NONE' -this simulates the same function as SUBMIT, but here the module needs to be RFC enabled.

However, having said this, I think your current approach of using a internal table is the best way to go.

Regards,

Aditya

Read only

0 Likes
2,460

Hi Aditya,

Thanku for the kind response. I have test tried RFC Function Module and also SUBMIT a program, by writing an update statement for updating a 'z' table, and then calling an RFC/SUBMIT in which another Update statement is written with commit. when the update of first program is executed( in Debug mode), the changes are not reflected at DDIC, but when statement commit is executed (in Debug mode) in another program/RFC FM, both the changes (In 1st and 2nd updations) reflected in DDIC (Not as expected that only 2nd updation will be reflected) even before exiting from the second program in debug mode.

With Regards,

Zafar Ali

Read only

0 Likes
2,460

Hi zafar,

1. Nested Luw

2. I tried the same thing now, but could not succeed.

3. Whether we use submit, rfc with NONE, or

anything else,

it creates another internal session.

(inside this session, if we use commit,

it will commit the main session also).

4. I was just wondering why u need to commit

the nested luw.

5. As u said, this Z table u are updating,

inside the user exit.

Main Program--


>UserExit--


>backto main program.

6. So, if u update the Z table inside the userexit,

its records will still be available in the code of main program, after the user exit is completed, even without commit work.

(bcos the session is same for main program and the user exit)

(even though they may not be physically updated,

if we seen in another window/session)

regards,

amit m.

Read only

0 Likes
2,460

Hi Amit,

As you have said, i had already solved it by storing the updating records in a table and ulitised it later, but i thought that there should be some way to commit a set of code, in some rare situations.

Thankyou for the response,

Zafar Ali

Read only

Former Member
0 Likes
2,460

Solved...

Read only

0 Likes
2,460

Zafar,

Did you find a solution using separate LUW's?

If yes, it would be nice to share it with us.

Thanks,

Philippe

Read only

0 Likes
2,460

Hi Philippe,

I have solved the issue by storing the records (to be updated in 'Z' table) in an internal table and utilised the same for furthur processing. I have written code to first search the internal table, and if not found then only i have written select statement.

Also, i have found a way to start a new LUW by calling a RFC FM with addition 'STARTING NEW TASK '<TASK_NAME>'. Here with in Function Module, even if we write commit work statement, only the new LUW (FM Code) will be commited.

Regards,

Zafar Ali