09-29-2006 11:22 AM
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.
09-29-2006 11:27 AM
hi,
Do this way ..
if not x1 is initial.
Do something.
endif.
Regards,
Santosh
09-29-2006 11:31 AM
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
09-29-2006 11:32 AM
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.
09-29-2006 11:39 AM
hi,
If x1 cp 'ARC5*'.
select * from xyz into table it_xyz
where x1 = 'ARC5%' and
x3 = x3.
endif.
REgards,
Sailaja.
09-29-2006 11:44 AM
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
09-29-2006 12:36 PM
Hi,
start-of selection.
if not x1[] is initial.
select * from <db> where
f1 = 'ARC5'
and f2 in x3.
endif.
Regards
amole
09-29-2006 3:11 PM
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.
09-29-2006 3:57 PM
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