Partial Data deletion from SLT table

787 Views Asked by At

I need to delete the data from VBFA table which is an SLt table. We need to delete the data till Oct 2017. How we can achieve this as only date filed we have is MJAHR which is Material document year and ERDAT date on which record is created.

How we can delete the data till Oct 2017

1

There are 1 best solutions below

6
Lars Br. On

Table [VBFA][1] (SAP Sales Document Flow Table and data) contains two fields that track when a record was created (ERDAT) and when it was last changed (AEDAT).

The way you describe the requirement, I understand it like this:

  • the table from which the data should be deleted is a replicated (via SLT replication) table in a HANA database that is not the actual transactional system.

  • all records that have been last changed before (but not including) October, 1st 2017 should be deleted from this table.

If this is correct, you could run a DELETE statement like this:

    DELETE FROM "VBFA" WHERE "AEDAT" < '20171001'

Note that this does only affect this table and not any related records in other tables. Also, if the table is partitioned, be aware that this command does not remove partitions that may be empty after the deletion.