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: 

name of the month

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Please use FM ISP_GET_MONTH_NAME.

Thanks,

Sriram Ponna.

9 REPLIES 9

Former Member
0 Kudos

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).

0 Kudos

it retrieves all the names of months.

This is not what I'm looking for

regards

ertas

Former Member
0 Kudos

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

Former Member
0 Kudos

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

12.01.2005 -> January

13.06.2000 -> June

0 Kudos

Look like the is none.

You can also do a direct select to table T247, that's how I usually do it if there is only going to be a single select

0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

Please use FM ISP_GET_MONTH_NAME.

Thanks,

Sriram Ponna.