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: 

select-options

former_member206396
Active Participant
0 Kudos

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

Simha_
Employee
Employee
0 Kudos

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.

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

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.

dani_mn
Active Contributor
0 Kudos

do s_x-high time.

write:/ sy-index.

enddo.

Regards,

Wasim Ahmed

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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