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

Regarding sorted internal table

Former Member
0 Likes
548

Hi Guys,

When populating data into sorted internal table iam facing runtime errors.

my code is as.......

WA_ITAB-FIELDNAME = 'AAA'.

WA_ITAB-VALUE = C_VAR.

APPEND WA_ITAB TO IT_ITAB.

WA_ITAB-FIELDNAME = 'BBB'.

WA_ITAB-VALUE = C_VAR1.

APPEND WA_ITAB TO IT_ITAB.

WA_ITAB-FIELDNAME = 'CCC'.

WA_ITAB-VALUE = C_VAR2.

APPEND WA_ITAB TO IT_ITAB.

WA_ITAB-FIELDNAME = 'DDD'.

WA_ITAB-VALUE = C_VAR3.

APPEND WA_ITAB TO IT_ITAB.

Iam getting runtime eror "ITAB_ILLEGAL_SORT_ORDER" A line is to be inserted or changed at position 2 in the sorted internal table (type SORTED_TABLE).

Thanks,

Madhu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
502

When you are appending records in a sorted table records should be entered in sorted order based on key fields.if the sort order is disturbed .you will get this runtime error .

What are the key fields of the table.

Instead of APPEND use INSERT statement it will work.

Regards,

Gurpreet

2 REPLIES 2
Read only

Former Member
0 Likes
503

When you are appending records in a sorted table records should be entered in sorted order based on key fields.if the sort order is disturbed .you will get this runtime error .

What are the key fields of the table.

Instead of APPEND use INSERT statement it will work.

Regards,

Gurpreet

Read only

0 Likes
502

Thanks Gurpreet........

SOLVED