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

Former Member
0 Likes
726

Hello,

I have a select-option for date and I need to add some functionality based on the selection date. Like if the date is below 07/07/2004 i need to add some functionality and if the date is above 07/07/2004 i need to add a different functionality. So when the user enters the date range how do i check on this date and write the functionality..

Thanks

Vicky

1 ACCEPTED SOLUTION
Read only

anversha_s
Active Contributor
0 Likes
686

hi vicky,

try this.

select-options: date for ztable-date_field.

at selectionscreen output

if date-low --chk ur condition.

endif.

if date-high -- chk ur condition.

endif.

in select options - first text box value is date-low

similarly the other one is date-high.

hope u got an idea.

if hlped mark points

rgds

anver

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
686

This could get a little tricky with a select-option because of all of the possibilties. But if you just want to check that the low value is before of after 07/07/2004, then you can simply do this.



report zrich_0004.
 

select-options: s_datum for sy-datum no-extension.


start-of-selection.

read table s_datum index 1.

if s_Datum-low < '20040707'.

else.


endif.

Regards,

Rich Heilman

Read only

anversha_s
Active Contributor
0 Likes
687

hi vicky,

try this.

select-options: date for ztable-date_field.

at selectionscreen output

if date-low --chk ur condition.

endif.

if date-high -- chk ur condition.

endif.

in select options - first text box value is date-low

similarly the other one is date-high.

hope u got an idea.

if hlped mark points

rgds

anver

Read only

Former Member
0 Likes
686

Hi,

if you want to do validation

at selection-screen.

if s_date-low < 07/07/2004

message e000 with 'invalid date'.

endif.

start-of-selection

if s_date-low < 07/07/2004

perform fun1.

else

performs_fun

endif.

Regards

amole

Read only

Former Member
0 Likes
686

Hi Vicky,

Your Question is not very much clear.

What is ur requirement...

Is it Select-Options Validation in selection screen

or displaying output after input

If its regarding validation then use the following logic.

Select-options: sdate for sy-cdate.

At-selection-screen on sdate-low.

If sdate < sy-datum.

message e044.

Write ur own logic...

endif.

At-selection-screen on sdate-high.

message e045.

write ur own logic.

endif.

Or if you ant to display ouput then do code like below.

start-of-selection.

if sdate-low < sy-datum.

write ur functionality.

else.

if sdate-high > sy-datum.

write ur functionality.

endif.

endif.

if helpful

then reward me points.

Regards

Manas Ranjan Panda.

Read only

0 Likes
686

hi,

try this..

data:begin of itab occurs 0,

budat like mkpf-budat,

end of itab.

select-options: s_date for sy-datum.

start-of-selection.

select budat from mkpf into table itab where budat in s_date.

loop at itab.

if itab-budat < '20040707'.

ur function

elseif itab-budat = '20040707'.

ur function

else.

ur function

endif.

endloop.