Skip to Content
avatar image
Former Member

converting month number to month name

Hi,

Is there a function module to convert month number to month name.Like if the date is 23/10/2007,I want the month number 10 to be printed as october.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 09, 2008 at 04:37 AM

    CONVERSION_EXIT_LDATE_OUTPUT

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      I have used this FM.If the date is 26/01/2007,after conversion it is displaying 26. january 2007.But I want only month name.How can I get this?

  • avatar image
    Former Member
    Jul 09, 2008 at 04:37 AM

    SELECT mnr

    ktx

    FROM t247

    INTO TABLE it_month

    WHERE spras = 'E'.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      goto table t247 u can found long text and short text there, even if u use any FM they will do the same inside the fm

  • avatar image
    Former Member
    Jul 09, 2008 at 04:41 AM

    Hi,

    Please refer FM IDWT_READ_MONTH_TEXT.

    Thanks,

    Sriram POnna.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 09, 2008 at 04:44 AM

    Hi Hema,

    Use this Code Snippet.

    CALL FUNCTION 'MONTH_NAMES_GET'
        TABLES
          month_names           = t_month
        EXCEPTIONS
          month_names_not_found = 1
          OTHERS                = 2.
    
      LOOP AT t_month INTO fs_month WHERE mnr = w_month1.
        w_month_name = fs_month-ltx.
      ENDLOOP.                             " loop at t_month...

    If Found Help Full Do Reward.

    Regards.

    Eshwar.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 09, 2008 at 04:47 AM

    Hi,

    You can use FM CONVERSION_EXIT_LDATE_OUTPUT.

    Here you need to give date as YYYYMMDD format and you will get output as month name date , year.

    Then take out the month name frm your ourput.

    Hope this helps!

    regards,

    lalit

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 09, 2008 at 04:50 AM

    SELECT mnr ltx FROM t247

    INTO TABLE lt_month_names

    WHERE spras = 'E'.

    if lv_date is int he format yyyymmdd

    read table lt_month_names with key mnr = lv_date+4(2).

    if sy-subrc = 0.

    name = lt_month_names-ltx.

    endif.

    Thanks,

    Shailaja

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 09, 2008 at 04:53 AM

    Hello

    I distrust that there is such function. Try this:

    data: mnr like t247-mnr.
    mnr = date+4(2).
    select single * from t247 where spras eq sy-langu and mnr eq mnr.
    if sy-subrc = 0.
      write: t247-ltx.
    endif.
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 09, 2008 at 04:53 AM

    rather than calling a function module and loading the entire function group in the memory...why don't you just write a CASE...ENDCASE statement as there are only 12 months.

    that will be much better from performance perspective

    but yes...if you are looking from language tranlation point of view also...the answers given above should be considered

    Edited by: Priyank Jain on Jul 9, 2008 12:54 AM

    Add comment
    10|10000 characters needed characters exceeded