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

simple logic

Former Member
0 Likes
511

hi,

its an error if the variable x does not lie in a set of numbers like,

ie, x must be in between 8000 to 8500 or 9000 and 9500

or 10000 and 10500 etc this way there are a 6 set of ranges.

so can any one help how to do this,

i thought of doing like this:

if not ( 8000 < x < 8500 ).

if not ( 8000 < x < 8500 ).

if not ( 9000 < x < 9500 ).

if not ( 10000 < x < 10500 ).

if not ( 11000 < x < 11500 ).

if not ( 12000 < x < 12500 ).

e_flag = 1.

endif.

endif.

endif.

endif.

endif.

endif.

but i doubt will it work, dont know, can some one suggest a proffessional way.

thank you.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
481

IF NOT

( ( 8000 < x < 8500 ) OR

( 9000 < x < 9500 ) OR

( 10000 < x < 10500 ) OR

( 11000 < x < 11500 ) OR

( 12000 < x < 12500 ) ).

e_flag = 1. "<-----X does not fall in any of the range specified. This is a Error Case.

ENDIF.

Regards,

A.Singh.

4 REPLIES 4
Read only

Former Member
0 Likes
481

hi,

ranges : r_value for i.

r_value-low = 8000.

r_value-high = 8500.

append r_value.

repeat this for all set of values.

if not x in r_value.

your logic.

endif.

thanks

Mahesh

Message was edited by:

I Can Solve It

Read only

Former Member
0 Likes
481

data : begin of x_range,

SIGN TYPE DDSIGN ,

OPTION TYPE DDOPTION,

low type i,

high type i,

end of x_range.

ranges : r_value for i.

x_value-low = 8000.

x_value-high = 8500.

x_value-opt = 'E'.

x_value-sigh = 'BT'

append x_range to r_value.

repeat this for all set of values.

if not x in r_value.

your logic.

endif.

Message was edited by:

I Can Solve It

Message was edited by:

I Can Solve It

Read only

Former Member
0 Likes
482

IF NOT

( ( 8000 < x < 8500 ) OR

( 9000 < x < 9500 ) OR

( 10000 < x < 10500 ) OR

( 11000 < x < 11500 ) OR

( 12000 < x < 12500 ) ).

e_flag = 1. "<-----X does not fall in any of the range specified. This is a Error Case.

ENDIF.

Regards,

A.Singh.

Read only

marcelo_ramos1
SAP Mentor
SAP Mentor
0 Likes
481

Hi,

Try this way.

IF NOT ( INT >= 8000 AND INT <= 8500 ) AND

NOT ( INT >= 10000 AND INT <= 10500 ) AND

NOT ( INT >= 11000 AND INT <= 11500 ) AND

NOT ( INT >= 12000 AND INT <= 12500 ).

...

ENDIF.

Regards.

Marcelo Ramos