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

Select query giving dump

Former Member
0 Likes
1,185

Hi,

We have a select query written as below:

SELECT counter

stokz

pernr

workdate

rnplnr

catshours

FROM catsps

INTO TABLE t_catsps

WHERE pernr IN r_pernr

AND workdate IN s_wrkdt

AND rnplnr IN s_ntwrk

AND belnr IN s_docno

AND transfer NE 'X'.

Here, the range which we are using has a record of more than 16000. At this particular portion of the code the program dumps. I suspect it is due to the excessive data records in the ranges option. Is there any remedy for this situation. Please help!

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,149

Change it like this


sort r_pernr by low ascending.
SELECT counter
stokz
pernr
workdate
rnplnr
catshours
FROM catsps
INTO TABLE t_catsps
for all entries in r_pernr
WHERE pernr = r_pernr-low
AND workdate IN s_wrkdt
AND rnplnr IN s_ntwrk
AND belnr IN s_docno
AND transfer NE 'X'.

9 REPLIES 9
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,150

Change it like this


sort r_pernr by low ascending.
SELECT counter
stokz
pernr
workdate
rnplnr
catshours
FROM catsps
INTO TABLE t_catsps
for all entries in r_pernr
WHERE pernr = r_pernr-low
AND workdate IN s_wrkdt
AND rnplnr IN s_ntwrk
AND belnr IN s_docno
AND transfer NE 'X'.

Read only

0 Likes
1,149

Hi Keshav,

Thanks for your reply. I actually forgot to include one thing in the code snippet. The code actually is written like this...

SELECT counter

stokz

pernr

workdate

rnplnr

catshours

FROM catsps

INTO TABLE t_catsps

FOR ALL ENTRIES IN t_aufk

WHERE rnplnr EQ t_aufk-aufnr

AND pernr IN r_pernr

AND workdate IN s_wrkdt

AND belnr IN s_docno

AND transfer NE 'X'.

Here already FOR ALL ENTRIES is applied on t_aufk.

Read only

0 Likes
1,149

Try checking the Range and other options are not intial.

And

If you are going to make use of FOR ALL ENTRIES.

Make sure you have a condition for R_PERNR not intial before it.

Else SELECT query will go for all table entries .

Thanks!

Read only

0 Likes
1,149

Hi

TO Remember before applying For all entries in.

1. The for all entry table should not be blank, so check it before select query.

2. select all the primary keys from table t_catsps.

3. sort the For all entries table.

make sure the structure of both the table is equal.

thanks

Lalit Gupta

Read only

0 Likes
1,149

Hello Sandeep,

This is a FAQ in the ABAP forums. The Open SQL statement is parsed before being forwarded to the DB layer. If you've too many records in your RANGES, the length of the parsed statement exceeds the maximum length. AFAIK there is no technical workaround for this(of course you could use FAE but this is not applicable in you case).

As already mentioned try to split the ranges into smaller blocks & proceed with the select.

BR,

Suhas

Read only

Former Member
0 Likes
1,149

Hi,

check the inetrnal table strcure field are of same type of catsps table field which you are fetching

Or try to USe into corresponding fields of table t_catsps.



"check the inetrnal table strcure field are of same 
"type of catsps table field which you are fetching


 SELECT  counter
             stokz
             pernr
             workdate
             rnplnr
             catshours
       FROM catsps
       INTO TABLE t_catsps   'Or try to USe into corresponding fields of table t_catsps
       WHERE pernr IN r_pernr
       AND   workdate IN s_wrkdt
       AND   rnplnr IN s_ntwrk     "check rnplnr and  s_ntwrk     are of same type
       AND   belnr IN s_docno      "Check belnr and s_docno are of same type 
       AND   transfer NE 'X'.
"hadle sy-subrc
 

prabhudas

Edited by: Rob Burbank on Sep 22, 2010 9:32 AM

Read only

Former Member
0 Likes
1,149

Hello Sandeep,

Even i have faced the similar kind of problem.

I could not find any solution to this. Only thing i could do was to execute the select multiple times breaking the data in range in the sets of 5000.

Regards,

Himanshu

Read only

Former Member
0 Likes
1,149

If you want a career as an ABAP programmer, NEVER EVER do a select with FAEI (for all entries in) without first checking to be certain that the pick list (the "entries" table) contains at least one row! If the table is empty, SAP discards the WHERE clause and gets ALL rows from the selected table.

Read only

Former Member
0 Likes
1,149

Moderator message - Please search before asking - post locked Rob