附加排序表的ABAP短转储

时间:2009-10-05 06:04:41

标签: 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" 

1 个答案:

答案 0 :(得分:17)

以错误的排序顺序追加已排序的表时的程序短转储

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"

使用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"

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