06-02-2006 5:47 AM
Hi..
I have a date field on my selection-screen.
And I want 2 things for it..
1) I want a default value of sy-datum - 30 days for that field.And to implement it I have done the following Coding:--
INITIALIZATION.
V_DATE = SY-DATUM - 30.
SELECT-OPTIONS: S_ERDAT FOR NAST-ERDAT DEFAULT V_DATE
But, the problem is that I am not getting the correct default value of the date .(It comes as 00.00.000)
Please help me sort out this issue.
2) I also want to restrict the "multiple entries possibility " for this field.
Please tell me what shall I do?
Thanks
06-02-2006 5:53 AM
Subash,
Do this ...
INITIALIZATION.
V_DATE = SY-DATUM - 30.
S_ERDAT-OPTION = 'EQ'.
S_ERDAT-SIGN = 'I'.
S_ERDAT-LOW = V_DATE.
APPEND S_ERDAT.
SELECT-OPTIONS: S_ERDAT FOR NAST-ERDAT NO-INTERVALS NO-EXTENSIONS.
Or you can do this as well
INITIALIZATION.
V_DATE = SY-DATUM - 30.
SELECT-OPTIONS: S_ERDAT FOR NAST-ERDAT NO-INTERVALS NO-EXTENSIONS DEFAULT V_DATE.
Regards,
Ravi
Note :Please mark the helpful answers
Message was edited by: Ravikumar Allampallam
06-02-2006 6:03 AM
Hi Ravi..
Thanks
I tried both of them...
The first one works but not the second one..
06-02-2006 5:54 AM
Hi,
In order to restrict an select option for multiple entries even when u double click on the select option u can use the function module SELECT_OPTIONS_RESTRICT.
06-02-2006 7:09 AM
Hello Subhash,
For SELECT-OPTION you can specify default but this default normally is a literal because at runtime when u select a submit( if you happen to) it is transferred to the selection options table sel so early that no value can be assigned to the field g. System fields like SY-DATUM are an exception here because the system usually assigns values to them as soon as the report processing starts.
I think this is the reason it is not happening in your case.
06-02-2006 10:18 AM
1) In Initialization, either you can assingn SO-low by = or you can use write, but in both cases you'll have to append the to particular select option
2) To restrict Multiple entries , use this
so_date for sy-datum NO-EXTENSION.
NO-EXTENSION would barr the multiple entries.
see if that was useful.