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

Selection criteria problem

Former Member
0 Likes
1,513

Hello folks,

I am facing one problem .when I don’t give any selection criteria my program searches for blank records in respective table for that criteria and blank records are not there so sy-subrc is not coming as 0, But this should not happen in this way , rather program should display all records because that selection criteria is blank. To overcome this issue each time I am checking whether that selection criteria is blank or not. If that criteria is blank I will simply exclude condition for selection from database table and criteria is there on selection screen I have to select for accordingly. <b>Is there any other way to get all data from database table for particular column if I don’t give any value for that column on selection screen</b>?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,293

hi again,

*----


1 .Best thing is that for PARAMETES,

use select-options like this way.

SELECT-OPTIONS : bukrs FOR t001-bukrs NO INTERVALS no-extension.

2. This will give the LOOK and FEEL of parameters only.

3. Moreover, in sql,

use IN (instead of 😃

regards,

amit m.

6 REPLIES 6
Read only

FredericGirod
Active Contributor
0 Likes
1,293

Hi,

strange, could you provide some code ?

Rgd

Frédéric

Read only

Former Member
0 Likes
1,293

Hi nirad,

1. SELECT-OPTIONS vs parameter

2. This problem happens in parameter.

3. In select-options,

even if we give blank (do not enter anything)

and bcos we use

IN abc

sql,

the system understand and gives

ALL records.

4. So u can use SELECT-OPTIONS (instead of parametes)

and use IN sql

5. Other wise

make your paramters OBLIGATORY.

6. Or else, as u have already used,

use IF conditions for sql.

7. There is no other way !

regards,

amit m.

Message was edited by: Amit Mittal

Read only

Former Member
0 Likes
1,293

Hi Nirad,

you can dynamically create your Selection criteria..

for eg.

data : sel_cri type string.

if s_bukrs is not initial.

concatenate sel_cri 'bukrs eq s_bukrs' into sel_cri.

endif.

if s_belnr is not initial.

concatenate sel_cri 'and belnr in s_belnr' into sel_cri.

endif.

....

select * from bseg where (sel_cri).

hope this helps you..

regards

satesh

Read only

Former Member
0 Likes
1,293

Hi,

Check whether u have specified in the WHERE contion of ur SELECT Query with selection screen parameters.

In that case it wont retrieve if it doesnot satisfy the selection param.

Read only

Former Member
0 Likes
1,293

Hi Nirad,

Using select option if you don't enter any thing it will fetch all the records from the table.


select-options: s_vbeln for vbak-vbeln.
"don't enter any thing in selection screen
select vbeln
       from vbak
       into it_vbak
       where vbeln in s_vbeln.

now it_vbak has all vbak records..

regards

vijay

Read only

Former Member
0 Likes
1,294

hi again,

*----


1 .Best thing is that for PARAMETES,

use select-options like this way.

SELECT-OPTIONS : bukrs FOR t001-bukrs NO INTERVALS no-extension.

2. This will give the LOOK and FEEL of parameters only.

3. Moreover, in sql,

use IN (instead of 😃

regards,

amit m.