2009 Dec 03 10:48 AM
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
2009 Dec 03 10:55 AM
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..
2009 Dec 03 11:05 AM
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
2009 Dec 03 11:11 AM
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
2009 Dec 03 11:14 AM
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.
2009 Dec 03 11:41 AM
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
2009 Dec 03 11:46 AM
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.
2009 Dec 03 11:49 AM
Yeah Nitwick, Thanks.
I used FOR ALL ENTRIES clause and It is working fine.
Thanks
Depesh
2009 Dec 03 12:00 PM
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
2009 Dec 03 10:58 AM
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