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: 

Hi Experts ! How to get First day of the month

Former Member
0 Kudos

Please tel me " How to get First day of the month " , it's urgent plaese

help me please

Thanks in advance

5 REPLIES 5

Former Member
0 Kudos

it is always 1

or

data:f_date type sy-datum,

l_date type sydatum.

CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'

EXPORTING

iv_date = sy-datum

IMPORTING

EV_MONTH_BEGIN_DATE = f_date -


> first date of month

EV_MONTH_END_DATE = l_date.

kishan negi

Former Member
0 Kudos

data: g_date(10) type c.

concatenate sy-datum+0(6) '01' into g_date.

Former Member
0 Kudos

use this Fm to find last day of previous month and then add one to tht as follows -

btw it will be one i m sure

parameters: p_date like sy-datum default '20070101'.

data d_last like sy-datum.

data d_first like sy-datum.

CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'

EXPORTING

DAY_IN = P_DATE

IMPORTING

LAST_DAY_OF_MONTH = d_last

EXCEPTIONS

DAY_IN_NO_DATE = 1

OTHERS = 2.

d_first = d_last + 1.

reward points if helpfull.

Message was edited by:

Amit Tyagi

Former Member
0 Kudos

Hi ,

Welcome to SDN.

DATA:DAYNR  LIKE  HRVSCHED-DAYNR,
     DAYTXT LIKE  HRVSCHED-DAYTXT,
     DAYFREE LIKE  HRVSCHED-NODAY.
DATA:LANGU LIKE  SY-LANGU ,
     DATE LIKE  SY-DATUM,
     CALID LIKE  P1027-CALID VALUE 'US'.


date = sy-datum.
date+6(2) = 01.           "----->to get the first day .

*first day of the month

write:/ 'First date of the month', date.

*Day name 
CALL FUNCTION 'RH_GET_DATE_DAYNAME'
  EXPORTING
    langu                     = SY-LANGU
    date                      = DATE
    CALID                     = CALID
 IMPORTING
   DAYNR                     = DAYNR
   DAYTXT                    = DAYTXT
   DAYFREE                   = DAYFREE
 EXCEPTIONS
   NO_LANGU                  = 1
   NO_DATE                   = 2
   NO_DAYTXT_FOR_LANGU       = 3
   INVALID_DATE              = 4
   OTHERS                    = 5
          .
IF sy-subrc <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


WRITE:/ DAYTXT.

regards,

Vijay.

Former Member
0 Kudos

An alternative is:

data: day_index          type scal-indicator,
        day_index_temp type int1.
 
call function 'DATE_COMPUTE_DAY'
    exporting
      date = p_date
    importing
      day  = day_index.
 
  move day_index to day_index_temp.

This gives a value representing the weekday so:

day_index_temp = 0 = sunday

day_index_temp = 1 = monday