11-27-2007 8:01 AM
Hi Guys,
I am doing a report which would output a number of days of the month in the specific year. The days will be below the specific month in rows...
Example: There are 31 days for the month of october... 28 days for february for year 2007... 29 days of february for year 2008...
May I know how am I going to achieve this?
All your help will be greatly appreciated.
Thanks!
Mark
11-27-2007 8:52 AM
HI MARK.
<b>Use the FM: NUMBER_OF_DAYS_PER_MONTH_GET</b>
pass month number and year.. and u will get days.
data: days LIKE T009B-BUTAG.
CALL FUNCTION <b>'NUMBER_OF_DAYS_PER_MONTH_GET'</b>
EXPORTING
par_month = sy-datum+4(2)
par_year = sy-datum+0(4)
IMPORTING
PAR_DAYS = days
.
write days.
11-27-2007 8:08 AM
11-27-2007 8:10 AM
11-27-2007 8:16 AM
Hi,
Try this.
HR_E_GET_SI_DAYS_TO_WORK - this function module excludes the saturdays and sundays.
or
Try using the FM , CATSXT_GET_HOLIDAYS for finding out no of days defined as holidays in the SAP HR Module.It will give you entries as dates which falls on Holidys in an internal table. Take a count of the internal table.
Can use FM HR_SGPBS_YRS_MTHS_DAYS for finding out no of days between a date range.
Subtract the days between ranges and the no of holidays between them.
REPORT zforum_days .
DATA: wa_days TYPE i.
PARAMETERS: wa_frdat TYPE sy-datum DEFAULT '20051216',
wa_todat TYPE sy-datum DEFAULT '20051221'.
PERFORM get_days USING wa_frdat wa_todat CHANGING wa_days.
WRITE: 'No. of days: ', wa_days.
&----
*& Form GET_DAYS
&----
text
----
-->P_WA_FRDAT text
-->P_WA_TODAT text
<--P_WA_DAYS text
----
FORM get_days USING p_wa_frdat
p_wa_todat
CHANGING p_wa_days.
DATA : tot_days TYPE i,
tot_holi TYPE i.
DATA : holi_table TYPE catsxt_iscal_day_itab.
DATA: lin TYPE i,
ini TYPE i,
knd TYPE c.
CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
EXPORTING
beg_da = p_wa_frdat
end_da = p_wa_todat
IMPORTING
NO_DAY =
NO_MONTH =
NO_YEAR =
no_cal_day = tot_days
EXCEPTIONS
dateint_error = 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.
CALL FUNCTION 'CATSXT_GET_HOLIDAYS'
EXPORTING
im_personnel_number = '00000024'
im_begin_date = p_wa_frdat
im_end_date = p_wa_todat
im_get_weekend_days = 'X'
IMPORTING
ex_holidays = holi_table.
DESCRIBE TABLE holi_table LINES lin OCCURS ini KIND knd.
p_wa_days = tot_days - lin.
ENDFORM. " GET_DAYS
or try this.
data : num type i.
parameters : frdate type sy-datum default '20051216'.
parameters : todate type sy-datum default '20051221'.
DATA : d TYPE sy-datum.
d = fromdate - 1.
DO.
d = d + 1.
IF d > todate.
EXIT.
endif.
CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
EXPORTING
date = d
factory_calendar_id = '01'
message_type = 'I'
EXCEPTIONS
date_after_range = 1
date_before_range = 2
date_invalid = 3
date_no_workingday = 4
factory_calendar_not_found = 5
message_type_invalid = 6
OTHERS = 7.
IF sy-subrc = 0.
numofdays = numofdays + 1.
write 😕 d.
ENDIF.
ENDDO.
the above code will give u the NUMBER OF DAYS,AS WELL AS ALL THE DATES,excluding the weekends.
Reward if Useful.
Regards,
Chitra
11-27-2007 8:17 AM
11-27-2007 8:43 AM
Hi Mark,
try this code...
DATA : mm LIKE t009b-bumon,
yy LIKE t009b-bdatj,
days LIKE t009b-butag.
PARAMETERS : mmyy LIKE isellist-month DEFAULT '200802'.
mm = mmyy+4(2).
yy = mmyy+0(2).
CALL FUNCTION 'NUMBER_OF_DAYS_PER_MONTH_GET'
EXPORTING
par_month = mm
par_year = yy
IMPORTING
par_days = days.
WRITE 😕 days.
11-27-2007 8:52 AM
HI MARK.
<b>Use the FM: NUMBER_OF_DAYS_PER_MONTH_GET</b>
pass month number and year.. and u will get days.
data: days LIKE T009B-BUTAG.
CALL FUNCTION <b>'NUMBER_OF_DAYS_PER_MONTH_GET'</b>
EXPORTING
par_month = sy-datum+4(2)
par_year = sy-datum+0(4)
IMPORTING
PAR_DAYS = days
.
write days.