2007 Jan 04 9:16 PM
Hi people!
I have a program that erase a Z table, but I have a problem with the rollback memory. A consultant tell me that if I execute a commit work after some records the memory of the rollback is cleared.
How can execute in my program the commit work after some files and when finish?
This is my simple code:
*Tabla a utilizar.
TABLES zavg_bal_table.
*Este select elimina todos los records encontrados en la tabla: ZAVG_BAL_TABLE.
DELETE FROM zavg_bal_table.
Thanks!
2007 Jan 05 12:12 PM
Hi people!
I have a program that erase a Z table, but I have a problem with the rollback memory. A consultant tell me that if I execute a commit work after some records the memory of the rollback is cleared.
How can execute in my program the commit work after some files and when finish?
This is my simple code:
*Tabla a utilizar.
TABLES zavg_bal_table.
*Este select elimina todos los records encontrados en la tabla: ZAVG_BAL_TABLE.
DELETE FROM zavg_bal_table.
Thanks!
2007 Jan 04 9:23 PM
2007 Jan 04 9:29 PM
I'm not really sure what the question is, but if you try to deelte all the records from a very large table at once, the roll area may be exceeded causing a dump. Are you asking about this?
Rob
2007 Jan 05 12:12 PM
2007 Jan 05 2:28 PM
OK - you have to find a way to delete data in chunks and do a commit after each chunk. One way to do this would be to select a group of records using the UP
TO n ROWS option of the SELECT statement and then for each group of records, delete the records and do a commit.
Rob
2007 Jan 05 2:36 PM
Something like:
REPORT ztest NO STANDARD PAGE HEADING LINE-SIZE 255
MESSAGE-ID 00.
* Tabla a utilizar.
TABLES zavg_bal_table.
DATA: BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE zavg_bal_table.
DATA: END OF itab.
* Este select elimina todos los records encontrados en la tabla:
* ZAVG_BAL_TABLE.
WHILE sy-subrc = 0.
SELECT * FROM zavg_bal_table
INTO TABLE itab UP TO 10000 ROWS.
DELETE zavg_bal_table FROM TABLE itab.
COMMIT WORK.
ENDWHILE.
Rob
2007 Jan 05 6:57 PM
Fully agree with Rob,
We usually make a parameter for the number of rows in a package so it can be adjusted on a produciton without the need for transport.
I would do it a bit differently though:
WHILE num_rec >0.
SELECT * FROM zavg_bal_table
INTO TABLE itab UP TO p_rows ROWS.
endselect.
describe table itab lines num_rec.
check num_rec > 0.
DELETE zavg_bal_table FROM TABLE itab.
COMMIT WORK.
ENDWHILE.
Good luck !
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |