05-24-2006 1:27 PM
Hi,
I have to use pattern in select..where statment.
Required value(for select) I am passing from Parameter.
parameter: p_groupid like apqi-groupid.
Here in the selection screen, I can give any pattern like
GPC* or GPC or GPC* etc.....
Thease values should pass to the select.. where.
please let me know how can I do.
Thanks and Regards
Harish
05-24-2006 1:30 PM
You should use a SELECT-OPTION instead and make it look like a parameter.
Select-options: s_group for apqi-groupid <b>no intervals no-extension</b>.
*
*
select .....
where groupid in s_group.
Now you can enter such patterns in your selection screen and the select-option will handle all patterns.
Regards,
Rich Heilman
05-24-2006 1:31 PM
You can use pattern in the where clause as follows..
select fld1 fld2 from <dbtab>
into table itab
where ( groupid like 'GPC%' or
groupid like '%GPC%' or
groupid like '%G*PC%' or
groupid like '%G%P%C%' ).
regards,
Suresh Datti
05-24-2006 1:34 PM
Hi ,
You can use LIKE addition in the select statement.
In your case you can write in the where clause as
where p_groupid like %GPC% .
Just refer this link
http://help.sap.com/saphelp_nw04s/helpdata/en/fc/eb3a1f358411d1829f0000e829fbfe/content.htm
Regards,
SP.
05-24-2006 1:33 PM
Use the LIKE syntax in where:
DATA SCUSTOM_WA TYPE SCUSTOM.
SELECT ID NAME FROM SCUSTOM
INTO CORRESPONDING FIELDS OF SCUSTOM_WA
WHERE NAME LIKE 'M%'.
WRITE: / SCUSTOM_WA-ID, SCUSTOM_WA-NAME.
ENDSELECT.
Example to select all customers whose name contains 'huber':
DATA SCUSTOM_WA TYPE SCUSTOM.
SELECT ID NAME FROM SCUSTOM
INTO CORRESPONDING FIELDS OF SCUSTOM_WA
WHERE NAME LIKE '%huber%'.
WRITE: / SCUSTOM_WA-ID, SCUSTOM_WA-NAME.
ENDSELECT.
Example to select all customers whose name does not contain 'n' as the second character:
DATA SCUSTOM_WA TYPE SCUSTOM.
SELECT ID NAME FROM SCUSTOM
INTO CORRESPONDING FIELDS OF SCUSTOM_WA
WHERE NAME NOT LIKE '_n%'.
WRITE: / SCUSTOM_WA-ID, SCUSTOM_WA-NAME.
ENDSELECT.
REgards,
Ravi
05-24-2006 1:38 PM
Hi,
you need to use like option in where clause. and where ever you have * replace it with %
some thing like this..
GPC* you can use like 'GPC%'
or like '%GPC%'...etc.
in your where clause.
Regards
vijay