07-30-2008 12:30 PM
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
07-30-2008 12:31 PM
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
07-30-2008 12:31 PM
07-30-2008 12:31 PM
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
07-30-2008 12:31 PM
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
07-30-2008 12:32 PM
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
07-30-2008 12:32 PM
07-30-2008 12:32 PM
07-30-2008 12:32 PM
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
05-04-2015 11:21 AM
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.
09-17-2021 5:18 PM
07-30-2008 12:32 PM
FM MONTH_NAMES_GET
use this....Searching in SDN u can get the same....
07-30-2008 12:34 PM
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
07-30-2008 5:31 PM
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.