SAP Database

COMMIT: ABAP Keyword a day

Print This Post Email This Post Written by admin on Nov 14th, 2007 | Filed under: ABAP Keywords

COMMIT
Basic form
COMMIT WORK.
Addition
… AND WAIT

Effect
Executes a database commit and thus closes a logical processing unit or Logical Unit of Work ( LUW ) (see also Transaction processing ). This means that

* all database changes 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 ,

* cancels all existing locks (see SAP locking concept ) if no update requests exist,

* closes all open database cursors (see OPEN CURSOR ) and

* resets the time slice counter to 0.

COMMIT WORK belongs to the Open SQL command set.
Return code value
The SY-SUBRC is set to 0.
Notes
All subroutines called with PERFORM … ON COMMIT are processed in the LUW concluded by the COMMIT WORK command. All V1 update requests specified in CALL FUNCTION … IN UPDATE TASK are also executed in one LUW . When all V1 update requests have been successfully concluded, the V2 update requests (”update with start delayed”) are processed, each in one LUW . Parallel to this, the function modules specified in CALL FUNCTION … IN BACKGROUND TASK are each executed in one LUW per destination.
COMMIT WORK commands processed within CALL DIALOG processing

- execute a database commit (see above),
- close all open database cursors,
- reset the time slice counter and
- call the function modules specified by CALL FUNCTION IN
BACKGROUND TASK in the CALL DIALOG processing.

However, subroutines and function modules called with PERFORM … ON COMMIT or CALL FUNCTION … IN UPDATE TASK in the CALL DIALOG processing are not executed in the calling transaction until a COMMIT WORK occurs.
Since COMMIT WORK closes all open database cursors, any attempt to continue a SELECT loop after a COMMIT WORK results in a runtime error. For the same reason, a FETCH after a COMMIT WORK on the now closed cursors also produces a runtime error. You must therefore ensure that any open cursors are no longer used after the COMMIT WORK .
With batch input and CALL TRANSACTION … USING , COMMIT WORK successfully concludes the processing.
Addition
… AND WAIT
Effect
The addition … AND WAIT makes the program wait until the type V1 updates have been completed.

The return code value is set as follows:

SY-SUBRC = 0 The update was successfully performed.
SY-SUBRC <> 0 The update could not be successfully performed.
Note
Runtime errors

* COMMIT_IN_PERFORM_ON_COMMIT : COMMIT WORK is not allowed in a FORM callled with PERFORM … ON COMMIT .

* COMMIT_IN_POSTING : COMMIT WORK is not allowed in the update task.

———————
ABAPer, mail: abap.community@gmail.com http://abaplearner.blogspot.com

If you like this post, you may as well like these too:

  1. Use of Commit and Rollback REPORT Z_IMPORT_EXPORT_to_cluster NO STANDARD PAGE HEADING.TABLES : ZGLGRP , SKB1.PARAMETERS : IFILE(30) DEFAULT ‘/tmp/cdslink.dat’ LOWER CASE, PBUKRS LIKE BKPF-BUKRS , PKTOPL LIKE ZGLGRP-KTOPL.DATA : BEGIN OF TAB1 OCCURS 100...
  2. EXEC : ABAP Keyword a day EXEC Basic form EXEC SQL. Addition … PERFORMING form Effect In contrast to Open SQL , addressed database tables do not have to be known to the ABAP/4 Dictionary...
  3. BREAK-POINT : ABAP Keyword a day BREAK-POINTVariants: 1. BREAK-POINT.2. BREAK-POINT f. Variant 1BREAK-POINT.EffectThe BREAK-POINT statement interrupts the processing and diverts the system to debugging mode. You can then display the contents of all the fields...
  4. CREATE : ABAP Keyword a day CREATEBasic formCREATE OBJECT obj class.Addition… LANGUAGE languEffectGenerates an object of the class class . To address an OLE automation server (e.g. EXCEL) from ABAP/4 , the server must be...
  5. EXPORT : ABAP Keyword a day EXPORT *Export data - EXPORT obj1 ... objn TO MEMORY. - EXPORT obj1 ... objn TO DATABASE dbtab(ar) ID key. - EXPORT obj1 ... objn TO DATASET dsn(ar) ID...



Leave a Reply

  • Help Support CRY