Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Help with search in string

HI,

i have a program that do search for string in some table in text field ,and the program is running OK when the user do search for one word in string.

the problem is when i do search for <b>2 or more</b> word despite that i have them in table the search is not successful. (nothing found).

e.g.

if i search word <u>Public</u> i get in ser_tab :

Public

Public Health

Public Accountants

...

but if id the search for :Public Health

i dont get anything

how i can solve this problem?

this is the code

"ql_text is the input field for the user 
 CONCATENATE '%' ql_text '%'    INTO v_pattern.  

  SELECT qualifictn txtmd
  FROM /bi0/tqualifictn
  INTO TABLE ser_tab
  WHERE langu = sy-langu
  AND  txtmd LIKE v_pattern 
  AND datefrom LE sy-datum
  AND dateto GE sy-datum.

Regards

Tags:
Former Member
replied

Hi,

Interesting question ... please try this.

DATA: INPUT(25) VALUE 'Our Team Management'.
                                                                        
DATA: CURRENT_CHAR(1)  TYPE C,
      TOTAL_LEN        TYPE I,
      CURRENT_POSITION TYPE I.
                                                                        
DATA: FLAG(1).
                                                                        
WRITE: / INPUT(1).
TRANSLATE INPUT TO LOWER CASE.

TOTAL_LEN = STRLEN( INPUT ).
CURRENT_POSITION = 1.
                                                                        
WHILE CURRENT_POSITION < TOTAL_LEN.
  CURRENT_CHAR = INPUT+CURRENT_POSITION(1).
                                                                        
  IF FLAG = 'X'.
    CLEAR FLAG.
    TRANSLATE  CURRENT_CHAR TO UPPER CASE.
    WRITE: / CURRENT_CHAR.
  ENDIF.
                                                                        
  IF CURRENT_CHAR EQ SPACE.
    FLAG = 'X'.
  ENDIF.
                                                                        
  ADD 1 TO CURRENT_POSITION.
ENDWHILE.

Regards,

Ferry Lianto

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question