Application Development 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: 

Regarding Ranges...

Former Member
0 Kudos

Hi all,

I need to check whether a key is not equal to invoice (this has 8 different values like r1, r2, 77 etc) or payment (this has 3 different values like 05,06 etc...)...

If the above condition is correct then message 1 is passed else message 2 is passed.

Now the issue is if i want i can chek them using if statement but that is gonna turn out very lengthy... that is i will chek key is not equal to inv. 1 and not equal to inv.2 etc....and then with the payment values...

can anyone plz suggest some shorter way and preferably with a piece of code...thanx in advance

rakesh

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You can create a <b>range</b> and fill with all the possible invoice values and then you can do something like this :

search <range> for <key>

if sy-subrc eq 0.

*value is present

else.

*value is not present

endif.

6 REPLIES 6

Former Member
0 Kudos

You can create a <b>range</b> and fill with all the possible invoice values and then you can do something like this :

search <range> for <key>

if sy-subrc eq 0.

*value is present

else.

*value is not present

endif.

0 Kudos

hi,

or put your parametrs to compare in customizing table,

do a select single or read table and anayse sy-subrc.

A.

0 Kudos

CAN U HELP ME WITH A CODE PLZ AND YES HOW TO CREATE A RANGE FOR VALUES WHICH ARE NOT EVEN THAT IS SOME ARE '76' SOME ARE 'R1' SOME ARE 'RA'....

0 Kudos

you can do something like this :

ranges : r_value for selopt-low

*fill the values

r_value-sign = 'I'.

r-value-option = 'EQ'.

r_value-low = '76'.

append r_value.

*Similarly fill other values

now search the range

search r_value for <key value>

if sy-subrc eq 0.

*do something.

else.

*do something.

endif.

0 Kudos

thanx very much

0 Kudos

Hi,

Create a variant in table TVARVC.

For that varibale enter ur invoice values as single in that select-options tab.

create a ranges table in ur prog like

DATA : y_r_ff LIKE RANGE OF vbak-auart WITH HEADER LINE.

if field in y_r_ff.

Mss 1.

else.

mss2

endif.

REgards,

kishore.