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

sorted table with a unique key

Former Member
0 Likes
8,125

Hi,

I have created a sorted internal table with unique key as under -

DATA : ITAB TYPE SORTED TABLE OF SFLIGHT WITH UNIQUE KEY CARRID CONNID.

Now the internal table already has a record with say CARRID = 'AA' and CONNID ='0017'

However when i try to insert one more record in the internal table with same key say CARRID = 'AA' and CONNID ='0017'

it does not give me any error. Should not it give me an error as it is table with UNIQUE key and should not allow duplicates

Hi,

I have created a sorted internal table with unique key as under -

DATA : ITAB TYPE SORTED TABLE OF SFLIGHT WITH UNIQUE KEY CARRID CONNID.

Now the internal table already has a record with say CARRID = 'AA' and CONNID ='0017'

However when i try to insert one more record in the internal table with same key say CARRID = 'AA' and CONNID ='0017'

it does not give me any error. Should not it give me an error as it is table with UNIQUE key and should not allow duplicates

3 REPLIES 3
Read only

Former Member
0 Likes
3,758

Can you demonstrate it using a working code sample?

Read only

AnjaneyaBhardwaj
Contributor
0 Likes
3,758

Hi Hema ,

You will not get a design time error but a run time error as the duplicate is not checked till we run the program.You should get this error "ITAB_DUPLICATE_KEY_IDX_OP".

Anjan

Read only

matt
Active Contributor
0 Likes
3,758

You asked this question already. You did not respond to the questions asking for further information - like the actual source code you've used. Therefore I rejected your question.

In the hope that this time you'll actually get the message. I shall now lock this thread.