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: 

Problem with internal table with unique key...

Former Member
0 Kudos

Hi guys,

I have an internal table with unique key...

But Im getting a dump when using it... If the key has 2 same values, it gives a dump... is it normal? what should be done to curb this?

thanks a lot!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Are you using a sorted table with unique key or hashed key with unique key ?

If yes, then it will give a dump.

SO to avoid this, first do a

read table itab with key x = f1.

if sy-subrc = 0.

delete itab where x = f1.

insert wa into itab.

endif.

Note: for sorted, hashed tables you have to use INSERT and not APPEND.

Does this help?

Regards,

Subramanian

3 REPLIES 3

Former Member
0 Kudos

Hi,

Are you using a sorted table with unique key or hashed key with unique key ?

If yes, then it will give a dump.

SO to avoid this, first do a

read table itab with key x = f1.

if sy-subrc = 0.

delete itab where x = f1.

insert wa into itab.

endif.

Note: for sorted, hashed tables you have to use INSERT and not APPEND.

Does this help?

Regards,

Subramanian

former_member181962
Active Contributor
0 Kudos

yes it is completely normal behavior.

If you pass duplicate values for the key, it defies the definition of the KEY field and hence the dump.

Regards,

ravi

Former Member
0 Kudos

Hi,

Unique key define the column uniqully throughout the table. If you try to append the duplicate value in the column, it will raise the error.

Krishan