2007 Apr 09 11:20 PM
Hi everybody,
I have a report with a single screen, 4 fields for search criteria and 2 alv grids for the output.
I search db tables with a select statement.
Is it possible to define a select statement that searches for 3 out of 4 criteria, if the fourth input field isn't filled it?
Because right now the select statement doesn't return any data if I leave one parameter blank.
And how can I provide the possibility to define more than one search criteria of one kind withour adding several input fields on the screen?
For example: Data created on 20070101 and 20070105.
I know that most of this can be done with selection screens, but is there a possibility to do this without a selection screen?
Best regards
Tobias
2007 Apr 09 11:42 PM
You should use SELECT-OPTIONS on your selection screen. This allows the user to enter all kinds of possiblities, including leaving something blank. Then in your SELECT statement, you use the IN operator.
select-options: s_datum for sy-datum.
select * into table itab
from ztable
where datum IN s_datum.If you truly do not want to use a Selection-screen, you could hard code values in the SELECT statement or create a range using the RANGE statement. The RANGE statement works exactly like SELECT-OPTION statement but without the selection-screen.
Regards,
Rich Heilman
2007 Apr 09 11:42 PM
You should use SELECT-OPTIONS on your selection screen. This allows the user to enter all kinds of possiblities, including leaving something blank. Then in your SELECT statement, you use the IN operator.
select-options: s_datum for sy-datum.
select * into table itab
from ztable
where datum IN s_datum.If you truly do not want to use a Selection-screen, you could hard code values in the SELECT statement or create a range using the RANGE statement. The RANGE statement works exactly like SELECT-OPTION statement but without the selection-screen.
Regards,
Rich Heilman
2007 Apr 09 11:49 PM
Hi,
You need to use SELECT-OPTIONS for doing the same.
Please Follow the sample code given by Rich.
Regards,
Hakim
2007 Apr 10 4:58 AM
if you have defined parameter then you should fill the value ...
if you dont want to fill it make it select-option and if you restrict user to give only one value then use
tables : mara.
select-options : s_matnr for mara-matnr no-extension no intervals.
it will show only one input field now write your code
select single * form mara where matnr in s_matnr.
regards
shiba dutta
Message was edited by:
SHIBA DUTTA
2007 Apr 10 5:14 PM
Thanks everybody!
I used the select-options/selction screen to do it.
Thanks again!
Best regards
Tobias