Application Development 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: 

secondary unique index

Former Member
0 Kudos

Hi,

I'm adding a secondary unique index to my z-table which already has records. However some of the records are duplicates as per new secondary index. I'm using se14 to adjust the table. However se14 throws an error saying dupliacte records found , cant proceed with adjustment. Is there a way where all duplicate records are deleted or should i delete the records manually and then adjust it again ?

Thanks for your time.

Bye

3 REPLIES 3

Former Member
0 Kudos

Hi Mac,

Go to Se38 transaction and create a Ztest program and Select all the records into one internal table ( IT_TAB ) from your z-table.

After that use the Sort statement for the Key fields . (SORT it_tab BY key fields )

And to delete the duplicate records use the below statement.

DELETE ADJACENT DUPLICATES FROM it_tab COMPARING key fields of ur primary key.

And lastly Update the Z-table from the internal table it_tab

Hope this will help you..

Regards,

Ravi Kiran..

Former Member
0 Kudos

Hi Mac,

if you hve less number of records in that table you can delete them manually it is better.

of if you have more.

you need to create a sepearte z-program. where you can write the code as below

1) take all the z-table data into internal table.

2))sort the table fields by their primary keys,(or required fileds )

3)delete the adjusent duplicates from that internal table.

4)update to the database table.

Note:if your deleting the standard table you need to use the function modules.

for some standard tables SAP has provided the some function modules to delete the entries from the database level.

Former Member
0 Kudos

thnx guys