Skip to Content
author's profile photo Former Member
Former Member

How to - get first DAY of the month from the date ?

Hi

pls help

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

12 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 05, 2007 at 05:28 AM

    Hi..,

    move '01' to the day characters of the date field...

    Execute this code...

    <b>parameters Date type sy-datum default '20071203'.

    move '01' to date+6(2).

    write date.</b>

    reward all helpful answers!!

    sai ramesh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 05, 2007 at 05:29 AM

    Hi,

    parameters w_date like sy-datum .

    w_date+6(2) = '01'.

    write w_date. " first date

    Message was edited by:

    ananth

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 05, 2007 at 05:29 AM

    hi,

    chk out this fm

    WEEK_GET_FIRST_DAY

    thanks,

    Navneeth

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 05, 2007 at 05:29 AM

    U can also use the function module

    <b>BKK_GET_MONTH_LASTDAY</b>, pass any date of the previos month, u'll get the last of the previous month and add 1 to the date returned by the fm to get the first DAY of the current month.

    Message was edited by:

    Rajesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 05, 2007 at 05:31 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 05, 2007 at 05:32 AM

    if you have the date var..

    data : date like sy-datum value '20070405'.

    concatenate date+0(6) '01' into date.

    regards

    shiba dutta

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 05, 2007 at 05:32 AM

    Hi,

    DATA: ultimo TYPE d.
    
    ultimo      = sy-datum. 
    ultimo+6(2) = '01'.          " = first day of this month

    Regards

    Sudheer

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 05, 2007 at 05:33 AM

    hi,

    data : DAYNR LIKE HRVSCHED-DAYNR,

    DAYTXT LIKE HRVSCHED-DAYTXT.

    data langu like sy-langu value 'EN'.

    Parameters PDATE LIKE SY-DATUM.

    PDATE+6(02) = '01'.

    .

    CALL FUNCTION 'RH_GET_DATE_DAYNAME'

    EXPORTING

    LANGU = LANGU

    DATE = PDATE

    • CALID =

    IMPORTING

    DAYNR = DAYNR

    DAYTXT = DAYTXT

    • 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 :/ PDATE, DAYNR, DAYTXT.

    ************************************

    (OR)

    Try..

    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.

    Don't forget to reward if useful....

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 05, 2007 at 05:35 AM

    refer below code,

    
    DATA: currDate TYPE d.
    
    currDate      = sy-datum.
    
    *write  : 'befor ' , currDate.
    
    currDate+6(2) = '01'.
    
    *write  :/ 'after ' , currDate.
    
    currDate      = currDate.
    
    WRITE: / 'first day of month' , currDate.
    
    *
    *ULINE.
    *
    *currDate      = sy-datum.
    *
    *write  : 'befor ' , currDate.
    *
    *currDate+4(2) = currDate+4(2) + 1.
    *
    *currDate+6(2) = '01'.
    *
    *write: / 'after one month ' , currDate.
    
    

    reward if useful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 05, 2007 at 05:36 AM

    Hi,

    Try this.

    data g_first_day type sy-datum.

    g_first_day = sy-datum.

    g_first_day+6(2) = '01'.

    Will change to first day of present month.

    Hope this will help.

    Jogdand M B

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.