05-30-2007 7:11 AM
Hi Experts,
I have an input field P_USERALIAS.This value could contain the actual value or the wildcard for example : user can enter P_USERALIAS as SAP123 or S or SAPABC123 . I need to generate a dynamic search on table USREFUS depending on what has been entered.Please help.
Useful answers will be rewarded.
Regards,
Shrita Sharma.
05-30-2007 7:16 AM
Hi,
1.
Create a Dummy selection options & hide it on the selection screen using NO Display
fill this with
SIGN = I
OPTION = CP
LOW = WHTEVER
2.
Use LIKE in the where claues
LIKE '%WHATEVER%;
LIKE will cause a performance issue
05-30-2007 7:15 AM
you have to use like option and instead of * you have to use %.
like
select < field > from <dbtab> into <itab> where < field1> like 'SAP%123'.
regards
shiba dutta
05-30-2007 7:16 AM
Hi,
1.
Create a Dummy selection options & hide it on the selection screen using NO Display
fill this with
SIGN = I
OPTION = CP
LOW = WHTEVER
2.
Use LIKE in the where claues
LIKE '%WHATEVER%;
LIKE will cause a performance issue
05-30-2007 7:48 AM
THIS IS A TEST REPORT FOR WILDCARD SEARCH**
TABLES: USREFUS.
PARAMETERS: P_NAME1 TYPE string.
RANGES: R_NAME1 FOR USREFUS-USERALIAS.
DATA: T_usrefus LIKE usrefus OCCURS 0 WITH HEADER LINE.
*replace
if p_name1 cs '*'.
replace all occurrences of '*' in p_name1 with '%'.
SELECT * FROM usrefus
INTO TABLE T_usrefus
WHERE useralias like P_NAME1.
else.
SELECT * FROM usrefus
INTO TABLE T_usrefus
WHERE useralias = p_name1.
endif.
LOOP AT T_usrefus.
WRITE: / T_usrefus-useralias.
ENDLOOP.
**THANKS & REGARDS
SHRITA SHARMA.