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

Problem using keyword RANGES

Former Member
0 Likes
693

Hi All!

I am coding as below to do some validations :

RANGES : r_uname FOR syst-uname.

r_uname-low = 'xxxxxx'.

r_uname-sign = 'I'.

r_uname-option = 'EQ'.

APPEND r_uname.

CLEAR r_uname.

r_uname-low = 'yyyyy'.

r_uname-sign = 'I'.

r_uname-option = 'EQ'.

APPEND r_uname.

CLEAR r_uname.

IF sy-uname NOT IN r_uname.

But the if condition is not validating the values in r_uname. What I see is that sy-uname is a structure and r_uname is a Internal Table without a header line because of which the if condition is not validating .Any better coding to get this functionality.

Regards

Praneeth

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
671

I guess this is used for validation purpose, please try with :

CHECK: NOT SY-UNAME IN R_UNAME.

Kind Regards

Eswar

5 REPLIES 5
Read only

Former Member
0 Likes
672

I guess this is used for validation purpose, please try with :

CHECK: NOT SY-UNAME IN R_UNAME.

Kind Regards

Eswar

Read only

anversha_s
Active Contributor
0 Likes
671

Hi,

Chk A sample code.

Define a range:

Ranges: r_field for <table>.

if not field1 is initial.
r_field-sign = 'I'.
r_field-option = 'EQ'.
r_field-option-low = field1.
append r_field.
endif.

if not field2 is initial.
r_field-sign = 'I'.
r_field-option = 'EQ'.
r_field-option-low = field2.
append r_field.
endif.

if field1 is initial and field2 is initial.
r_field-sign = 'I'.
r_field-option = 'EQ'.
append r_field.
endif.

select * from <table> where field1 in r_field.

Regards

Anver

if hlped pls mark points

Read only

Former Member
0 Likes
671

Praneeth,

try giving r_uname-low values in CAPS and check.

AND

IF sy-uname NOT IN r_uname.

sholud be like <b>IF NOT sy-uname IN r_uname</b>.

-Anu

Message was edited by: Anupama Reddy

Read only

Former Member
0 Likes
671

You'd better clear your range work area before filling it in, not afterwards:

refresh r_uname.

clear r_uname.

..

append r_uname.

clear r_uname.

..

append r_uname.

Read only

Former Member
0 Likes
671

Hi,

Just make sure you enter the values in capitals.

and check like this:

IF sy-uname NOT IN r_uname[].