2007 Aug 30 9:08 AM
Hi,
Is there any function module to get month name for a date, like
if input is 30.08.2007, then output should be 'AUG' or 'August'.
Anyone can help me...
Thanks in Advance.
Siva Sankar.
Hi,
Is there any function module to get month name for a date, like
if input is 30.08.2007, then output should be 'AUG' or 'August'.
Anyone can help me...
Thanks in Advance.
Siva Sankar.
2007 Aug 30 9:17 AM
2007 Aug 30 9:18 AM
2007 Aug 30 9:18 AM
2007 Aug 30 9:18 AM
Hi,
for this you can just write a logic.Split the date and get the month no in one variable and then write a case statemnt to get the moth name...
date = 30082007
month = date+2(2)
you will have the value 08 in variable month.
now
case month.
when '01'.
month_alpha = 'JAN'.
when '02'.
month_alpha = 'FEB'.
.......
.......
......
when '12'.
month_alpha = 'DEC'.
hence you can do the task.
please reward if helpful.
thanks
vivekanand
2007 Aug 30 9:18 AM
hello,
you can refer to the table T247 to get the months of the year
the function module MONTH_NAMES_GET will fetch all the months of the calendar
2007 Aug 30 9:19 AM
Hi siva,
check this if it can help u
REPORT ZTEST.
TABLES : T247.
DATA : V_DATE(10) VALUE '30.08.2007',
V_MON(2) TYPE N,
V_LTX LIKE T247-LTX.
V_MON = V_DATE+3(2).
SELECT SINGLE LTX FROM T247 INTO V_LTX WHERE MNR EQ V_MON AND SPRAS EQ SY-LANGU.
WRITE : V_LTX.
2007 Aug 30 9:19 AM
hi Shiva..
Call the FM
ISP_GET_MONTH_NAME
Pass the Date in User(External) format and Language.
It will return the Name of the Month
<b>reward if Helpful</b>
2014 Feb 10 11:31 AM
that's for single date if it is range like that:
09.09.2001 to 06.06.2002
in that case how to do that??????
2007 Aug 30 9:22 AM
2007 Aug 30 9:30 AM
hi,
Refer this sample code
REPORT ztest_tmp.
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
2007 Aug 30 9:43 AM
Hi Siva,
You can go for any one of the following methods
Method 1******************************
parameters: p_date type sy-datum default sy-datum.
data: v_month like t247-ktx.
select single ktx into v_month from t247
where spras = sy-langu and
mnr = p_date+4(2).
write:/ 'Month = ', v_month.
Method 2******************************
parameters: p_date type sy-datum default sy-datum.
data: v_month like t247-ktx,
month_names like t247 occurs 0 with header line.
CALL FUNCTION 'MONTH_NAMES_GET'
EXPORTING
LANGUAGE = SY-LANGU
IMPORTING
RETURN_CODE = RETURN_CODE
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.
read table month_names with key spras = sy-langu
mnr = p_date+4(2).
if sy-subrc = 0.
v_month = month_names-ktx.
endif.
write:/ 'Month = ', v_month.
2014 Feb 10 11:41 AM
2014 Feb 10 11:44 AM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |