Skip to Content
0
Jun 14, 2011 at 08:20 AM

Dump in dynamic where codition:Value field with LIKE operator is not type C

50 Views

Hi Forum,

The requierment is to select data from a Z table based on few fields.

There are four fields in where condtion and all four can have wild character search i.e. ***

Interface of the FM:

Import Parameters:

IV_VZID TYPE CHAR35

IV_FNAME TYPE CHAR40

IV_LNAME TYPE CHAR40

IV_MNAME TYPE CHAR40

Source Code:

DATA condition(200) TYPE C .

  IF iv_vzid IS NOT INITIAL.
    REPLACE ALL OCCURRENCES OF '*' IN iv_vzid WITH '%'.
    CONCATENATE 'vzid like' iv_vzid INTO condition SEPARATED BY space.    
  ENDIF.
  IF iv_fname IS NOT INITIAL.
    REPLACE ALL OCCURRENCES OF '*' IN iv_fname WITH '%'.
    CONCATENATE 'sn like' iv_fname INTO condition SEPARATED BY space.
  ENDIF.
  IF iv_lname IS NOT INITIAL.
    REPLACE ALL OCCURRENCES OF '*' IN iv_lname WITH '%'.
    CONCATENATE 'givenname like' iv_lname INTO condition SEPARATED BY space.
  ENDIF.
  IF iv_mname IS NOT INITIAL.
    REPLACE ALL OCCURRENCES OF '*' IN iv_mname WITH '%'.
    CONCATENATE 'bamiddleinitial like' iv_mname INTO condition SEPARATED BY space.
  ENDIF.

  SELECT
  vzid
  sn
  givenname
  bamiddleinitial
  telephonenumber
  title
  FROM
  zfl_ldap_feed
  INTO TABLE et_ldapusers
  WHERE (condition) .

Gettign the below dump when I execute the query:

Error analysis

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was

not caught in

procedure "Z_SRM_GET_LDAP_DATA" "(FUNCTION)", nor was it propagated by a

RAISING clause.

Since the caller of the procedure could not have anticipated that the

exception would occur, the current program is terminated.

The reason for the exception is:

The value field "V475436" referenced with a LIKE operator in the WHERE

clause of an Open SQL statement is not type C.

Types other than C are not allowed.

What changes are required to execute this dynamic select query?

Thanks,

Anubhav