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

Multiple criteria for Case statement

Former Member
0 Likes
3,291

Hello there,

I have a code segment that would do something if one of about 40 criteria is returns true. I know that in Case statement, you can write as When...or...or...or...and so on but I am really hoping to find a better way (say for example, using internal table) or something so that my statement does not appears to be so long (imagine you have to hard-code in 40 criteria!) Could anyone help me with that? Thanks a lot!

Regards,

anyi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,792

Hi,

If all the case statement has the piece of code...or atlease some of them have the same piece of code..Use RANGES...and group them together...

Thanks,

Naren

3 REPLIES 3
Read only

Former Member
0 Likes
1,792

store all ur cases to one internal table with one field named <b>CASE</b>

then..

loop at itab.
 case itab-<b>case</b>.
 endcase.
endloop

Read only

0 Likes
1,792

I am having a similar issue. I don't quite fully understand the idea of using a itab, case, which has all my values. Can you please clairify..perhaps a sample piece of code?

Thanks,

Read only

Former Member
0 Likes
1,793

Hi,

If all the case statement has the piece of code...or atlease some of them have the same piece of code..Use RANGES...and group them together...

Thanks,

Naren