Dynamic WHERE Clause in ABAP/4

You can apply internal table for create dynamic where clauses.

Example

DATA i_where(100) OCCURS 0 WITH HEADER LINE.
APPEND ’vbeln LIKE ’’%1’’’ to i_where.
APPEND ’matnr LIKE ’’%M’’’ to i_where.

TABLE lips.
DATA i_lips TYPE TABLE OF lips WITH HEADER LINE.
SELECT * FROM lips INTO TABLE i_lips
    WHERE werks = ’1000’
        AND (i_where).

Above Example is look like:


TABLE lips.
DATA i_lips TYPE TABLE OF lips WITH HEADER LINE.
SELECT * FROM lips INTO TABLE i_lips
    WHERE werks = ’1000’
    AND vbeln LIKE ’%1’
        AND matnr LIKE ’%M’.

Post new comment