‎2008 Aug 06 4:36 PM
one of our old program having issue when it runs
I have an internal tabe called iI_ORDERS. then decleard like this.
DATA: I_ORDERS99 LIKE SORTED TABLE OF I_ORDERS
WITH NON-UNIQUE KEY VBELN.
and after one select statement, give like this
APPEND I_ORDERS TO I_ORDERS99.
but getting dump says
A line is to be inserted or changed at position 36 in the sorted
internal table (type SORTED_TABLE)
"\PROGRAM=ZRSD_ODERS_WITHOUT_DELV\DATA=I_ORDERS99".
In doing so, the sorting sequence - determined by the table key - was
destroyed.
any idea, who can I correct this.
‎2008 Aug 06 4:40 PM
Hi
It means y're appending the records without to respect the sorting: try to replace APPEND statament with INSERT
*APPEND I_ORDERS TO I_ORDERS99.
INSERT I_ORDERS INTO TABLE I_ORDERS99.
Max
‎2008 Aug 06 4:39 PM
hi Mat,
you cannot APPEND to a SORTED table, you have to use INSERT ... INTO TABLE ... instead.
hope this helps
ec
‎2008 Aug 06 4:39 PM
Hi...
Can you please post u r code....
Hw is i_orders declared.....
Is I_orders a work area????
Thanks,
Chaitanya
‎2008 Aug 06 4:42 PM
it is an internal table.
DATA: BEGIN OF I_ORDERS,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
ZZIHREZ_E LIKE VBKD-IHREZ_E,
KUNNR LIKE VBAK-KUNNR,
K_NAME(50),
CLIENT LIKE VBAK-KUNNR,
C_NAME(50),
MATNR LIKE VBAP-MATNR,
M_NAME(35),
ZZWERKS LIKE VBAP-WERKS,
ERDAT LIKE VBAK-ERDAT,
VDATU LIKE VBAK-VDATU,
ERNAM LIKE VBAK-ERNAM,
KWMENG LIKE VBAP-KWMENG,
PRODH LIKE VBAP-PRODH,
NETWR LIKE VBAP-NETWR,
REJ(15),
END OF I_ORDERS.
what is the use of declaring like sorted tables, instad of that, at end of all the selection and update, sort that internal table by vbeln is enough?
DATA: I_ORDERS99 LIKE SORTED TABLE OF I_ORDERS
WITH NON-UNIQUE KEY VBELN.
‎2008 Aug 06 5:06 PM
Hi
It's usually used to improve the performance if the internal table can have a very large number of hits.
If it uses a SORTED TABLE the record is inserted in the internal table in according to the sorting way, after inserting it the system creates an index to be used for reading, in your case a index for field VBELN.
U should also consider the SORT statament needs memory space and this space is defined by system variables and it couldn't be enough for very big table, in this case a dump occurs.
Max
‎2008 Aug 06 4:40 PM
Hi
It means y're appending the records without to respect the sorting: try to replace APPEND statament with INSERT
*APPEND I_ORDERS TO I_ORDERS99.
INSERT I_ORDERS INTO TABLE I_ORDERS99.
Max
‎2008 Aug 06 5:00 PM
hi for the sorted tables no need to use the sort command .
sorted table means itself is sorted by definition