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 Internal table

Former Member
0 Likes
814

Hi,

In which scenario sorted inernal table cannot be used?.

Sorry friends If this question was asked already. I tried to find but not able to get.

Regards,

S.Senthil kumar

3 REPLIES 3
Read only

Former Member
0 Likes
727

Hi,

You can not use sorted tables in these situations:

A runtime error occurs if you attempt to add a duplicate entry to a sorted table with a unique key.

When you append several lines to a sorted table, you must respect the unique key (if defined), and not violate the sort order. Otherwise, a runtime error will occur.

From SAP Help:

You can also access sorted tables by index operations. When you insert using an index, the system checks to ensure that the sort sequence has been correctly maintained. For this reason, it takes longer than inserting entries in a standard table. As a rule, you should only access sorted tables using their key.

Append cannot be used with sorted tables, you have to use INSERT.

Regards,

Ali

Read only

Former Member
0 Likes
727

We can use append also. But the record to be appended should match sort order of internal table, else a exception with a dump will occur.

Read only

Former Member
0 Likes
727

hi

Append cannot be used with sorted tables, you should use INSERT (records will be inserted into the internal table at the correct position to keep the sorting ok).

also Check ... is initial or if.... is inital is the same for performance reasons.

The index will be used automatically by the DB-optimizer.

Regards

Aakash