Skip to Content


Oct 26, 2017 at 01:23 PM


avatar image

Hi ,

Currently im using ECC 6.0 EHP 8.0 version.

i need to delete duplicate records in database table S111. For deletion im using the statement.

Loop at...

DELETE S111 FROM gw_table.


But the system is throwing run time error. that is the system is not allowing to delete multiple duplicate records using the work area.

the below logic works for deleting multiple records. but taking too much time and performance is too poor. any idea to resolve this issue.

loop at ..

DELETE S111 FROM TABLE gi_table.


q.jpg (49.9 kB)
11.jpg (76.5 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Raymond Giuseppi
Oct 26, 2017 at 01:59 PM

How was this data inserted in database, bypassing Primary Key constraint, primary index inactive?

The OPEN SQL delete will use primary key values to identify records to delete, here with same keys you get only one record and database raise an error.

Did you

  • Look for OSS notes
  • Consider full clear the database table (SE14, delete data), reactivation of index and regeneration of data with reports like RMEBEIN3 or RMCENEUA.
  • raise an OSS message, if problem was generated by standard solution

Else could you try to (as a last tricky solution)

  • Compress the internal table (sort or sorted type, delete adjacent duplicates or similar statement like a COLLECT into another table)
  • Try a DELETE WHERE clause (in a loop)
  • database commit
  • reactivation of index
  • insert back records from the internal table (without duplicate now)
Show 2 Share
10 |10000 characters needed characters left characters exceeded

hi recently they had upgraded the ecc system. we cannot go for mass deletion since its a standard sap table.

I had written the code as below. her gi_s111_final table contains the duplicate records.

in order to check how many records in data base i'm using select statement in and getting in gi_table.

then im trying to delete records based on gi_table internal table. since work area deletion is throwing run time error (please see my previous post for run time error.)

the below code is working fine. but performance wise poor. any idea to improve performance.

666.jpg (62.2 kB)
777.jpg (28.9 kB)

Try to add a call of db_commit between delete and modify and replace modify with insert. Then activate index with SE14.