‎2010 Sep 21 11:33 AM
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!
‎2010 Sep 21 11:37 AM
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'.
‎2010 Sep 21 11:37 AM
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'.
‎2010 Sep 21 11:40 AM
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.
‎2010 Sep 21 11:44 AM
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!
‎2010 Sep 22 11:56 AM
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
‎2010 Sep 22 12:09 PM
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
‎2010 Sep 21 11:41 AM
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
‎2010 Sep 21 11:44 AM
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
‎2010 Sep 21 3:03 PM
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.
‎2010 Sep 22 2:33 PM
Moderator message - Please search before asking - post locked Rob