2007 Nov 15 6:41 PM
Hi experts...
I need to make a program to make a backp of one table and the a restore.
The performance of this code is fine?? The tables contain a lot of records!
PARAMETERS:
p_backup TYPE c AS CHECKBOX,
p_rest TYPE c AS CHECKBOX,
p_del TYPE c AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK bl2.
IF p_backup IS NOT INITIAL. "Cuando se seleccione para hacer backup.
*Data Selection:
SELECT mandt bukrs day_a racct prctr per_day average agregate agregate_m accumulate average_m day_exe
FROM zavg_bal_table INTO TABLE t_avg.
INSERT zavg_backuptable FROM TABLE t_avg.
ELSEIF p_rest IS NOT INITIAL. "Cuando se seleccione para hacer restore.
SELECT mandt bukrs day_a racct prctr per_day average agregate agregate_m accumulate average_m day_exe
FROM zavg_backuptable INTO TABLE t_avg.
INSERT zavg_bal_table FROM TABLE t_avg.'
ENDIF.
2007 Nov 15 6:59 PM
Hi Carlos,
Use where clause atleast by passing empty values to the key fields, otherwise more the records goes up performance will go down.
Reward Points if it helps,
Satish
2007 Nov 15 6:44 PM
Without a where clause this could take for ever (if it contains a lot of data). You are better of doing this at the DB level.
Albert
2007 Nov 15 6:59 PM
Hi Carlos,
Use where clause atleast by passing empty values to the key fields, otherwise more the records goes up performance will go down.
Reward Points if it helps,
Satish
2007 Nov 15 7:30 PM
Hi,
you are taking a lots of records at one time, just split your results by adding "where" clause, here are a few examples of split:
- by mandt (very few splits, lot of records)
- by day
- by initial name (lot of splits, few records)
procedure:
read all mandt's into itab, loop itab doing select and insert
NOTES:
- of course splits and quntity of records depend of each table.
- I suppose that lot of splits with few records are the best choice.
best regards.
2007 Nov 15 7:45 PM
Use PACKAGE SIZE option to prevent the program from running out of memory and resulting in a short dump.
Your insert statement may suffer from short dump if there are records already in the target table. Use ACCEPTING DUPLICATE KEYS option. Or, delete the target table contents before inserting new records. (Try to avoid MODIFY statement.)
On a different topic, you should really be using radio buttons instead of checkboxes.