Skip to Content
-1
Sep 12, 2018 at 08:21 AM

Dynamic where clause with several conditions

1605 Views

Hi everybody,

I'm a newbie with dynamic programming and I need some help with an recent issue.

I'm trying to add a dynamic where clause to a select in this way,

DATA : tab(100) OCCURS 0 WITH HEADER LINE.

APPEND 'FIELD = FIELD1' TO tab.
APPEND ' AND ' TO tab.
APPEND 'FIELD TO FIELD2' TO tab.

SELECT SINGLE *
FROM (p_tabla)
INTO <struc>
WHERE (tab).

But it only works with one condition, if I add more than one I get a sy-subrc = 4.

Is there another way of adding several conditions statements to a "where" clause dynamically?

Thanks a lot!!