04-21-2008 8:16 AM
I'm looking for a function module that converts current date into text
e.G.
22/02/2008
in english February the 22th, 2008
in french 22 février 2008
04-21-2008 8:23 AM
there are 2 ways to convet one is hard coding and one is using function module..kindly chekc which one suitea and reward points if useful
Use FM IDWT_READ_MONTH_TEXT to get the Month name for the given date.
Finally Concatenate date+5(1) 'th day of ' <LTX Value got from FM> space date+0(4) into a variable.
2 one..hard coding..
..
data: wl_day(2) type n,
wl_v(2),
wl_month(20).
move sy-datum+6(2) to wl_day.
case sy-datum+4(2).
when '01'.
write ' January ' to wl_month.
when '02'.
write ' February ' to wl_month.
...... and so on for every month. .....
endcase.
case sy-datum+7(1).
when '1'.
write 'st' to wl_v.
when '2'.
write 'nd' to wl_v.
when '3'.
write 'rd' to wl_v.
when others.
write 'th' to wl_v.
endcase.
Write the full format
write:/ wl_day, wl_v, ' day of ', wl_month, sy-datum+0(4).
04-21-2008 8:27 AM
Hi,
There is no FM which can convert the date directly into that format. You need to use the FM MONTH_NAMES_GET by giving the date3(2) and you will get the Month name. now you can concatenate as 'Month name' date0(2) 'th,' date+6(4) into a variable.
Hope you understood.
Regards,
Satish
04-21-2008 8:34 AM
Hi Stephan,
You can try this sample code..
DATA :w_date(25),
w_num type i,
w_num1 type i,
w_num2 type i.
CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'
EXPORTING
input = sy-datum
IMPORTING
OUTPUT = w_date
.
w_num = strlen( w_date ).
w_num1 = w_num - 8 .
w_num2 = w_num - 4.
CONCATENATE w_date3(w_num1) w_date0(2) ',' w_date+w_num2(4) into
w_date.
write : w_date.
Reward Points if useful.
Regards
R Adarsh
04-21-2008 8:43 AM
Hi,
Try with the FM: 'CONVERSION_EXIT_IDATE_OUTPUT' .
Regards,
Bhaskar