附加排序表的ABAP短转储

Est*_*sti 12 sap abap

当我将一行添加到已排序的表时,为什么我的ABAP程序会短暂转储?

ST22显示 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" 
Run Code Online (Sandbox Code Playgroud)

Est*_*sti 18

以错误的排序顺序附加排序表时,程序短转储

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"
Run Code Online (Sandbox Code Playgroud)

使用INSERT代替:

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"
Run Code Online (Sandbox Code Playgroud)

注意如果您有一个UNIQUE键,您仍然会得到一个简短的转储,因为您使用了两次相同的密钥