Application Development and Automation 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: 
Read only

Function module for Month Name? Urgent

Former Member
0 Likes
4,320

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.

13 REPLIES 13
Read only

Former Member
0 Likes
2,061

Hi,

Just use this FM: ISP_GET_MONTH_NAME.

Regards,

Read only

Former Member
0 Likes
2,061

HI,

ZQUA_CONV_DATE_MONTH

regards

Nicole

Read only

alpesh_saparia3
Active Contributor
0 Likes
2,061

You can find month names in table T015M.

- Alpesh

Read only

Former Member
0 Likes
2,061

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

Read only

former_member189059
Active Contributor
0 Likes
2,061

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

Read only

Former Member
0 Likes
2,061
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.
Read only

varma_narayana
Active Contributor
0 Likes
2,061

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>

Read only

0 Likes
2,061

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??????

Read only

Former Member
0 Likes
2,061

MONTH_NAMES_GET

Read only

Former Member
0 Likes
2,061

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

Read only

Former Member
0 Likes
2,061

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.

Read only

0 Likes
2,061

This message was moderated.

Read only

0 Likes
2,061

Mukesh Das


Srinivas P



My dear friends  its a 7 year old thread


Nabheet