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 Member
0 Likes
887

Hello,

If i have multiple options in select options field then how should i sort these values?

Consider values are numeric and need to be sorted in ascending order.Help me with code.

6 REPLIES 6
Read only

Former Member
0 Likes
666

Any specific reason why you want to sort the select options ?

regards,

Advait

Read only

0 Likes
666

I have to sort all values and take in to account the lowest one.

Read only

Former Member
0 Likes
666

Hello Nilam,

if you want to sort teh select options then do it in this way.


SELECT-OPTIONS; S_MATNR FOR MARA-MATNR.

START-OF-SELCTION.

SORT S_MATNR BY LOW.

I hope I could understand your requirement.

Thanks,

Chidanand

Read only

former_member156446
Active Contributor
0 Likes
666

Hi Nilam

Select options is also an internal table with structure sign,low, high etc...

as for itab you say sort table itab by f1 f2...

In the same way for so_matnr also sort table so_matnr by low(fied in select option's standard structure)

Read only

Former Member
0 Likes
666

HI Nilam ,

Select otion is as internal table which consist sign ,option , low , high ...filed ...

here is not the seris of data ...you could no do that ...

you can do one thing ....

select all you data in an internal table ...using

Select f1 from database table into table itab

where f1 in s_f1 .

sort itab .

now put .....all ur itab data in range ...

range are like select option , except it does not creat selection screen .

range : r1 .

loop at itab .

r1-low = itab-f1.

append r1.

endloop.

now you have ur range (just like select option ) with sorted data.

thanks and regards...

Priyank Dixit

Read only

Former Member
0 Likes
666

I don't think you've thought this question through.

What do you want if you have multiple overlapping ranges?

What do you want if you have NE?

What do you want if you have exclusions?

What do you want if you have patterns?

The proper way to do this is to SELECT the data using this SELECT-OPTION and then sort the selected set.

Rob