‎2005 Dec 15 7:28 AM
Hi,
i have a date like
20051215
i want to format it
like
15 dec 2005
using FM
Which FM is usful
I don't have CONVERT_DATE_TO_ALPHA_NUMERIC in my system.
If anybody knows tell me.
Thanks
Regards,
Nandha
‎2005 Dec 15 7:42 AM
Hi,
I hope you can find the month as 12 from the dateformat using
data : d1(8) value '20051215',
c1(2),
c2(10).
c1 = d1+3(2).
select ktx into x_ktx from T247 where spras = 'E'.
concatenate d16(2) x_ktx d10(4) into c2.
write c2.
Kindly reward points by clikcing the staR on the left of reply,if it helps.
‎2005 Dec 15 7:42 AM
Hi,
I hope you can find the month as 12 from the dateformat using
data : d1(8) value '20051215',
c1(2),
c2(10).
c1 = d1+3(2).
select ktx into x_ktx from T247 where spras = 'E'.
concatenate d16(2) x_ktx d10(4) into c2.
write c2.
Kindly reward points by clikcing the staR on the left of reply,if it helps.
‎2005 Dec 15 7:53 AM
Hi Nandha,
You already have the day and year right? And in any case you are going to call an FM. So, why not separate the month from the variable you have, convert it to a string ('jan, feb' etc), and then rearrange the srting you have to get the new converted date, in a custom FM or even a subroutine. I suppose that is exactly what the FM, if found, will do.
‎2005 Dec 15 8:02 AM
just separate the date month and year in separate variables, and concatenate them after converting month to month name using table T015M.
Regards,
Bikash
‎2005 Dec 15 9:54 AM
hi
either u can go for the solution suggested by the first post or can make use of the "case" stat for that:
str = 20051215.
str1 = str+4(2).
case str1.
when 1.
concatenate str6(2) 'JAN' ' ' str0(4) into final_str.
.........
......................................................
when 12.
concatenate str6(2) 'DEC' ' ' str0(4) into final_str.
endcase.
PLz reward points if it helps !!
Regards,
Gunjan
‎2005 Dec 15 10:54 AM
Hi nandha,
1. try this code (just copy paste)
2. It has a FORM subroutine,
which can be re-used anywhere.
REPORT abc.
*----
DATA : dtstr(12) TYPE c.
PARAMETERS : MYDATE TYPE SY-DATUM.
*----
START-OF-SELECTION.
PERFORM getdate USING MYDATE CHANGING dtstr.
WRITE 😕 dtstr.
*----
FORM - MULTI-PURPOSE FORM
*----
FORM getdate USING mydate CHANGING dtstr.
DATA : dd(2) TYPE c.
DATA : mm(2) TYPE c.
DATA : yyyy(4) TYPE c.
DATA : mon(3) TYPE c.
DATA : month_names LIKE TABLE OF t247 WITH HEADER LINE.
dd = mydate+6(2).
mm = mydate+4(2).
yyyy = mydate+0(4).
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 WITH KEY mnr = mm.
IF sy-subrc = 0.
mon = month_names-ktx.
ENDIF.
CONCATENATE dd mon yyyy INTO dtstr
SEPARATED BY space.
ENDFORM. "getdate
regards,
amit m.