Application Development 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: 

Select query written on view giving dump

Former Member
0 Kudos

Hi All,

I have written the following query on COAS view in my code:

SELECT aufnr bukrs INTO TABLE gt_aufnr

FROM coas

WHERE

aufnr IN r_aufrm AND

auart IN s_auart AND

autyp = c_autyp_01 AND

kokrs = c_kokrs_mbca.

When records in range r_aufrm are too many like 6000 or so it gives me a run time error on this query - DBIF_RSQL_INVALID_RSQL. Error description says size of select query is large.

Question : Is this bug coming because I am using the view. If i select the records on table AUFK (only table on which the view is created), will it rectify the problem?? I am asking this because it's in production and I cant make any change and test then and there.

Note: the range r_aufrm contains two types of records for AUFNR - 1. with sign GE and others with sign LE. So I cannot use for all entries. If I still can, please tell me how?

Thanks a looot!

Waiting for the response,

Navita

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Thanks All!!

I think, this range limit has caused the problem. Range limit is 999 records.

Just one question I have. At runtime when I check the number of entries in r_aufrm in the query, I get 6000 entries. So, does it allow 6000 records to enter the range variable even if it has a limit of 999. Is it the case that, in select query only it will throw a dump if records in range exceed 999??

SELECT aufnr bukrs INTO TABLE gt_aufnr

FROM coas

WHERE

aufnr IN r_aufrm AND

auart IN s_auart AND

autyp = c_autyp_01 AND

kokrs = c_kokrs_mbca.

Please clear my doubt.

Thanks a lot for ur help!!!!

Navita

7 REPLIES 7

former_member156446
Active Contributor
0 Kudos

I know that range table has a restriction of number of entries it can hold, I had a similar scenario before, where I had to get rid of ranges and find out another solution...

the problem is number of entries in ranges.... give a lesser load in ranges it will work, with out dump.

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

Try it with AUFK table as you can also use the AUFNR field as one of the keys.

Former Member
0 Kudos

Hi ,

You should avoid Ranges if number of records are many,

Try this 1. Use database table AUFK directly instead of view.

2. Try to avoid range by fetch of all the record in internal table and later you can delete the extra records from internal table based on your condition).

Hope it help you.

Former Member
0 Kudos

Thanks All!!

I think, this range limit has caused the problem. Range limit is 999 records.

Just one question I have. At runtime when I check the number of entries in r_aufrm in the query, I get 6000 entries. So, does it allow 6000 records to enter the range variable even if it has a limit of 999. Is it the case that, in select query only it will throw a dump if records in range exceed 999??

SELECT aufnr bukrs INTO TABLE gt_aufnr

FROM coas

WHERE

aufnr IN r_aufrm AND

auart IN s_auart AND

autyp = c_autyp_01 AND

kokrs = c_kokrs_mbca.

Please clear my doubt.

Thanks a lot for ur help!!!!

Navita

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

Yes.

What you can do is cehck no. of entries in try is r_aufrm and then break the select accordingly using OPEN CURSOR .

0 Kudos

Thanks Sandeep!

0 Kudos

The limit isn't 999 records, it is what the database can digest in KByte for one single SQL statement, so it varies e.g. based on the length of the range field.

The usual workaround would be using FOR ALL ENTRIES with an internal table instead of the range.

Thomas