Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Short dump with sort statement

Former Member
0 Likes
1,754

Hi All,

I have an internal table with 14,00000 records .Iam using sort statement on this internal table . Iam getting short dump as " loss of memory for external sort" . How can i avoid this dump?

1 ACCEPTED SOLUTION
Read only

naveen1241
Participant
0 Likes
961

if possible...declare it as a sorted table....so tht u need not sort it using SORT stmnt....

regards,

naveen.

3 REPLIES 3
Read only

naveen1241
Participant
0 Likes
962

if possible...declare it as a sorted table....so tht u need not sort it using SORT stmnt....

regards,

naveen.

Read only

aris_hidalgo
Contributor
0 Likes
961

Hi,

As the post above, try to use SORTED tables so you can avoid the SORT statement.

Here is an example of using SORT statement and using SORTED tables:

Using SORT statement:


DATA: gt_vbak  type standard table of vbak, 
          wa_vbak like line of vbak.

select * 
from vbak
into table gt_vbak.

sort gt_vbak by vbeln ascending.

loop at gt_vbak into wa_vbak.
 write: / wa_vbak-vbeln.
endloop.

Using SORTED table:

data: gt_vbak type sorted table of vbak
        with unique-key vbeln,
        wa_vbak like line of gt_vbak.

select *
from vbak
into table gt_vbak.

loop at gt_vbak into wa_vbak.
 write: / wa_vbak-vbeln.
endloop.

Hope it helps...

P.S. Please award points if it helps...

Read only

naveen1241
Participant
0 Likes
961

otherwise declare a new sorted internal table of the same structure and assign the first table to sorted table....

ex:

DATA: it_tab TYPE TABLE OF ekko WITH HEADER LINE,

it_tabsort TYPE SORTED TABLE OF ekko WITH UNIQUE KEY ebeln.

SELECT * FROM ekko INTO TABLE it_tab.

it_tabsort[] = it_tab[].

it_tab[] = it_tabsort[]. "Assign back if necessary

hope this helps.....

this wud wrk in split of a second..as i had tried with 35000 odd records.....

Regards,

Naveen Natarajan