Skip to Content
0
Former Member
Jun 26, 2008 at 10:53 AM

Using 'Greater than/less than' in dynamic where condition

546 Views

Hi Guys,

I am trying to use a logical expression with GT/LT condition in dynamic where, butits giving dump "expression worngly parenthesised' . My query runs perfectly fine when the logical expression does not have 'GT/LT' . Is there a different way of using GT/LT in dynamic where or is it not posiible at all?? Please find my query below -

IF vendor IS NOT INITIAL.

i_where_clause = 'a~lifnr = vendor'.

APPEND i_where_clause.

CLEAR i_where_clause.

ENDIF.

IF to_date IS NOT INITIAL.

i_where_clause = 'a~zzearliestdep LT to_date'.

APPEND i_where_clause.

CLEAR i_where_clause.

ENDIF.

IF from_date IS NOT INITIAL.

i_where_clause = 'a~zzlatestdep GT from_date'.

APPEND i_where_clause.

CLEAR i_where_clause.

ENDIF.

SELECT aebeln alifnr azzearliestdep azzlatestdep

bebelp belikz b~kzabs

INTO CORRESPONDING FIELDS OF TABLE i_podetails

UP TO max_hits ROWS

FROM ( ekko AS a INNER JOIN ekpo AS b

ON aebeln = bebeln )

WHERE a~ebeln = ebeln AND

(i_where_clause).