01-05-2007 8:29 AM
Please tel me " How to get First day of the month " , it's urgent plaese
help me please
Thanks in advance
01-05-2007 8:30 AM
it is always 1
or
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 -
> first date of month
EV_MONTH_END_DATE = l_date.
kishan negi
01-05-2007 8:31 AM
data: g_date(10) type c.
concatenate sy-datum+0(6) '01' into g_date.
01-05-2007 8:31 AM
use this Fm to find last day of previous month and then add one to tht as follows -
btw it will be one i m sure
parameters: p_date like sy-datum default '20070101'.
data d_last like sy-datum.
data d_first like sy-datum.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = P_DATE
IMPORTING
LAST_DAY_OF_MONTH = d_last
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2.
d_first = d_last + 1.
reward points if helpfull.
Message was edited by:
Amit Tyagi
01-05-2007 8:54 AM
Hi ,
Welcome to SDN.
DATA:DAYNR LIKE HRVSCHED-DAYNR,
DAYTXT LIKE HRVSCHED-DAYTXT,
DAYFREE LIKE HRVSCHED-NODAY.
DATA:LANGU LIKE SY-LANGU ,
DATE LIKE SY-DATUM,
CALID LIKE P1027-CALID VALUE 'US'.
date = sy-datum.
date+6(2) = 01. "----->to get the first day .
*first day of the month
write:/ 'First date of the month', date.
*Day name
CALL FUNCTION 'RH_GET_DATE_DAYNAME'
EXPORTING
langu = SY-LANGU
date = DATE
CALID = CALID
IMPORTING
DAYNR = DAYNR
DAYTXT = DAYTXT
DAYFREE = DAYFREE
EXCEPTIONS
NO_LANGU = 1
NO_DATE = 2
NO_DAYTXT_FOR_LANGU = 3
INVALID_DATE = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE:/ DAYTXT.
regards,
Vijay.
01-05-2007 9:18 AM
An alternative is:
data: day_index type scal-indicator,
day_index_temp type int1.
call function 'DATE_COMPUTE_DAY'
exporting
date = p_date
importing
day = day_index.
move day_index to day_index_temp.
This gives a value representing the weekday so:
day_index_temp = 0 = sunday
day_index_temp = 1 = monday