09-23-2008 11:06 AM
Suppose if I will enter month "Jan" as 01 in month field and it will output last day of the month as 31.01.2008 in function module.
Is there is any function module for this ?
09-23-2008 11:08 AM
Hi,
PLz do this way :
I_DATE TYPE SY-DATUM.
and
ENDMONTH TYPE SY-DATUM.
CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
EXPORTING
i_date = i_date
IMPORTING
e_date = endmonth.
thanx.
Edited by: Dhanashri Pawar on Sep 23, 2008 12:10 PM
09-23-2008 11:13 AM
09-23-2008 11:14 AM
hi,
use the following FM.
SG_PS_GET_LAST_DAY_OF_MONTH.
also, you can search for more relevant FMs yourself by doing a F4 in transaction SE37.
some inputs that can be helpful.
lastdaymonth
lastmonth*
lastdatemonth
09-23-2008 11:20 AM
if the requirement is that simple...i would suggest against using a function module for this....as it will be a needless burden on the memory...
why not write a case statement in your program...
data month(2) type n.
data str type string.
case month.
when '01'.
concatenate '31.' month '.' sy-datum+0(4) into str.
when '02'.
"for february you can write a logic to see if it has 28 or 29 days.
when '03'
concatenate '31.' month '.' sy-datum+0(4) into str.
.
.
.
endcase.
write 😕 str.
09-23-2008 11:23 AM
hi..prasanth..
Since ur input is in month format, use the table 'T015M' to get the month number from MONUM field w.r.t MONAM (ur input).
And then use concatenate option to add '01' , 'MONUM' and year. Pass this to BKK_GET_MONTH_LASTDAY Fm and proceed further.
regards,
Padmashree.
09-23-2008 11:28 AM
To get first and last date of the current month
DATA: L_DATE TYPE D,
F_DATE TYPE D.
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.
rajneesh gupta
09-23-2008 11:28 AM
Hi
SG_PS_GET_LAST_DAY_OF_MONTH
returns the last day of the month
Hope this helps!
Regards,
Prashant