10-21-2015 8:39 AM
Say,
In a database table I have a field named "site" which contains the following records.
972
345
240
950
so there are four entries.
Now my parameter is
SELECT-OPTIONS: s_site FOR string NO INTERVALS.
If I give the input as only asterisk
i.e. s_site = *
then all the records must display.
on the other hand if I give the input like this,
i.e. s_site = 9*
then it must display all the records starting with 9
In this case the answer must be: 972 and 950.
Can someone help me with the logic or syntax please.
10-21-2015 8:46 AM
Hi, will be handled automatically by the WHERE condition of the SELECT statement.
Try this: SELECT * FROM dbtable WHERE site IN s_site.
10-21-2015 8:46 AM
Hi, will be handled automatically by the WHERE condition of the SELECT statement.
Try this: SELECT * FROM dbtable WHERE site IN s_site.
10-21-2015 9:08 AM
10-21-2015 9:30 AM
Exactly,
the way Michael says is perfect, SAP handles it on its own.
you can actually check the same in debug by looking at the table s_site and the value in field OPTIONS
10-21-2015 9:38 AM
10-21-2015 9:46 AM
Hi,
run the following code..
both the logics mentioned above are working fine,.
select-option internal table OPTION field will have value 'CP' i.e contain pattern
REPORT ZTEST.
TABLES:MARA.
DATA: IT_FLIGHT TYPE TABLE OF MARA.
DATA: IT_FLIGHT1 TYPE TABLE OF MARA.
SELECT-OPTIONS: S_MTART FOR MARA-MTART NO INTERVALS NO-EXTENSION.
PARAMETERS: P_MTART TYPE MARA-MTART.
TRANSLATE P_MTART TO UPPER CASE.
REPLACE ALL OCCURRENCES OF '*' IN P_MTART WITH '%'.
case 1: for select options
SELECT * FROM MARA
INTO TABLE IT_FLIGHT UP TO 10 ROWS
*WHERE MTART LIKE SVAR.
WHERE MTART IN S_MTART.
case 2 for parameters
SELECT * FROM MARA
INTO TABLE IT_FLIGHT1 UP TO 10 ROWS
WHERE MTART LIKE P_MTART.
BREAK-POINT.
thanks!!