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

former_member206396
Active Participant
0 Likes
1,174

hai check this,

data : g type i.

select-options: s_x type g.

Question is:

if i give s_x-low = 1 and s_x-high = 10.

i need output : 1 2 3 4 5 6 7 8 9 10...

could any one help me out pls..

thanking you,,

ramu

11 REPLIES 11
Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
1,141

Hi,

it should be like this..

data : g type i.

select-options: s_x for g.

data: x(2), y(2).

x = s_x-low .

y = s_x-high.

do y times.

if x <= y.

write: x.

x = x + 1.

endif.

enddo.

Cheers,

Simha.

Read only

Former Member
0 Likes
1,141

Hi,

I don't think the logic is valid. How do you know the interval is only 1 and NOT less than 1 or greater than. While using select options its only for mentioning the Min and Max value but not the interval.

And more over, usually you don't use SELECT-OPTIONS for a generic thing like this. It has to be referred to a field in the table. Then when you speicfy the min and max value, you can fetch all the values from the table that fall with in that range.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

0 Likes
1,141

suppose if u give some range can be 20 to 30 or 10 to 20

i need the sequence of numbers like 10 11....20

20 21,...30

Read only

0 Likes
1,141

Copy and paste this code and enter your range on the selection screen

REPORT ZTEST.

tables : SER03.

data : g type i,

h type i.

select-options: s_x for ser03-ANZSN.

g = s_x-high - s_x-low.

h = g + 1.

do h times.

write:/ s_x-low.

s_x-low = s_x-low + 1.

enddo.

Read only

dani_mn
Active Contributor
0 Likes
1,141

do s_x-high time.

write:/ sy-index.

enddo.

Regards,

Wasim Ahmed

Read only

Former Member
0 Likes
1,141

Hi Rama,

data : g type i.

select-options: s_x type g.

You cannot write 'type g' with select-options you have to take 'for' with the select options.

For your requirement copy and paste this piece of code.

REPORT ZTEST.

tables : SER03.

data : g type i.

select-options: s_x for ser03-ANZSN.

s_x-low = '1'.

s_x-high = '10'.

append s_x.

do s_x-high times.

write:/ sy-index.

enddo.

Message was edited by: mukesh kumar

Read only

Former Member
0 Likes
1,141

Hi Rama,

Do it in this way.


REPORT zztest.

DATA :  g    TYPE i,
        temp TYPE i.
SELECT-OPTIONS : s_x FOR g.


START-OF-SELECTION.

  s_x-sign   = 'I'.
  s_x-option = 'BT'.
  s_x-low    =  '1'.
  s_x-high   =  '10'.


  temp = s_x-high - s_x-low.
  temp = temp + 1.
  DO temp TIMES.


    WRITE / sy-index.

  ENDDO.

Reagards,

Arun Sambargi.

Read only

Former Member
0 Likes
1,141

Hi Rama,

This one is Dynamic. You can specify any range in your SELECT-OPTIONS (10-20, it will give 10 11 12 13..20).

If nothing is specified in SELECT-OPTIONS it will take the default value (1-10).


REPORT zztest.

DATA :  g    TYPE i,
        temp TYPE i,
        var  TYPE i.
SELECT-OPTIONS : s_x FOR g.


START-OF-SELECTION.

  s_x-sign   = 'I'.
  s_x-option = 'BT'.

  IF  s_x-low IS INITIAL.
    s_x-low    =  '1'.
  ENDIF.

  IF  s_x-high  IS INITIAL.
    s_x-high   =  '10'.
  ENDIF.
  s_x-low = s_x-low - 1.
  temp = s_x-high - s_x-low.

  DO temp TIMES.

    var = sy-index + s_x-low.
    WRITE / VAR.
    CLEAR var.
  ENDDO.

Regards,

Arun Sambargi.

Read only

Former Member
0 Likes
1,141

Hi Rama,

Can check out the following code :-

  • Data declaration.

data : g type i,

range type i,

num type i.

select-options: s_x for G.

RANGE = S_X-high - s_x-low.

range = range + 1.

num = s_x-low.

do range times.

write:/ num.

num = num + 1.

enddo.

Hope this helps you.

Cheers,

Anirban.

Read only

Former Member
0 Likes
1,141

hai ramu thnaks veru much

i got the correct out put

avu nu ramu i want to watch any reply(to me) from others how i can watch ...

i got one document that is to my mail so i want to check in the sdn forums how i can

..

here there is so inbox(like yahoo)how i can check

Read only

Former Member
0 Likes
1,141

Hai Rama Krishna

check the following Code

DATA : g TYPE i,

temp TYPE i value 0.

SELECT-OPTIONS : s_x FOR g.

INITIALIZATION.

s_x-sign = 'I'.

s_x-option = 'BT'.

s_x-low = '1'.

s_x-high = '10'.

append s_x.

START-OF-SELECTION.

do s_x-high times.

temp = temp + 1.

write : temp.

enddo.

Regards

Sreeni