08-30-2007 12:12 PM
Hi all,
Is there a way to check if a dynamically built logical expression is true or false? For example, I have two values val_1 and val_2 in a table, and a logical operator also stored in my table, how do I check ( val_1 <operator> val_2 ) at run time?
I tried to concatenate this into a string and check but it does not work. Any ideas?
Thanks,
Nithya
08-30-2007 12:30 PM
08-30-2007 12:16 PM
hI,
Move the same thing to the Field symbol instead of a string, then you can check this field symbol value to that table
Regards
Sudheer
08-30-2007 12:21 PM
Hi Sudheer,
In this case, the operator itself will be picked up from a table at runtime only. So the complete expression has to be built at run time. I have a table that has the operator and threshold value to check against. When the user enters a particular value, this check has to be done. Any input?
Regards
Nithya
08-30-2007 12:23 PM
Hi,
Is it an internal table or database table ?...and will the user make an entry in the selection screen or is it in the program excution that happens ?
Thanks..
Preetham S
08-30-2007 12:25 PM
Hi Nithya,
Are all the three variables in a single line of the internal table - in three different columns
LOOP AT <itab> INTO <wa>.
IF <wa>-fld1 <wa>-comp <wa>-fld2.
ENDIF.
CLEAR: <wa>.
ENDLOOP.
This works i think.
08-30-2007 12:30 PM
08-30-2007 12:47 PM
You can try Defining a Macro or do it by Ranges:
<b>If you want to use a Macro, Try something like this:</b>
DATA: t_t001 TYPE t001 OCCURS 0 WITH HEADER LINE.
DEFINE my_dynamic_check.
if &1 &2 &3.
write:/ 'Success'.
else.
write:/ 'Failed'.
endif.
END-OF-DEFINITION.
SELECT * FROM t001 INTO TABLE t_t001.
LOOP AT t_t001.
my_dynamic_check t_t001-bukrs eq 'US01'. "US01 can be replaced by a company code in table T001
ENDLOOP.
<b>Or if You want to use Ranges:</b>
ranges: r_datum for sy-datum.
r_datum-sign = 'I'.
r_datum-option = 'EQ'.
r_datum-low = sy-datum.
apppend r_datum.
If sy-datum in r_datum.
Endif.
Thanks, Ankur
Award if the info is useful
Message was edited by:
ankur malhotra