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

SQL Sentence Error

Former Member
0 Likes
362

I am trying to execute this sentence :

SELECT PERNR

BEGDA

ZZCPRENDA

ZZDPRENDA

ZZTPRENDA

ZZPROV from ZPREN_EMP_FUNC into (wa_entr-n_pers,

wa_entr-frecog,

wa_entr-cod_prenda,

wa_entr-descrip,

wa_entr-tall_r,

wa_entr-origen)

where subty = '0003' and begda >= ran_f-low and begda <= ran_f-high

and pernr in num_per.

But It gives me and SQL error 'Error in module RSQL of the database interface'.

It is all because of the num_per table. It contains 3001 regs.

How can I solve it ? Should I modify the maximum size of the SQL statement ? or even the space??

Thanks in advance.

2 REPLIES 2
Read only

Former Member
0 Likes
340

Yes for an SQL statement a range can only have a finite number of entries.

You need to use the FOR ALL ENTRIES command instead.

Read only

mvoros
Active Contributor
0 Likes
340

Hi,

check this OSS note 13607. It describes how SAP rewrites OpenSQL statement with ranges into SQL query for DB server and why there is technical limitation of number of items in range. You can try to use FOR ALL ENTRIES or split you select into more select where you will split your range into smaller chunks.

Cheers