Register Login

Dynamic fields in Select statement

Updated May 18, 2018

First, declare an internal table with a single text field

example:

DATA: BEGIN OF GT_CONDITION OCCURS 0,
LINE(600),
END OF GT_CONDITION.

Then insert or concatenate in the table the conditions as a text
For example:
gt_condition-line = 'mandt eq '000''.
append gt_condition.

Note: In order to insert the quotations in the field, you'll need to do something like this:

concatenate 'mandt eq' '''' '000' '''' into gt_condition-line.

And the selection can be done as follows:

select * from table where (gt_condition).

endselect.


×