2009-10-05 5 views
7

Pourquoi mon programme ABAP effectue-t-il un vidage rapide lorsque j'ajoute une ligne à une table triée?ABAP Short Dump sur l'ajout d'une table triée

ST22 Affiche 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" 
+0

Cela semble une question stupide - mais j'ai juste perdu assez de temps pour trouver la réponse pour sauver la prochaine personne un peu de chagrin. (Google a été utile, l'aide SAP n'a pas été) – Esti

+2

s'il vous plaît inclure la déclaration de votre table triée! – Thorsten

+0

bon point - comme si votre table était déclarée avec une clé unique, vous obtiendriez encore un autre petit vidage – Esti

Répondre

13

Le programme court décharges lors de l'ajout d'une table triée dans le mauvais ordre de tri

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" 

Utiliser INSERT au lieu:

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 Si vous aviez une clé UNIQUE, vous obtiendriez quand même une vidage rapide car vous utilisez la même touche deux fois

Questions connexes