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

name of the month

Hi!

Suppose I have any date and need a function module which returns me the name

of the month.

Regards

ertas

e.g.

12.01.2005 -> January

13.06.2000 -> June

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 10:44 AM

    Hi,

    Please use FM ISP_GET_MONTH_NAME.

    Thanks,

    Sriram Ponna.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 09:38 PM

    Hi, try with FM : MONTH_NAMES_GET,

    call function 'MONTH_NAMES_GET'

    exporting

    language = sy-langu

    tables

    month_names = t_t247

    exceptions

    month_names_not_found = 1

    others = 2.

    read table t_t247 with key mnr = p_date+4(2).

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 10:40 PM

    i know.. this it retrieves all the names of months. the read is for search only the name of the month that u required.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 10:54 PM

    I need a FM which is be able to retrieve the name automatically

    12.01.2005 -> January

    13.06.2000 -> June

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi llhan,

      We can use the standard FM inside a Subroutine.

      We will pass -


      > Date

      and it will return <----


      Monthname.

      Just copy paste.

      
      REPORT abc.
      
      DATA : mname(10) TYPE c.
      PARAMETER : d TYPE sy-datum.
      
      PERFORM getmonth USING d mname.
      WRITE :/ mname.
      
      
      *&--------------------------------------------------------------------*
      *& Form getmonth
      *&--------------------------------------------------------------------*
      * text
      *---------------------------------------------------------------------*
      * -->M text
      * -->MNAME text
      *---------------------------------------------------------------------*
      FORM getmonth USING d mname.
      
      
      DATA : month_names LIKE t247 OCCURS 0 WITH HEADER LINE.
      DATA : m(2) TYPE c.
      m = d+4(2).
      
      
      CALL FUNCTION 'MONTH_NAMES_GET'
      * EXPORTING
      * LANGUAGE = SY-LANGU
      * IMPORTING
      * RETURN_CODE =
      TABLES
      month_names = month_names
      EXCEPTIONS
      month_names_not_found = 1
      OTHERS = 2
      
      .
      
      READ TABLE month_names INDEX m.
      IF sy-subrc = 0.
      mname = month_names-ltx.
      ENDIF.
      
      
      ENDFORM. "getmonth
      
      

      regards

      amit m.

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 10:34 AM

    HI,

    CALL FUNCTION 'MONTH_NAMES_GET'
        EXPORTING
          language    = sy-langu
        IMPORTING
          return_code = return
        TABLES
          month_names = month_names
      exceptions
        month_names_not_found       = 1
        others                      = 2.
    
    
     if sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

    This will surely help you.

    Plz reward if useful.

    Thanks,

    Dhanashri.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 10:43 AM

    Hi,

    Try this..

    • Converting Month to Words

    *

    REPORT ZMONTH.

    DATA X_MONTH(11).

    CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'

    EXPORTING

    INPUT = SY-DATUM

    IMPORTING

    OUTPUT = X_MONTH.

    WRITE:/ 'Month in words', X_MONTH+3(8).

    *-- End of Program

    Reward pts if helpfull.

    Regards,

    Dhan

    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.