Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

NEED TO DELETE DUPLICATE RECORDS IN S111 DATABASE TABLE

Former Member
0 Likes
1,994

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.

endloop.

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.

endloop.

3 REPLIES 3
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,702

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)
Read only

0 Likes
1,702

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.

Read only

1,702

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