‎2008 May 21 1:06 AM
Hi Experts,
I have a small issue :
I have to calculate days from month/year is input parameter,for example i am giving input 03/2008(march'08)
i have to see in output march month days(31days) if that year is leap year(02/2008) for the month of feberuary 29 days other wise 28 days to display.
giving input month and year get the days of input month.
Input Parameter is :03/2008(Month/Year)
Desired output: 31 Days(particular month days).
Any sample code also welcome.
I'll assign full points.
Thanks,
‎2008 May 21 1:29 AM
‎2008 May 21 2:36 AM
Hi Eyda,
You can use the following FM.
NUMBER_OF_DAYS_PER_MONTH_GET.
You can use the following piece of code.
CALL FUNCTION 'NUMBER_OF_DAYS_PER_MONTH_GET'
EXPORTING
par_month = month
par_year = year
IMPORTING
PAR_DAYS = days.
Hope this helps you.
Thanks,
Arun
‎2008 May 21 2:58 AM
Hi,
In My system that function module not exist..
Where can i find the function module.
I used SE37 and Given FM Tech Name.it is showing not exists.
Can you guide me..
Thanks..
‎2008 May 21 3:06 AM
Hi Eyda,
Can you tell me the SAP version you are using.
While giving it se37 remove and spaces that are prefixed.
Thanks,
Arun
‎2008 May 21 4:58 AM
HI,
first get first day and last day of the given month and the calculate number of days bettween these two days.
1. calculate fisrt day and last day of the month.
s_date is ur given date in the format yyyymm.
lwa_month = s_date-low+4(2).
lwa_year = s_date-low+0(4).
CONCATENATE s_date-low c_01 INTO ws_date.
*To get last day of the month
CALL FUNCTION 'SG_PS_GET_LAST_DAY_OF_MONTH'
EXPORTING
day_in = ws_date
IMPORTING
last_day_of_month = ws_last_day_month
EXCEPTIONS
day_in_not_valid = 1
OTHERS = 2.
2. calculate number of days between these two days,
CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
EXPORTING
beg_da = ws_date
end_da = ws_last_day_month
IMPORTING
no_cal_day = d.
here ur 'd' will give u number of days of that month .
Regards,
kk.