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: 

FM for getting MONTH name from DATE.

Former Member
0 Kudos

Hi all ,

We have a requirement to get Month name from the DATE,e.g IF date is 01/01/2008 we need a FM which can generate month name as 'JANUARY'.

\[removed by moderator\]

Thanks and Regards

Kiran

Edited by: Jan Stallkamp on Jul 30, 2008 4:26 PM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Kiran,

Try MONTH_NAMES_GET

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.

Regards,

Chandra Sekhar

12 REPLIES 12

Former Member
0 Kudos

hiiii

use FM

ISP_GET_MONTH_NAME

MONTH_NAMES_GET

regards

twinkal

Former Member
0 Kudos

hi check this..

MONTH_NAMES_GET

or use this..

REPORT ZMONTH.

DATA X_MONTH(11).

parameters:p_date like sy-datum.

CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'

EXPORTING

INPUT = p_date

IMPORTING

OUTPUT = X_MONTH.

WRITE:/ ' Month and Date', X_MONTH+3(8).

Edited by: venkat appikonda on Jul 30, 2008 1:33 PM

Former Member
0 Kudos

Hi Kiran,

Try MONTH_NAMES_GET

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.

Regards,

Chandra Sekhar

Former Member
0 Kudos

HI kiran,

Use the FM:-

MONTH_NAMES_GET

For an example:-

[MONTH_NAMES_GET Example|http://abaplovers.blogspot.com/2008/05/sap-abap-function-module-to-get-month.html]

Best of luck,

Bhumika

former_member188829
Active Contributor
0 Kudos

Hi,

Use the Function MOdule MONTH_NAMES_GET

Former Member
0 Kudos

use FM MONTH_NAMES_GET and read the required month ..

former_member705122
Active Contributor
0 Kudos

Hi,

Run this sample code,

PARAMETERS:
  p_date TYPE sy-datum.

DATA:
  w_date(10) TYPE c.

CALL FUNCTION 'ISP_GET_MONTH_NAME'
  EXPORTING
   date               = p_date
    language           = sy-langu
*   MONTH_NUMBER       = '00'
 IMPORTING
*   LANGU_BACK         = LANGU_BACK
   longtext           = w_date
*   SHORTTEXT          = SHORTTEXT
 EXCEPTIONS
   calendar_id        = 1
   date_error         = 2
   not_found          = 3
   wrong_input        = 4.

WRITE: w_date.

Regards

Adil

0 Kudos

Thanks for the correct answer ISP_GET_MONTH_NAME!

The FM MONTH_NAMES_GET in the correctly marked answer gives the list of all month names NOT based on date.

0 Kudos

ISP_GET_MONTH_NAME is not available in S4

former_member195383
Active Contributor
0 Kudos

FM MONTH_NAMES_GET

use this....Searching in SDN u can get the same....

Former Member
0 Kudos

Hi,

Here is the code u required...

REPORT ZASHU_MONTH_NAMES_GET.

data:r_code type sy-subrc.

data:mnames type standard table of T247 with header line.

CALL FUNCTION 'MONTH_NAMES_GET'

EXPORTING

LANGUAGE = SY-LANGU

IMPORTING

RETURN_CODE = r_code

TABLES

month_names = mnames.

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

write:/ mnames.

Thanks & Regards

Ashu Singh

krystian_parada
Explorer
0 Kudos

Hi...

Here´s this i hope helps you...

CALL FUNCTION 'MONTH_NAMES_GET'

EXPORTING

language = 'S'

TABLES

month_names = it_meses[]

EXCEPTIONS

month_names_not_found = 1

OTHERS = 2.