Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FM:input of month & output last day of month

Former Member
0 Kudos

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 ?

7 REPLIES 7

Former Member
0 Kudos

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

Former Member
0 Kudos

HI,

Try out this.

BKK_GET_MONTH_LASTDAY.

Thanks.

Swati.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi

SG_PS_GET_LAST_DAY_OF_MONTH

returns the last day of the month

Hope this helps!

Regards,

Prashant