‎2007 Jan 22 3:47 AM
I want to use COMMIT & ROLL BACK STATEMENT IN BDC program.......plz expalin with example..
‎2007 Jan 22 4:29 AM
Doesn't make sense to use COMMIT / ROLLBACK in a BDC as these will call the transactions which will commit / rollback the data. This will be handled by the system.
You don't have to do it.
Regards,
Ravi
Note - Please mark all the helpful answers
‎2007 Jan 22 7:28 AM
Hi,
The statement COMMIT WORK completes the current SAP LUW and opens a new one, storing all change requests for the current SAP LUW in the process. In this case, COMMIT WORK performs the following actions:
It executes all subroutines registered using PERFORM ON COMMIT.
The sequence is based on the order of registration or according to the priority specified using the LEVEL addition. Execution of the following statements is not permitted in a subroutine of this type:
PERFORM ... ON COMMIT|ROLLBACK
COMMIT WORK
ROLLBACK WORK
The statement CALL FUNCTION ... IN UPDATE TASK can be executed.
<b>ROLL BACK:</b>
The statement ROLLBACK WORK closes the current SAP-LUW and opens a new one. In doing so, all change requests of the current SAP-LUW are canceled. To do this, ROLLBACK WORK carries out the following actions:
1) Executes all subprograms registered with PERFORM ON ROLLBACK.
2) Deletes all subprograms registered with PERFORM ON COMMIT.
3) Raises an internal exception in the Object Services that makes sure that the attributes of persistent objects are initialised.
4) Deletes all update function modules registered with CALL FUNCTION ...IN UPDATE TASK from the VBLOG database table and deletes all transactional remote Function Calls registered with CALL FUNCTION ... IN BACKGROUND TASK from database tables ARFCSSTATE and ARFCSDATA.
5) Removal of all SAP locks set in the current program in which the formal parameter _SCOPE of the lock function module was set to the value 2.
6) Triggers a database rollback, which also ends the current database-LUW.
Regards,
Gunasree.
‎2007 Jan 22 8:25 AM
First check SAP Help
http://help.sap.com/saphelp_470/helpdata/en/fc/eb3b64358411d1829f0000e829fbfe/frameset.htm
Also
Commit Work
Executes a database commit and thus closes a Logical Unit of Work ( LUW) (see also Transaction Processing). This means that
all database updates are made irrevocable and cannot be reversed with ROLLBACK WORK and
all database locks are released.
COMMIT WORK also
calls the subroutines specified by PERFORM ... ON COMMIT,
executes asynchronously any update requests (see CALL FUNCTION ... IN UPDATE TASK) specified in these subroutines or started just before,
processes the function modules specified in CALL FUNCTION ... IN BACKGROUND TASK,
closes all open database cursors (see OPEN CURSOR) and
resets the time slice counter to 0.
Never Use Commit work in a select... endselect .. program dumps..
‎2007 Jan 22 1:04 PM
there is no need to use explicitly the COMMIT and ROLL BACK statements.
if u need explanation please go through the answers given by some of our friends