Thursday 16 July 2015

WAIT UP TO ... Secs Command Vs FM : ENQUE_SLEEP


-------------------------------------------------------------------------------------------------------------------------------

Post Summary:
ABAP Command - WAIT UP TO ... Secs  holds the program processing for that seconds but it internally triggers a data babe commit which especially can't be used when we have already opened some DB cursor. In such a situation ABAP provides some SLEEP function like JAVA by the Function Module  : ENQUE_SLEEP which holds the program processing for some moment without any DB commit.






 Step1.  Here is a program which inserts a record in the table and waits for 5 seconds and then tries to do a roll back. But as the wait statement itself performs the commit work before the roll back the record can't be taken our with the roll back statement.


 Press F5 in debugger and check one entry inserted in DB.

 One DB record created. Press F5

 Now program wait for 5 second which performs DB commit. Press F8.
After rollback no effect.


 Instead of WAIT command use ENQUE_SLEEP function module which only breaks the program processing for that second but no commit work.


 One record is created.

 Now with rollback work the created entry will be removed form the table.

 Refresh the table.


--------------------------------------------------------------------------------------------------------------------------------

No comments:

Comments system

Disqus Shortname