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: 

Looping in select-options

Former Member
0 Kudos

Hi,

I have field (mnt) in select-options.

Now i want to loop through this mnt field . How to do that?

13 REPLIES 13

Former Member
0 Kudos

hi,

loop at s_mnt.

endloop.

regards,

madhumitha

Former Member
0 Kudos

Hi,

The select option field itself is a table.

loop at <s_field>.

....

...

endloop.

0 Kudos

ya select-option itselfis a table but when i use this

loop at mnt

endloop.

it reads only first entry and then exits from the loop.

0 Kudos

hi,

if u give only one value in the selection screen, it will process only one record.

if u give a range it will have 2 values. low and high. it will not populate with all the values between the range into the select-option field.

regards,

madhumitha

0 Kudos

@madhumita, in mnt i am giving the 1 to 3.

It takes only 1. but i want to loop through 2 and 3 also.

0 Kudos

hi,

s_mnt-low will have 1

s_mnt- high will have 3.

if u loop it will have only one record. it will not have all the vale between 1 and 3.

when u fetch the data it will use between operator to fetch all the data between 1 and 3.

to understand better:

try this..put a break point in loop at s_matnr.

tables: mara.
select-options: s_matnr for mara-matnr.

loop at s_matnr.
write:/ s_matnr-low.

endloop.

regards,

madhumitha

Former Member
0 Kudos

Hi,

Could you give more details of your problem ?

Former Member
0 Kudos

If U have values only in low .. then

loop at mnt.

  • use mnt-low ...

endloop.

Former Member
0 Kudos

Hi,

take the value of select option into an internal table and loop it.

wa_itab = s_kna1-low.

append wa_itab to it_itab.

loop at it_itab into wa_itab.

...

...

endloop.

thanks & regards

Kishore Kumar Maram

Former Member
0 Kudos

Hello Anurodh-

Select-option is an internal table with header line you can loop an internal table let me know the exact requirement.

Cheers,

~Srini....

Former Member
0 Kudos

loop the select option is littel difficut because

when ur looping iti hav to also take to consideration

that if u r select option is in range then it might hav a bplm

supoose ur using vbeln for vbak-vbeln

and ur entering the high and lower limit

i.e vbeln- high and vbeln-low then loop can have a ploblem

itz better in above example

use

+*begin of itvbeln occurs 0,*+_

vbeln type vbeln,

+*end of itvbeln.*+_

selet vbeln from vbak into corressponding field of

+*itvbeln where vbeln in vbeln.*+_

den it might solve ur pblm

it totally depend upon ur program

i might change as depending upon what ur taking as select-option

With Regards

Rohan Shetty

0 Kudos

Is there any other way so that i acn transfer the data ( in MNT ) into internal table and then loop ino that table.?

Former Member
0 Kudos

Hi

Select-option is like a internal table

loop at selection screen .

the logic.

End loop.