‎2006 Oct 10 1:48 PM
Dear all.
In select options default value to be current month of first and last dates.How to do that?
what we can do for leap year.
Thanx in Advance.
Regards,
Johnn.
‎2006 Oct 10 2:27 PM
hi
good
you can use
F4_DATE displays a calendar in a popup window and allows user to choose a date, or it can be displayed read only.
this function module with your select-options which ll allow you to seleft the first date and end date of the month and you can select accordingly.
thanks
mrutyun^
‎2006 Oct 10 1:50 PM
Use the FM LAST_DAY_OF_MONTHS to get the last of the month, concatenate and pass to the select option in the initialization event.
Here start date can be given like 20060101, we always know that the first day will 01. So just concatenate sy-datum0(4) sy-datum4(2) '01' into p_start_date and get the end date. Then concatenate sy-datum0(4) sy-datum4(2) end date.
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
day_in = p_start_date
IMPORTING
last_day_of_month = p_end_date
EXCEPTIONS
day_in_no_date = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
Regards,
Prakash.
‎2006 Oct 10 1:52 PM
hi jhon
use this.
data:f_date type sy-datum,
l_date type sydatum.
CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
iv_date = sy-datum
IMPORTING
EV_MONTH_BEGIN_DATE = f_date
EV_MONTH_END_DATE = l_date.
leap year is not pblm in this FM
rgds
anver
‎2006 Oct 10 1:53 PM
Hi Johnn,
<b>SELECT-OPTIONS</b> DATE FOR SY-DATUM <b>DEFAULT</b> SY-DATUM.
SELECT *
FROM BUT000
WHERE BUT000~CRDAT IN Date.
u can try in these way also
1. There is no DIRECT Way.
2. We have to do in 2 steps.
3. See this code (just copy paste in new program)
U can use its FORM anywhere in your program,
for getting the desired dates.
REPORT abc.
DATA : sdate TYPE sy-datum,
edate TYPE sy-datum.
PARAMETERS : dt TYPE sy-datum DEFAULT sy-datum.
*----
PERFORM getdt USING dt sdate edate.
WRITE 😕 sdate , edate.
*----
INDEPENDENT FORM
*----
FORM getdt USING orgdate stdate enddate.
DATA : mydate TYPE sy-datum.
CALL FUNCTION 'HR_PSD_DATES_ADD_MONTHS'
EXPORTING
v_date = orgdate
V_MONTHS = 1
IMPORTING
E_DATE = mydate
EXCEPTIONS
NOT_POSITIVE = 1
OTHERS = 2
.
CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
iv_date = mydate
IMPORTING
ev_month_begin_date = stdate
ev_month_end_date = enddate.
ENDFORM. "getdt
Regards
Alfred
‎2006 Oct 10 1:54 PM
hi John,
do this way ..
select-options s_date for sy-datum.
Initialization .
s_date-low = '1'
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = sy-datum
IMPORTING
LAST_DAY_OF_MONTH = v_lastdate
s_date-high = v_lastdate.Regards,
santosh
‎2006 Oct 10 2:22 PM
Hi,
<b>The below program gives date last date of month and
date1 gives starting date of month.
use date1 in select-option_low and
date in select-option_high.</b>
data date like sy-datum.
data date1(10).
DATA: M(2) TYPE C,
D(2) TYPE C,
Y(4) TYPE C.
initialization.
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = SY-DATUM
IMPORTING
LAST_DAY_OF_MONTH = DATE
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Y = SY-DATUM+0(4).
M = SY-DATUM+4(2).
D = '01'.
CONCATENATE M D Y INTO DATE1 SEPARATED BY '/'.
WRITE:/ SY-DATUM.
WRITE:/ DATE1.
Aswarth
‎2006 Oct 10 2:27 PM
hi
good
you can use
F4_DATE displays a calendar in a popup window and allows user to choose a date, or it can be displayed read only.
this function module with your select-options which ll allow you to seleft the first date and end date of the month and you can select accordingly.
thanks
mrutyun^
‎2006 Oct 10 2:54 PM
data date1(10).
data: date like sy-datum.
DATA: M(2) TYPE C,
D(2) TYPE C,
Y(4) TYPE C.
SELECT-OPTIONS FL_DATE FOR sy-datum.
initialization.
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = SY-DATUM
IMPORTING
LAST_DAY_OF_MONTH = DATE
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Y = SY-DATUM+0(4).
M = SY-DATUM+4(2).
D = '01'.
INITIALIZATION.
CONCATENATE Y M D INTO DATE1.
MOVE: 'BT' TO FL_DATE-OPTION,
date1 TO FL_DATE-LOW,
date TO FL_DATE-HIGH.
APPEND FL_DATE.