Skip to Content
0
Jun 01, 2018 at 01:39 PM

Casting standard itab to sorted itab

1201 Views

Hi Experts,

Need your help with my issue.

I am trying to improve the performance of an old report program. There is a select query on GLPCA table which fetches 2400000 records into say it_glpca.

After the select, these records are moved into another internal table say it_glpca_temp.

Now, the it_glpca_temp itab is sorted by kunnr.

Before code change:

select on glpca into it_glpca.

it_glpca_temp[] = it_glpca[].

sort it_glpca_temp by kunnr.

After my code change:

i changed the declaration of it_glpca_temp as type sorted internal table. Earlier it was of type standard table. I did this to avoid using the sort command on the internal table with large number of records.

The program dumps saying 'No more memory available to add rows to an internal table' with 'TSV_TNEW_PAGE_ALLOC_FAILED'.

This is happening because the it_glpca table has huge data. This dump wont happen for less number of records. i checked.

There is no other way of limiting the selection criteria. This data is for a single company code and we cannot limit the selection criteria any further than what it already is.

My question;

How to avoid the runtime error that i am getting with the code --> it_glpca_temp[] = it_glpca[].

Am i doing the casting (moving data from itab type standard table to itab type sorted table) wrong?

Any suggestions would be most welcome.