cancel
Showing results for 
Search instead for 
Did you mean: 

to find first and last day of particular month

Former Member
0 Kudos

hi,

can anyone tell how to find first and last day of particular month, where iam going to enter date in selection screen.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

First day is always 1 , so give v_first_day = '1'.

to get last day

CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = sy-datum
IMPORTING
LAST_DAY_OF_MONTH = v_last_date.

also check this

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.

Former Member
0 Kudos

Hi Anitha,

You can use the FM 'RP_LAST_DAY_OF_MONTHS' for getting the last day of the month.

First day of every month is 1.

Hope this helps!

Regards,

Saurabh

Former Member
0 Kudos

hi,

you can use SG_PS_GET_LAST_DAY_OF_MONTH

to get last day of month.

And 1 will always be the first day of month .

regards,

guru

Former Member
0 Kudos

Hi,

Please use the following method

<b>CL_RECA_DATA=>GET_DATE_INFO.</b>

Please use the following FM by passing date as input

<b>REAL_ESTATE_CALC_DATE_SLST</b>

Regards

Bhupal Reddy

Former Member
0 Kudos

how to call this method, can u send some code regarding this.

Former Member
0 Kudos

Hi,

Please see the following code.

Parameters: p_date type sydatum.

data:
 lv_month_begin type sydatum,
 lv_month_end   type sydatum.

CALL FUNCTION 'REAL_ESTATE_CALC_DATE_SLST'
 EXPORTING
   I_DATE                 = p_date
*   I_DAY_OFFSET           = 0
*   I_MON_OFFSET           = 0
 IMPORTING
*   E_DATE_POST_END        =
   E_DATE_MONTH_BEG       = lv_month_begin
   E_DATE_MONTH_END       = lv_month_end
*   E_MONTH                =
*   E_YEAR                 =
 EXCEPTIONS
   ERROR                  = 1
   OTHERS                 = 2
          .
IF sy-subrc <> 0.
Message 'Error' Type 'E'.
ENDIF.

write: lv_month_begin,/ lv_month_end.

Please have look in method code.


Parameters: p_date type sydatum.

data:
 lv_month_begin type sydatum,
 lv_month_end   type sydatum.


CALL METHOD cl_reca_date=>get_date_info
  EXPORTING
    id_date           = p_date
*    ID_MONTH_OFFSET   = 0
  IMPORTING
    ED_DATE_MONTH_BEG = lv_month_begin
    ED_DATE_MONTH_END = lv_month_end
*    ED_MONTH          =
*    ED_YEAR           =
  EXCEPTIONS
    ERROR             = 1
    others            = 2
        .
IF sy-subrc <> 0.
Message 'Error' Type 'E'.
ENDIF.

write: lv_month_begin,/ lv_month_end.

Regards

Bhupal Reddy