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: 

Reg select-options

Former Member
0 Kudos

Hai all,

Under select-options i have declared 3 varibles

1.X1 is of char(30)

2.X2 is of char(4)

3.x3 is a date field.

now i have to get values from a db table where x1 begin with 'ARC5' and date in x3 entered on screen.

if x1 is entered on screen fetch those records otherwise dont fetch any records.

8 REPLIES 8

Former Member
0 Kudos

hi,

Do this way ..


 if not x1 is initial.

  Do something.

 endif.

Regards,

Santosh

former_member404244
Active Contributor
0 Kudos

hi ganesh,

first select data basing on the select-options fileds and then do like this.

if x1[] is not initial.

write the seelct query here.

endif.

Regards,

Nagaraj

Former Member
0 Kudos

Under select-options i have declared 3 varibles

1.X1 is of char(30)

2.X2 is of char(4)

3.x3 is a date field.

now i have to get values from a db table where x1 begin with 'ARC5' and date in x3 entered on screen.

if x1 is entered on screen fetch those records otherwise dont fetch any records.

--

SELECT fields FROM dbtable

WHERE xf2 in X2 and xf3 in x3 and xf1 in x1.

Since you have defined it as select-options..if you leave it blank it means all records. Secondly for X2, on the screen you can enter the pattern ACR5* and it would fetch the records according to the selected pattern. For date it is similar to X1.

Former Member
0 Kudos

hi,


  If  x1 cp 'ARC5*'.
     select * from xyz into table it_xyz 
       where x1 = 'ARC5%' and
             x3 = x3.
  endif.

REgards,

Sailaja.

0 Kudos

A small correction in the code above

If x1 cp 'ARC5*'.

select * from xyz into table it_xyz

where x1 <b>LIKE</b> 'ARC5%' and --> for pattern

x3 <b>IN</b> x3. -> select-options

endif.

Hope Sailaja wont mind it.

Kind Regards

Eswar

Former Member
0 Kudos

Hi,

start-of selection.

if not x1[] is initial.

select * from <db> where

f1 = 'ARC5'

and f2 in x3.

endif.

Regards

amole

Former Member
0 Kudos

Hi ganesh,

1. we need to do this in 2 steps.

(bcos getting data from table with beginning with ARC5 etc, is complicated)

2.

a) select * from dbtable

into table itab.

where DateField In X3.

b) loop at itab.

if itab-X1(4) = 'ARC5' .

ELSE.

DELETE ITAB.

ENDIF.

ENDLOOP.

regards,

amit m.

Former Member
0 Kudos

Hi Ganesh,

if X3 is a select option, use CODE A and if X3 is a parameter, use CODE B:

CODE A:

if not x1 is initial.

select x1

x2

x3

from <dbtable> into <internal table>

where x1 = 'ARC5%'

and x3 in x3.

endif.

CODE B:

if not x1 is initial.

select x1

x2

x3

from <dbtable> into <internal table>

where x1 = 'ARC5%'

and x3 = x3.

endif.

Regards,

Divya

Message was edited by: Divya Lingala