Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to compare data using dynamic operators

Former Member
0 Likes
765

Hello,

actually I have a problem in making my code more dynamic. I have a control table, which contains several conditions.

e.g. if seize > 50, or if seize >50 etc.

Now I want to use this table to compare transcational. However I could not find a way to replace the mathematical operator dynamically:

if a > zseize.

a = 1.

endif.

However I want to replace the operator > using another variable e.g.

if a variable_operator zseize.

Any idea?

Thank You

Goliad001

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
603

Try to fill a TYPE RANGE internal table with your criteria, and use a IN range in your check.

CLEAR ls_range.
REFRESH lt_range.
ls_range-sign = 'I'.
ls_range-option = zoperator. " e.g. 'GT' or 'NE'
ls_range-low = zseize. "
APPEND ls_range TO lt_range.
*  (...)
IF a IN lt_range.
  a = 1.
ENDIF.

Regards,

Raymond

2 REPLIES 2
Read only

RaymondGiuseppi
Active Contributor
0 Likes
604

Try to fill a TYPE RANGE internal table with your criteria, and use a IN range in your check.

CLEAR ls_range.
REFRESH lt_range.
ls_range-sign = 'I'.
ls_range-option = zoperator. " e.g. 'GT' or 'NE'
ls_range-low = zseize. "
APPEND ls_range TO lt_range.
*  (...)
IF a IN lt_range.
  a = 1.
ENDIF.

Regards,

Raymond

Read only

0 Likes
603

thank you, that is what I was looking for. I will try it....

Regards

Goliad001