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

Creating Range Table

Former Member
0 Kudos
8,897

Hi Experts,

I have created a range table as below:

data ltrg_tab type range of lifnr.

But I have come to know that range table created like this can hold records upto 1000 and after 1000, it drop the records.

How I can overcome this problem.

Thanks

Depesh

9 REPLIES 9
Read only

Pawan_Kesari
Active Contributor
0 Kudos
901

Hi Depesh,

I just tried to with 1001 record and it worked.. check the code below..

TYPES : r_mara TYPE RANGE OF mara-matnr ,
        ty_mara TYPE LINE OF r_mara  .

DATA : ls_mara TYPE ty_mara ,
       i_mara  TYPE r_mara  .
DATA : lv_line TYPE syst-tabix .

DO 1001 TIMES .

  ls_mara-sign = 'I' .
  ls_mara-option = 'EQ' .
  ls_mara-low = 'MMMM' .
  APPEND ls_mara TO i_mara .

ENDDO .

DESCRIBE TABLE i_mara LINES lv_line .
WRITE lv_line .

However if you use range with that many record with SELECT statemen then it may cause dump..

Read only

0 Kudos
901

Yeah right,

I am getting a dump in the select statement containing range table with more that 1000 entries.

Can it be tuned?

Thanks

Depesh

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Kudos
901

Yes,

That is something different. It has got nothing to do with the maximum number of records in a RANGE table.

There is a limit to the length of the Native SQL which is generated when you write an Open SQL stmt. Search in SDn you will get the details.

BR,

Suhas

Read only

0 Kudos
901

Select statement with range/select-option are expanded by ABAP for each record in range/select-option and then passed to database server. More number of record in range/select-option results in bigger SQL string. However there is a limit on the length of SQL statement that can be passed to database server from SAP. Once your select with range cross that limit you will get dump.

Review the logic, try using JOIN or split your range for fewer records and execute Select for each.

Read only

0 Kudos
901

Thanks Pawan for your suggestion. It seems helpful by breaking the query for smaller set as no direct option seems available.

@Suhas Saha: You could make out faults in the query or but could not try solving the issue. Suggestion: = Instead of finding ENLIGHTENED info and suggesting search on sap help, you could have checked the limitation of SQL for maximum records.

Thanks,

Depesh

Read only

0 Kudos
901

Hi,

As told, the range table's size is limited by the database system.

Alternatively, you could write a logic that puts all the data in ranges into an internal table.

Do watch out for 'I', 'E', 'BT', 'EQ' and others.

Come up with a logic where you can populate all these data into an internal table.

You could probably use a FOR ALL ENTRIES in your select query.

I think this would considerably save time. Coz even if you hit the database in parts, its an expensive affair

I would rather code a logic and hit the database once.

Read only

0 Kudos
901

Yeah Nitwick, Thanks.

I used FOR ALL ENTRIES clause and It is working fine.

Thanks

Depesh

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Kudos
901

Hello Depesh,

you could have checked the limitation of SQL for maximum records.

Why should i search for your problem? I wanted to put forward the point that there is no limitation to the number of records in a range table.

There is an OSS note which address to the maximum length of a SQL stmt. And problems similar to this has been discussed many a times in this forum so i asked you to search the forum.

Br,

Suhas

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Kudos
901

Hello Depesh,

But I have come to know that range table created like this can hold records upto 1000 and after 1000, it drop the records.

Where did you come to know this enlightening info? SAP documentation does not say anything on this

BR,

Suhas