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
627

Hi, I have the select-options:

<code>

SELECT-OPTIONS: s_vkorg FOR s650-vkorg,

SELECTION-SCREEN: END OF BLOCK b1.

</code>

I need separte in several variables the content of s_vkorg.

For example, If I have selected in s_vkorg the values "ORG1,ORG2,ORG3", I need copy the content in three variables:

var1 = ORG1

var2 = ORG2

var3 = ORG3

How can I do it?

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
582

What do you want to do if the contents of s_vkorg is ORG*

I would:

TABLES tvko.

SELECT-OPTIONS s_vkorg FOR tvko-vkorg.

DATA: BEGIN OF itab OCCURS 0,
        vkorg TYPE tvko-vkorg,
      END   OF itab.

SELECT vkorg
  INTO TABLE itab
  FROM tvko
  WHERE vkorg IN s_vkorg.

ITAB will have all the possible VKORGs.

I used table TVKO instead of S650 because S650 does not exist in our system.

Rob

3 REPLIES 3
Read only

rainer_hbenthal
Active Contributor
0 Likes
582

you cant really do that because select-options are a internal table of type ranges. As you can not foresse the number of lines in that table you will have problems to have tme in separated vairiables and to be honest i cant see the advantage.

if you need the first to third value why dont you use

read table s_option index 1

read table s_option index 2

read table s_option index 3

he have a look to the component lo of the structure.

Read only

0 Likes
582

Since its a select option the user can also provide a range -- low to high values.

So we can't just go by index 1, 2, 3....

What you can do is to fire a select query on the master table for sales org. and fetch all the sales org IN s_option into an internal table.

Then you can loop at the internal table and assign the values to variables.

Regards,

Abhishek

Read only

Former Member
0 Likes
583

What do you want to do if the contents of s_vkorg is ORG*

I would:

TABLES tvko.

SELECT-OPTIONS s_vkorg FOR tvko-vkorg.

DATA: BEGIN OF itab OCCURS 0,
        vkorg TYPE tvko-vkorg,
      END   OF itab.

SELECT vkorg
  INTO TABLE itab
  FROM tvko
  WHERE vkorg IN s_vkorg.

ITAB will have all the possible VKORGs.

I used table TVKO instead of S650 because S650 does not exist in our system.

Rob