ABAP Short Dump to add a sorted table

Why is my ABAP short dam when adding a row to a sorted table?

ST22 Shows ITAB_ILLEGAL_SORT_ORDER

 data: sorted_tab type sorted table of ty_tab with non-unique key key, line type ty_tab. line-key = 1. append line to sorted_tab. "works fine" line-key = 2. append line to sorted_tab. "works fine" line-key = 1. append line to sorted_tab. "<==== Short dump here" 
+9
sap abap
source share
1 answer

Short program dumps when adding a sorted table to the wrong sort order

 data: sorted_tab type sorted table of ty_tab with non-unique key key, line type ty_tab. line-key = 1. append line to sorted_tab. "works fine" line-key = 2. append line to sorted_tab. "works fine" line-key = 1. append line to sorted_tab. "<==== Short dump here" 

Use INSERT instead:

 data: sorted_tab type sorted table of ty_tab with non-unique key key, line type ty_tab. line-key = 1. insert line into table sorted_tab. "works fine" line-key = 2. insert line into table sorted_tab. "works fine" line-key = 1. insert line into table sorted_tab. "works fine" 

Note. If you have a UNIQUE key, you still get a short dump, because you use the same key twice

+14
source share

All Articles