Skip to Content
author's profile photo
Former Member

how to get the first day of current month

hi guys,

i am trying to get the first day of current month which get from the date i input at the selection screen. my method is not so good, so i was wondering if there is better way to get the this,

thanks.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    author's profile photo
    Former Member
    Oct 03, 2005 at 03:31 AM

    Try this .

    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.

    Cheers

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Parameters PDATE LIKE SY-DATUM.

      PDATE+6(02) = '01'.

      =======================================

      this part is enough, sorry to bring you two guys the trouble and raise a so simple question.

      thank you.

  • author's profile photo
    Former Member
    Oct 03, 2005 at 03:21 AM

    Adamyam,

    You have system date with you, replace just the date with 01 and then use the function module DATE_TO_DAY to get the first day of the month.

    Hope this helps.

    Regards,

    Ravi

    Note : Please reward points if this helps you.

    Add comment
    10|10000 characters needed characters exceeded