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

select options reading

Former Member
0 Likes
779

hai gurus can any one tell me how to read the values from a select-option

for example i use select options for customer number between 1 to 100

i want to print each value given on options based on sign and option

for ex if i give i bt 1 to 100

then it should print the values from 1 to 100

if i use e then it should print 2 to 99 and so on

regards

afzal

1 ACCEPTED SOLUTION
Read only

varma_narayana
Active Contributor
0 Likes
754

Hi Afzal..

This is the Code..

SELECT-OPTIONS : S_DATE FOR SY-DATUM.

start-of-selection.

LOOP AT S_DATE.

CASE S_DATE-OPTION

WHEN 'BT'.

Write:/ 'From ' , s_date-low , 'To ', s_date-High.

WHEN 'NB'.

WHEN 'EQ'.

Write:/ 'Equals to ' , s_date-low .

ENDCASE.

ENDLOOP.

<b>reward if Helpful.</b>

6 REPLIES 6
Read only

varma_narayana
Active Contributor
0 Likes
755

Hi Afzal..

This is the Code..

SELECT-OPTIONS : S_DATE FOR SY-DATUM.

start-of-selection.

LOOP AT S_DATE.

CASE S_DATE-OPTION

WHEN 'BT'.

Write:/ 'From ' , s_date-low , 'To ', s_date-High.

WHEN 'NB'.

WHEN 'EQ'.

Write:/ 'Equals to ' , s_date-low .

ENDCASE.

ENDLOOP.

<b>reward if Helpful.</b>

Read only

Former Member
0 Likes
754

Hi afzal,

By entering values in the select option, you are not fetching anything from the database?

Let me know if you are not fetching anything from the database table.

Read only

former_member194797
Active Contributor
0 Likes
754

Be careful: E BT 1 100 will not take interval 1-100 excluding the limits 1 and 100. It will take all the values which ARE NOT in this interval, i.e. all values lower than 1 or greater than 100.

Read only

Former Member
0 Likes
754

Hi,

You can use the below code :

tables : bsis.

data : count type i.

select-OPTIONS : num for bsis-buzei.

INITIALIZATION.

count = 1.

start-of-SELECTION.

do num-high times.

if count = 1.
  count = num-low.
  write : / count.
  count = count + 1.
else.
  write : / count.
  count = count + 1.
endif.

if count GT num-high.
 exit.
ENDIF.


enddo.

if num-high is initial.
write :/ num-low.
endif.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
754

Hey Afzal,

If you just want to print the numbers entered in the Select-options, I would use a Select statement to fetch those values from the Customer Master table and then print...


Report ztest.

TABLES: kna1.

SELECT-OPTIONS: s_kunnr FOR kna1-kunnr.

TYPES: BEGIN OF i_kunnr,
        kunnr TYPE kna1-kunnr,
       END OF i_kunnr.

DATA: i_kunnr TYPE STANDARD TABLE OF i_kunnr,
      wa_kunnr LIKE LINE OF i_kunnr.

START-OF-SELECTION.

SELECT kunnr FROM kna1 INTO TABLE i_kunnr
                       WHERE kunnr IN s_kunnr.

LOOP at i_kunnr INTO wa_kunnr.
  WRITE: / wa_kunnr.
  CLEAR wa_kunnr.
ENDLOOP.

Hope this helps.

Regards,

Vivek

Read only

Former Member
0 Likes
754

HI,

sign E mean not only excluding the first and last values.it will exclude the range from low value to high value.

rgds,

bharat.