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 option logic

Former Member
0 Kudos
387

Hi,

I have a requirement ....I have a select option in selection screen which is a date field.

I need to capture the values entered in select option for date in an internal table in the program.

Pls give me a logic to do this

Thanks in advance

Sarvan

12 REPLIES 12

Former Member
0 Kudos
227

Hi Saravana ,

Write your code something like this :

select-options :
  s_date for sy-datum.

select <field names you want>
   from <db tab name>
   into  <int tab name>
 where <date-field name in db tab> in s_date.

This will retrieve the records you want for the entered date values from the db table in to your internal table.

Regards,

Swapna.

0 Kudos
227

Hi,

Thanks for ur reply..

What i need is....I am giving value range for date in select option in the selection screen say from 20.07.2008 to 30.07.2008 . In this case I need to capture the 10 dates from 20th to 30th and all these date values shuld be there in my internal table...

Pls let me know how can i do this

Regards

Saravan

0 Kudos
227

Hi,

u can store the select option low and high values in the variables.

bpawanchand
Active Contributor
0 Kudos
227

Hi

data :

begin of fs_struct,

d1 type d,

d2 type d,

End of fs_struct.

START-OF-SELECTION

fs_-struct-d1 = s-fld1-low

fs_-struct-d1 = s-fld1-high

append fs_-struct to tab.

Regards

Pavan

Former Member
0 Kudos
227

Hi,

Select options is itself an internal table. So you can directly use the values in select options by looping on select option or you can move the values to the internal tableby looping the select option.

Former Member
0 Kudos
227

Hi!

Check out this sample code.


REPORT z_sdn.

SELECT-OPTIONS:
  s_date FOR sy-datum.


DATA:
  BEGIN OF fs_emp,
    empname(10) TYPE c,
    ldate TYPE sy-datum,
    hdate TYPE sy-datum,
  END OF fs_emp.

DATA:
  t_emp LIKE
  TABLE OF
        fs_emp.


CLEAR fs_emp.
fs_emp-empname = 'XYZ'.
fs_emp-ldate = s_date-low.
fs_emp-hdate = s_date-high.
APPEND fs_emp TO t_emp.

LOOP AT t_emp INTO fs_emp.
  WRITE:
   / fs_emp-empname,
     fs_emp-ldate,
     fs_emp-hdate.
ENDLOOP.

Regards

Abhijeet

Former Member
0 Kudos
227

Hi,

Define an internal table with the same type of select-option.

Now append the select-options values to Internal table.

Follow the code in the Link-

Regards,

Sujit

Former Member
0 Kudos
227

select-options :

sdate for sy-datum.

select <field names>

from <db tab name>

into <int tab name>

where <date-field name in db tab> in sdate.

try this it will work out .

Former Member
0 Kudos
227

Dear Sravan,

whenever the user enters some condtions/values in the select option on the screen, these values are automatically available in an internal table with the same name of the select option.

for example :

select option : s_first for spfli-carrid.

here s_first would be an internal table with values/conditions selected by the user at runtime with the fallowing structure. you can check the same at runtime.

SIGN OPTION LOW HIGH

Reward points if helpful

Thanks

Damodar

former_member787646
Contributor
0 Kudos
227

Hi

Tty this ...

DATA: date1 type sy-datum.

SELECT-OPTIONS:so_date FOR date1 .

START-OF-SELECTION.

  • You can get the values of the SELECT-OPTION object using its low and high components

Eg. WRITE:/ so_date-low, so_date-high.

Hope it helps.

Murthy

Former Member
0 Kudos
227

hi,

Well for this you have to create one variable of Sy-datum type.

DAta:

date type sy-datum,

date2 type sy-datum.

date = s_date-low.

while date LE s_date-high.

wa_itab-date = date..

modify t_itab form wa_itab index 1.

add 1 to date.

endwhile.

Regards

Sumit Agarwal

Former Member
0 Kudos
227

Hi,

PLease use FM CBIH_LB39_DAYS_TABLE_GET, you will get the values in the table parameter X_DAYS_TAB.

Thanks,

Sriram Ponna.