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: 

converting month number to month name

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

CONVERSION_EXIT_LDATE_OUTPUT

10 REPLIES 10

Former Member
0 Kudos

CONVERSION_EXIT_LDATE_OUTPUT

0 Kudos

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?

Former Member

SELECT mnr

ktx

FROM t247

INTO TABLE it_month

WHERE spras = 'E'.

0 Kudos

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

Former Member
0 Kudos

Hi,

Please refer FM IDWT_READ_MONTH_TEXT.

Thanks,

Sriram POnna.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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