‎2007 Dec 17 9:47 AM
Hi all,
I need to capture the month name in a variable.Example if the month is 02 then i need the result as February or if it is 12 then i need the result as December..
Is there any Function Module for the same..
Please suggest..
Thanks,
Arun
‎2007 Dec 17 9:50 AM
Use this code -
TABLES : t247.
DATA : v_mon(2) TYPE n,
v_date(10) VALUE '04.09.2007',
v_ltx LIKE t247-ltx,
v_ktx LIKE t247-ktx.
SELECT SINGLE ktx
ltx
INTO (v_ktx , v_ltx)
FROM t247
WHERE spras = sy-langu AND
mnr EQ v_date+3(2).
WRITE : v_ktx , v_ltx.
Otherwise use FM MONTH_NAME_GET.
I will prefer the above quote.
‎2007 Dec 17 9:50 AM
Not that I'm aware of but its easy to write one. Build a case statement around a FM/Routine Importing/Using the month number and Exporting/Changing the variable containing the month name. There are only 12 months so it should be short and simple.
Cheers,
Sougata.
‎2007 Dec 17 9:50 AM
Use this code -
TABLES : t247.
DATA : v_mon(2) TYPE n,
v_date(10) VALUE '04.09.2007',
v_ltx LIKE t247-ltx,
v_ktx LIKE t247-ktx.
SELECT SINGLE ktx
ltx
INTO (v_ktx , v_ltx)
FROM t247
WHERE spras = sy-langu AND
mnr EQ v_date+3(2).
WRITE : v_ktx , v_ltx.
Otherwise use FM MONTH_NAME_GET.
I will prefer the above quote.
‎2007 Dec 17 9:53 AM
hi,
using the following function module MONTH_NAMES_GET.
or
data: l_month(10) type c.
select ltx form t247
into l_month
where spras = 'EN'
and mnr = 12 "==> month.
Thanks & regards,
Vallamuthu.M
‎2007 Dec 17 9:53 AM
‎2007 Dec 17 9:54 AM
3 ways;
data:itab_month type standard table of T247
data: month_name type table of t247 with header line.
data: mm(2) type n.
*
mm = sy-datum+4(2).
*
CALL FUNCTION 'MONTH_NAMES_GET'
TABLES
MONTH_NAMES = month_name.
*
read table month_name index mm.
*
write: / month_name-ltx.
OR
REPORT ychatest2.
TABLES : t247.
DATA : v_mon(2) TYPE n,
v_date(10) VALUE '04.09.2007',
v_ltx LIKE t247-ltx,
v_ktx LIKE t247-ktx.
SELECT SINGLE ktx
ltx
INTO (v_ktx , v_ltx)
FROM t247
WHERE spras = sy-langu AND
mnr EQ v_date+3(2).
WRITE : v_ktx , v_ltx.
OR
Hi,
use sub srtingoperation, as below.
MONTH_NAMES_GET cannot be used to spell the month, it is used to retrieve the available month options in a perticular system and their possible representation.
if you want to spell the month use the FM ' SPELL_AMOUNT'.
Use sub string operation for this.
data: c1(2) type c,
d1 type d value '04.09.2007,
WORDS LIKE SPELL.
c1 = d1+3(2).
call function 'SPELL AMOUNT'
EXP
AMOUNT = C1
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = WORDS
WRITE: WORDS-WORD
‎2007 Dec 17 9:56 AM
Hi Arun,
You can use FM " Month_name_get"..
It would be better to write Case statements and create some piece of code.
Reward If Useful.
Regards,
Chitra Parameswaran