‎2005 Jul 11 7:41 AM
Hello All,
In my Zobject i am using an
delete dtab from table itab. (Mass deletion) to remove all the orphan entries in a Ztable ZOMLT.
Code :
LOOP AT I_ZOMLT. (Already selected the data from ZOMLT)
READ TABLE I_ZOMLG WITH KEY
SNDR_CLIEN = I_ZOMLT-SNDR_CLIEN
MSG_ID = I_ZOMLT-MSG_ID
RCVR_ID = I_ZOMLT-RCVR_ID
RCVR_CLIEN = I_ZOMLT-RCVR_CLIEN
SNDR_ID = I_ZOMLT-SNDR_ID.
IF SY-SUBRC NE 0.
MOVE: I_ZOMLT-SNDR_CLIEN TO ORPHAN_TAB-SNDR_CLIEN,
I_ZOMLT-MSG_ID TO ORPHAN_TAB-MSG_ID,
I_ZOMLT-RCVR_ID TO ORPHAN_TAB-RCVR_ID,
I_ZOMLT-RCVR_CLIEN TO ORPHAN_TAB-RCVR_CLIEN,
I_ZOMLT-SNDR_ID TO ORPHAN_TAB-SNDR_ID,
I_ZOMLT-LANGU TO ORPHAN_TAB-LANGU,
I_ZOMLT-TXT_CNTR TO ORPHAN_TAB-TXT_CNTR.
APPEND ORPHAN_TAB.
ENDIF.
ENDLOOP.
Built the ORPHAN_TAB internal table with all the orphan * entries
sort orphan_tab by msg_id.
delete zomlt from table orphan_tab.
When this object is executed, i can see that the table entries of ZOMLT are reduced (from SE11), but later say 10 min it starts roll back (all the records are loaded back).
Please provide your views as to why the records are rolled back, as i know that DELETE/UPDATE does not require a COMMIT.
Regards,
- PSK
‎2005 Jul 11 7:55 AM
Hi,
Is this ur test program or some one might access the same dbtable and perform some different operation.
As u said no need for COMMIT.
DELETE dbtab FROM TABLE itab.
DELETE (dbtabname) FROM TABLE itab.
Addition:
... CLIENT SPECIFIED
Effect
Mass deletion: Deletes all database table lines for which the internal table itab contains values for the primary key fields. The lines of the internal table itab must satisfy the same condition as the work area wa in addition 1 to variant 2.
The system field SY-DBCNT contains the number of deleted lines, i.e. the number of lines of the internal table itab for whose key values there were lines in the database table dbtab.
The return code is set as follows:
SY-SUBRC = 0:
All lines from itab could be used to delete lines from dbtab.
SY-SUBRC = 4:
For at least one line of the internal table in the database table, there was no line with the same primary key. All found lines are deleted.
‎2005 Jul 11 8:04 AM
Hi,
there may be two cases for your problem.
1. check if someother background is being trigerred or run after your program gets executed which might modify the table.
2. in the above code for sy-subrc ne 0 you populate the entries and it deletes the entries, but for sy-subrc eq 0 the table will empty so no action will be performed. so put a check on table entries like if not orphan_tab[] is initial.
Regards,
Jagath