‎2009 Aug 18 11:46 AM
Hi,
I'm currently working on one of the search criteria to retrieve info from SAP DB. I would require wild card search for the characters and even numbers. Can any one please help me in this regards,
Ravi.
‎2009 Aug 18 11:57 AM
Hi,
for suppose you need wild card search parameter like
data:patient(10) type c.
search : a*
TRANSLATE patient TO UPPER CASE.
replace all occurrences of '*' in patient with '%'.
select a
b
c
into table itab
where A like patient.
Regards,
Ravi
‎2009 Aug 18 11:50 AM
Hi,
Can you please specify the query for which you want to use wild card characters ? Normally we use '%' sign for wild cards n ABAP.
KR Jaideep,
Edited by: Jaideep Sharma on Aug 18, 2009 4:20 PM
‎2009 Aug 18 11:53 AM
Hi,
To perform a wild card search, use the characters + and *.
+ will match any single character, and * will match any string of characters.
However, * can only be used as a wildcard at the beginning or end of a string.
Regards,
Shamma
‎2009 Aug 18 11:54 AM
If you want to have a wildcard in a where condition you only have the percentage sign, which will match by any character. So searching for L% will find all records starting with L.
‎2009 Aug 18 11:57 AM
Hi,
for suppose you need wild card search parameter like
data:patient(10) type c.
search : a*
TRANSLATE patient TO UPPER CASE.
replace all occurrences of '*' in patient with '%'.
select a
b
c
into table itab
where A like patient.
Regards,
Ravi
‎2009 Aug 18 11:58 AM
Hi,
With your queries, I think its possible to use just the wild card '%'.
Say N%, then it retrieves data starting with N
%N% retrieves data which has N anywhere in between
%N retrieves data ending with N.
‎2009 Oct 30 10:57 AM
Hi Ravi,
let us assume is_dsearch is structure consiting of required input fields,like fname,mname,dob,gender......
declare one variable for storing the dynaminc query based on inputs.
in my case it is lv_str type string.
IF NOT is_dsearch-fname IS INITIAL.
IF NOT lv_str IS INITIAL.
CONCATENATE lv_str 'AND' INTO lv_str SEPARATED BY space.
ENDIF.
TRANSLATE is_dsearch-fname TO UPPER CASE.
REPLACE ALL OCCURRENCES OF '*' IN is_dsearch-fname WITH '%'.
CONCATENATE lv_str 'name2 like IS_DSEARCH-fname' INTO lv_str SEPARATED BY space
ENDIF.
IF NOT is_dsearch-mname IS INITIAL. "if middle name is given
IF NOT lv_str IS INITIAL.
CONCATENATE lv_str 'AND' INTO lv_str SEPARATED BY space.
ENDIF.
TRANSLATE is_dsearch-mname TO UPPER CASE.
CONCATENATE is_dsearch-mname '%' INTO is_dsearch-mname. "for whild card search
REPLACE ALL OCCURRENCES OF '*' IN is_dsearch-mname WITH '%'.
CONCATENATE lv_str 'MID_NAME2 like IS_DSEARCH-mname' INTO lv_str SEPARATED BY space
ENDIF.
IF NOT is_dsearch-dob IS INITIAL. "if date of birth is given
IF NOT lv_str IS INITIAL.
CONCATENATE lv_str 'AND' INTO lv_str SEPARATED BY space.
ENDIF.
CONCATENATE lv_str 'date_of_birth eq IS_DSEARCH-dob' INTO lv_str SEPARATED BY space. "search based on date of birth
ENDIF.
like wise we need to write the code for preparing dynamic query for the rest fields too...
select x,y,z,k,l from ABC into table itab where ( lv_str).
Regards,
Ravi
‎2013 Feb 09 4:07 AM
Hi,
if i am working in Standard Field Matnr i am getting problem to provide Wildcard search by using * and ?........
* is automatically getting its sap already providing
? i dont have any idea to start this one
can any one help me this issue.
‎2010 Apr 07 6:50 AM
Hi Ravi,
To perform a wild card search, use the characters + and *.
+ will match any single character, and * will match any string of characters.
However, * can only be used as a wildcard at the beginning or end of a string.
With your queries, I think its possible to use just the wild card '%'.
Say N%, then it retrieves data starting with N.
%N% retrieves data which has N anywhere in between
%N retrieves data ending with N.
Regards,
Raj.