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

Former Member
0 Likes
1,135

hello

i need a function module which will give o/p like may 2006 when i enter 5 2006.

thanks in advance

sarangan r

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,103

use FM MONTH_NAMES_GET

after u get the the values in then table ,u can write ur logic by looping in the table and getting the value of month.

loop at itab.

if itab-ktx = 'MAY'.

l_month = itab-mn.

endif.

endloop.

l_month will store the value of 5

8 REPLIES 8
Read only

Former Member
0 Likes
1,103

Hi

You should used fm MONTH_NAMES_GET to find out the the name of the month.

Max

Message was edited by: max bianchi

Read only

0 Likes
1,103

Hi use this FM,

MONTH_NAMES_GET

pass the language and date+0(2)

thanks

vijay

Read only

venkata_ramisetti
Active Contributor
0 Likes
1,103

Hi,

Use function Module MONTH_NAMES_GET

to get month name.

Read month name using month number from the above table.

Concatenate month name with year.

Thanks,

Ramakrishna

Read only

Former Member
0 Likes
1,104

use FM MONTH_NAMES_GET

after u get the the values in then table ,u can write ur logic by looping in the table and getting the value of month.

loop at itab.

if itab-ktx = 'MAY'.

l_month = itab-mn.

endif.

endloop.

l_month will store the value of 5

Read only

Former Member
0 Likes
1,103

Hi,

You can write your own code..to get month name from the month number entered and then use <b>concatenate</b> statement to get your output.

Regards,

Raj

Read only

Former Member
0 Likes
1,103

T015M table has the Names of the months.

Read only

Former Member
0 Likes
1,103

Hi,

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 Mittal

Read only

sreekanthgo
Contributor
0 Likes
1,103

Hi,

Check this...

You will get all month names.. depending on the month you get in the date..you can get the month name from this function module..from the table parameter..MONTH_NAMES..

MONTH_NAMES_GET

Thanks,

Sreekanth G