Skip to Content
0
Apr 16, 2010 at 01:38 PM

Conditional statement - evaluate a condition stored in a string

637 Views

Hi gurus,

I have a dynamically build structure which is a table that has just a field (type WHERETXT).

As example of run leads to the following result (numbers on the left represents the row of the table)

1 (

2 PARAMETER = '10'

3 OR

4 PARAMETER = '30'

5 )

Such a table, call it wherecond[], could be used successfully in a SELECT statement in this way:

SELECT foo INTO bar

FROM DBtab

WHERE (wherecond).

Now; i'd like to use the SAME wherecond[] to buid a dynamic IF statement.

But:

IF (wherecond)

leads to a syntactical error: "Incorrect logical expression: "(wherecond)" : After "(" a white space was expected.

Then spacing as suggested::

IF ( wherecond )

I get the following error: "Relational operator ")" is not supported.

Tried then to "unroll" the itab into a flat string variable, but I get the same syntax error. Sound really strange; could this be related to the fact this is an old system (SAP_APPL 470 ) ? How can I workaround this?

Thanks in advance.