Hi all,
I am writing a housekeeping program to check on the table ZTP_ADA for the invalid date format.
If invalid date format record is found, then delete the record (delete those records which are erroneous). The table is having a huge number of records, might reach around millions of records.
To make it short, the program will does this: -
1) Delete records which are in invalid date format.
My question is, how to improve the speed for the current program, which might takes more than half an hour for deleting records.
Any suggestions or ideas are greatly appreaciated.
Million thanks.
DATA: lv_datum TYPE sy-datum,
lv_commit TYPE c,
lv_excep TYPE REF TO CX_ROOT.
DATA: ITAB_ADA TYPE SORTED TABLE OF ZTP_ADA WITH NON-UNIQUE KEY TABLE LINE,
WA_ADA LIKE LINE OF ITAB_ADA.
SELECT * from ZTP_ADA
INTO TABLE ITAB_ADA.
LOOP AT ITAB_ADA INTO WA_ADA.
lv_datum = WA_ADA-DATUM.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = lv_datum
EXCEPTIONS
plausibility_check_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
DELETE FROM ztp_ada
WHERE DATUM = WA_ADA-DATUM.
ENDIF.
ENDLOOP.