06-16-2008 10:32 PM
Hi!
Suppose I have any date and need a function module which returns me the name
of the month.
Regards
ertas
e.g.
12.01.2005 -> January
13.06.2000 -> June
06-17-2008 11:44 AM
06-16-2008 10:38 PM
Hi, try with FM : MONTH_NAMES_GET,
call function 'MONTH_NAMES_GET'
exporting
language = sy-langu
tables
month_names = t_t247
exceptions
month_names_not_found = 1
others = 2.
read table t_t247 with key mnr = p_date+4(2).
06-16-2008 11:22 PM
it retrieves all the names of months.
This is not what I'm looking for
regards
ertas
06-16-2008 11:40 PM
i know.. this it retrieves all the names of months. the read is for search only the name of the month that u required.
06-16-2008 11:54 PM
I need a FM which is be able to retrieve the name automatically
12.01.2005 -> January
13.06.2000 -> June
06-16-2008 11:56 PM
Look like the is none.
You can also do a direct select to table T247, that's how I usually do it if there is only going to be a single select
06-17-2008 5:53 AM
Hi llhan,
We can use the standard FM inside a Subroutine.
We will pass -
> Date
and it will return <----
Monthname.
Just copy paste.
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 m.
06-17-2008 11:34 AM
HI,
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.
This will surely help you.
Plz reward if useful.
Thanks,
Dhanashri.
06-17-2008 11:43 AM
Hi,
Try this..
Converting Month to Words
*
REPORT ZMONTH.
DATA X_MONTH(11).
CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'
EXPORTING
INPUT = SY-DATUM
IMPORTING
OUTPUT = X_MONTH.
WRITE:/ 'Month in words', X_MONTH+3(8).
*-- End of Program
Reward pts if helpfull.
Regards,
Dhan
06-17-2008 11:44 AM