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

help me plz....

Former Member
0 Likes
790

any can explain me the meaning of blocked text which is given below.

waiting for ur reply.

You cannot sort a sorted table using the SORT statement. The system always maintains these

tables automatically by their sort order. If an internal table is statically recognizable as a sorted

table, the SORT statement causes a syntax error. <i><b>If the table is a generic sorted table, the

SORT statement causes a runtime error if the sort key is not the same as an extract of the

beginning of the table key, you sort in descending order, or use the AS TEXT addition.</b></i> In other

words, the SORT statement is only allowed for generic internal tables, if it does not violate the

internal sort order.

any can explain me the meaning of blocked text which is given below.

waiting for ur reply.

You cannot sort a sorted table using the SORT statement. The system always maintains these

tables automatically by their sort order. If an internal table is statically recognizable as a sorted

table, the SORT statement causes a syntax error. <i><b>If the table is a generic sorted table, the

SORT statement causes a runtime error if the sort key is not the same as an extract of the

beginning of the table key, you sort in descending order, or use the AS TEXT addition.</b></i> In other

words, the SORT statement is only allowed for generic internal tables, if it does not violate the

internal sort order.

5 REPLIES 5
Read only

Former Member
0 Likes
716

HI,

This clearly means that you cannot sort an SORT internal table.

IF you apply sort command on SORT TABLE , the system causes a runtime error if the sort key is not the same as you give when defining the sort internal table..

regards,

nazeer

Read only

0 Likes
716

can u plz send me the example.

Read only

Former Member
0 Likes
716

Hi,

There are 3 types of internal tables:

STANDARD

SORTED

HASHED

Sort statement on internal table can be used only for STANDARD & HASED internal tables.

For a predefined SORTED internal table, you cannot use SORT statement & such internal tables can be populated only by INSERT statement.

Best regards,

Prashant

Read only

Former Member
0 Likes
716

hi,

sorted tables are generally sorted and there is no need to give explicit sort command for these types of table. in sorted tables all key fields should be given first in order to maintain data consistency among records of database table.

sprted tables generally sort records while data is being populated from databse tables to internal tables. using index of table we can access all records of sorted internal table.

if helpful reward some points.

with regards,

Suresh.A

Read only

Former Member
0 Likes
716

Hi,

Sorted Internal Tables

Sorted tables are always saved correctly sorted by key. They also have a linear key, and, like standard tables, you can access them using either the table index or the key. When you use the key, the response time is in logarithmic relationship to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique, or non-unique, and you must specify either UNIQUE or NON-UNIQUE in the table definition. Standard tables and sorted tables both belong to the generic group index tables.

This table type is particularly suitable if you want the table to be sorted while you are still adding entries to it. You fill the table using the (INSERT) statement, according to the sort sequence defined in the table key. Table entries that do not fit are recognised before they are inserted. The response time for access using the key is in logarithmic relation to the number of

table entries, since the system automatically uses a binary search. Sorted tables are appropriate for partially sequential processing in a LOOP, as long as the WHERE condition contains the beginning of the table key.