09-15-2012 12:24 PM
Hi,
Is There any function module to covert date format.
I have tried an abap logic
when i am trying to download the report to excel the date format should be change
The date 10-01-2012 in this case it is coming perfect
This date 1-01-2012 in this case when i am downloading into excel it will come like this 1/1/2012
please give me some suggestions.
Best Regards,
Sankar.
09-15-2012 1:02 PM
Hi,
Here is a code to do the conversion:
DATA: days(2) type c,
months(2) type c,
years(4) type c.
data date type string VALUE '1-01-2012'.
SPLIT date at '-' INTO days months years.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = days
IMPORTING
OUTPUT = days.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = months
IMPORTING
OUTPUT = months.
CONCATENATE days months years INTO date SEPARATED BY '-'.
you can loop over the data and do this conversion and your done.
Best,
Iftah
09-15-2012 3:17 PM
Hi Sankar,
It sounds like it is Excel that is reformatting the date string. Try wrapping your date string in double quotes before passing to Excel, e.g., instead of passing the string 1-01-2012 to Excel, pass "1-01-2012". Excel won't display the quotes and it should treat the value as text and not reformat it.
Cheers,
Amy
09-16-2012 2:16 AM
Hi Sankar,
You can try with the below code.
data : date like sy-datum,
datec(10) type c.
write date to date10 dd-mm-yyyy.
(or)
.
Try to convert using below FM.
CONVERSION_EXIT_PDATE_OUTPUT - Conversion Exit for Domain GBDAT: YYYYMMDD -> DD-MM-YYYY
Kind Regards,
Balaji
09-17-2012 5:13 AM
Hi
you can change the format of date in excel itself or the best way you can follow is pass value between single quotes. you may get solution.
09-17-2012 7:26 AM
Hi,
My suggestion, format the column in excel to required data format and then paste the data in the cells using OLE concepts.
Thanks and regards,
Kartik