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

Read values from SELECT-OPTIONS

Former Member
0 Likes
19,405

Please don't have a subject in ALL CAPITALS. I've changed it for you this time.

Hi,

I want to read values in a select-options one by one because I need to pass all the data between low and high.

Thanks a lot.

Sandra.

Edited by: Matt on Mar 17, 2009 11:10 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
10,347

The select-options is for a date so I don't know which table I can use, but thank you all!

14 REPLIES 14
Read only

Former Member
0 Likes
10,347
  • Select option is just like internal table. so as u read itab u can also read it

loop at select_option name.
read select option name index sy-tabix.
endloop.

Edited by: tahir naqqash on Mar 17, 2009 3:10 PM

Read only

Former Member
0 Likes
10,347

If u want to use select statement with slect option specify the condition in where as IN s_option it will work for each value seperately,

If u want sinle values one by loop at it.

try like this.


data: wa like line of s_options.

loop at s_options into wa.

"use wa value here wa-low but this will only give values of multiple selection 
"to get values between low and high use *IN*
endloop.

кu03B1ятu03B9к

Edited by: kartik tarla on Mar 17, 2009 3:42 PM

Edited by: kartik tarla on Mar 17, 2009 3:42 PM

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
10,347

Ex:

Loop at so_date.

date1 = so_date-low.

endloop.

if u need the other interval. then so_date-high.

Read only

matt
Active Contributor
0 Likes
10,347

Select options don't contain the values one by one. So, you have to do a select from the appropriate table. So, if your select options is for MATNR, then you'd have to do

SELECT matnr FROM mara INTO TABLE lt_matnr WHERE matnr IN s_matnr.

matt

Read only

Former Member
0 Likes
10,347

I know that, but in that internal table I only have low and high and I want to pass all values between them.

Thanks.

Read only

0 Likes
10,347

then use

select * from pa0001
where
 pernr in sel_option.
" When u use IN SEL_OPTION , it will consider all values in select option

.

Edited by: tahir naqqash on Mar 17, 2009 3:17 PM

Read only

0 Likes
10,347

i think u need to loop and check values between do endo.

like


v_var = s_option-low.
DO.

"use v_var.
"increment it.
if v_var > s_option-high.
exit.
else.
"use the value
endif.
enddo.

кu03B1ятu03B9к

Edited by: kartik tarla on Mar 17, 2009 3:46 PM

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
10,347

Hi,

When you use statement:


SELECT-OPTIONS : s_datum FOR sy-datum.

Then this creates an internal table s_datum with four fields sign, option, low, high.

So if you write

low value as:

sy-datum - 4

and high value as:

sy-datum

Then a single row is appended to s_datum as:

sign : I

option : BT

low value : sy-datum - 4

high value : sy-datum

So it will automatically take all values between the low and high values.

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
10,348

The select-options is for a date so I don't know which table I can use, but thank you all!

Read only

matt
Active Contributor
10,347

>

> The select-options is for a date so I don't know which table I can use, but thank you all!

You can't use a table. Do it like this:

l_dat = s_dat-low.
WHILE l_dat LE s_dat-high.
  WRITE / l_dat.
  ADD 1 TO l_dat.
ENDWHILE

However, if the user decides to use a pattern, or exclusions, it can get problematic. Usually, therefore, for date selections, I use two parameters - one for the start date, one for the end, rather than select-options.

matt

Read only

sarbajitm
Contributor
10,347

SELECT-OPTIONS system implicitly creates the select options internal table which contains the fields of SIGN,OPTION,LOW & HIGH.

Read only

former_member203501
Active Contributor
0 Likes
10,347

hi look at this post ....here is your answer

i got it by searching in the forum.....please search before posting a question.

Read only

sarbajitm
Contributor
0 Likes
10,347

Select-options: s_date for sy-datum.

data: cnt type i,

diff type i,

G_date type sy-datum.

diff = s_date-high - s_date-low

do diff times.

G_date = s_date-low + cnt.

write: / G_date.

cnt = cnt + 1.

endloop.

Read only

RoySayak
Active Participant
0 Likes
10,347

Hi Sandra,

You can't use a table for date select-options.

Best Regards,

Sayak