Skip to Content
0
Former Member
Jul 31, 2008 at 02:02 AM

how to record the records deleted in a table

340 Views

Hi Experts

I want to run a report as a batch which should deleted the records

which are sysdate - 60 and The report should log the number of records deleted

from each table at End Of Run.

Criteria for selecting records to be deleted are as follows:

1. ZINT_DATA

u2022 ZINT_DATA.CREATED_ON <= (Today u2013 60 Days)

and ZINT_DATA.STATUS = u2018OKu2019

So I want to create a table for log history recorded as

Delete Date Log description

01.01.2008 1500 rows deleted

30.03.2008 2000 rows deleted.

30.04.2008 300 rows deleted.

Eg The table are ZINT_DATA.

The report starts like this

REPORT z_eslp_command.

DATA:

fs_zint_data TYPE zint_data.

DATA:

t_zint_data TYPE

TABLE OF

ZINT_DATA.

START-OF-SELECTION.

SELECT *

FROM ZINT_DATA

INTO TABLE t_ZINT_DATA PACKAGE SIZE 10000.

ENDSELECT.

LOOP AT t_zint_data INTO fs_zint_data.

INSERT INTO ZINT_DATA_DEL

VALUES fs_zint_data.

select count(*) from zint_data_del.

ENDLOOP.

IF sy-subrc EQ 0.

WRITE:

'DATA INSERTED FROM ZINT_DATA into ZINT_DATA_DEL'.

ENDIF.

But Instead of creating another table , I want only log to be recorded as described.

Thanks

Regards

Piroz