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

storing select-options to an internal table

Former Member
0 Likes
5,876

Hi all,

How can i store values in a select-option to an internal table, is there any function module for this.

If someone knows please tell me...thanks in advance...

Hi all,

How can i store values in a select-option to an internal table, is there any function module for this.

If someone knows please tell me...thanks in advance...

13 REPLIES 13
Read only

Former Member
0 Likes
2,295

Hi

The select-options is an internal table with field SIGN, OPTION, LOW and HIGH.

so what do you need to do?

Max

Message was edited by: max bianchi

Read only

0 Likes
2,295

tables: t001w.

select-options: s_werks for t001w-werks.

types: begin of ty_werks,

werks type t001w-werks,

end of ty_werks.

data: wa_werks type ty_werks.

data: lt_werks type ty_werks.

loop at s_werks where option = 'EQ' and sign ='I'.

wa_werks-werks = s_werks-low.

append wa_werks to lt_werks

endloop.

Read only

0 Likes
2,295

When you create a selection options say

Select-options s_tab for kna1-werks.

s_tab it self is an internal with structure

sign option low high

low and high will have the values entered by you.

Read only

Former Member
0 Likes
2,295

Hi,

Declare another table like this.

data : lit_data type ranges of <Data_element_Name>.

store in this

<Data_element_Name> this should be same has data_element which u use for select option.

To transfer data from one table to another

APPEND LINES OF itab1 TO itab2.

Read only

Former Member
0 Likes
2,295

Hi,

Can you explain in detail what exactly you are trying to do? If you are tyring to get every single value of the select options when the user has give a range, then select the values from the table dump into the internal table.

SELECT * FROM TABLE INTO ITAB WHERE COLUM IN S_OPT1.

Now, ITAB will have all the single values.

Regards,

Ravi

Note : Please mark the helpful answers

Read only

0 Likes
2,295

Actually my requirement is like, i am having 4 radiobuttons(r1 to r4) in the selection screen ..when user has selected r1, all contract accounts should be selected ...when user selects r2 a select option should come in which user can enter contract accts or a range of those..for r3 and r4 some other conditions are there..first of all i m populating an itab with required contract accounts..

this is the first internal table which i am populating in case of r1,r3,r4..and then i am starting processing with the help of this itab...i've used this itab for further select statements which i've written.

Now for r2(were i m not populating the first itab), the problem is that i can't use select-option as a parameter to a subroutine which requires an internal table.

so i want to convert select option to an itab..

Read only

0 Likes
2,295

hi ravi ,

the solution which u gave will work in my case but it is using a select statement which is not at all required ...as the user himself is entering the selected contract accts..

Read only

0 Likes
2,295

thanks for ur answer

Read only

0 Likes
2,295

HI Tomesh,

If i understand your question correctly,

The user will enter a range of values(When 2nd radio-button has been chosen).

Say he has entered 1-100.

Then he will not enter each of the value in between 1 and 100.He will enter only the limits.

In that case you need to have a select statement to get all the values in between the range specified.

If the user is entering single values like 1,2,3,4,5 etc.

Then you can just loop at the select-option and move the contents into the itab.

  • For individual values

loop at s_matnr.

itab-matnr = s_matnr-low.

append itab.

clear itab.

endloop.

  • For ranges, you need to use RaviKUmar's logic.

Regards,

ravi

Read only

Former Member
0 Likes
2,295

Hai

Go through the following Link

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/select_o.htm

Thanks & regards

Sreenivasulu P

Read only

Former Member
0 Likes
2,295

hi,

On creating a selection options, the data in stored in the internal table.

Examples when you declare a select option like...

Select-options s_abc for mara-matnr.

s_abc is an internal with structure - sign option low high

Regards,

Richa.

Read only

Former Member
0 Likes
2,295

Hi,

Refer the following code.


  DATA: git_pnum   TYPE RANGE OF but000-partner.
  
* s_pnum is your select option with 
* the type as but000-partner
  APPEND LINES OF s_pnum TO git_pnum.

<b>Reward points and close the thread.</b>

Read only

Former Member
0 Likes
2,295

hi Tomesh,

suppose u want 2 use the range statement for material given in import u can use this way-

DATA: BEGIN OF T_MAT OCCURS 0,

SIGN,

OPTION(2),

LOW_MATERIAL LIKE MARA-MATNR,

HIGH_MATERIAL LIKE MARA-MATNR,

END OF T_MAT.

T_MAT-SIGN = 'I'.

T_MAT-OPTION = 'EQ'.

T_MAT-LOW_MATERIAL = MATERIAL.

APPEND T_MAT.

This is how u define n append the reqd values i hope this works for u.

Seema