‎2007 Oct 17 12:16 PM
I am trying to create a program in which few database update are mentioned.
after database updates , I am calling a function module using starting new task
in which I want to commit database updates inside in function module.
Problem is I want to commit only database updates if function module , not of main program. For that I tried using COMMIT WORK in function module and rollback statement after calling FM. But it is not working.COMMIT statement in FM also commiting database updates of main program also that is not required.
Can anybody help me in solving this problem.
Thanks
Ruchika
‎2007 Oct 17 9:15 PM
I think this may be caused by an implicit database commit performed by the system at the moment of calling a fm with "starting new task".
Try the following test:
- Put "rollback work" statement inside your fm which you call "starting new task" (instead of "commit") and check if the updates performed by the code executed before the call to this fm are stored in db - inspite of the rollback. If they are (as I suppose) this means that the commit effect you observe is not due to the "commit work" statement executed inside your fm but due to an implicit commit issued automatically at the time of calling the fm. If this is the case the solution could be placing the code which you now execute before "call function...starting new task" into a seperate fm called "in update task" - then the final commit or rollback statement in your main program should have the expected effect.
regards
‎2007 Oct 18 5:41 AM
Thanks for your suggestion....but this will not solve my problem
can u tell me how to commit 2 diffrent LUWs independently.....
They shul not effect each other's commit
‎2007 Oct 18 8:42 AM
Hello Ruchika,
to have 2 LUW´s at same time controlled by one process is not possible by default. One exception might be a secondary connection (see COMMIT CONNECTION) but it is not advisable.
Regards
Klaus
‎2007 Oct 18 10:30 AM
I'm not sure if I understand your goal, I guess what you want to achieve is to be able to decide about commit/rollback separately. In this case try a program structured like this:
perform F1 on commit.
call function FM destination 'NONE' ...
perform F2 on commit.
commit work (or rollback work).
FORM F1 ...
" some db updates here
ENDFORM.
FORM F2 ...
" another db updates here if you need
ENDFORM.
Function module FM should be RFC enabled (set in fm attributes).
regards
‎2007 Oct 19 5:41 AM
Thanks...This I had already done....but I also one more isuue..because i will not work in case there is dump.
In case of runtime error. or .dump.. ..I want to save few database changes that were written in sub routine,how to achieve this..so that If dump occurs , I am able to save updates into database.
Is there any badI IN crm THAT can help in such cases..
‎2007 Oct 17 9:44 PM
Hello Ruchika,
an alternative approach is not to do the db updates in the main program but keep a kind of description what to do. For example store records in internal tables. Then you can call the FuBa safely.
Regards
Klaus
‎2007 Oct 18 5:24 AM
Can you explain what is FuBa and how to use..actually I want to create two LUWs and commit them separately in a same program.Both of them shud not effect each other.
If You or anybody can tell me how to do this....please let me know