2014 Aug 06 6:03 AM
Hello there,
I have an ABAP program that selects data from tables into an internal table and writes the data in CSV (excel) file.
I have a very weird issue when writing the file: The data is written properly, though the dates in my data, which is written in yyyymmdd format, has different cell format in the csv file itself. I'll expain:
Let's say I've written into CSV file a table with name and birthdate, and I have 2000 records. From record 1 to 1475, when I right-click on the date cells in those lines, and choose "cell format", I can see it's in "general" format. From line 1476 on, when I do that I see that the date cells are in format of "custom" with pattern 'yyyymmdd'.
I want all the cells to be "general". How do I do that?
Thanks in advance
Hello there,
I have an ABAP program that selects data from tables into an internal table and writes the data in CSV (excel) file.
I have a very weird issue when writing the file: The data is written properly, though the dates in my data, which is written in yyyymmdd format, has different cell format in the csv file itself. I'll expain:
Let's say I've written into CSV file a table with name and birthdate, and I have 2000 records. From record 1 to 1475, when I right-click on the date cells in those lines, and choose "cell format", I can see it's in "general" format. From line 1476 on, when I do that I see that the date cells are in format of "custom" with pattern 'yyyymmdd'.
I want all the cells to be "general". How do I do that?
Thanks in advance
2014 Aug 06 6:19 AM
Hi Daniel,
Try using these Function Module......................
Before filling final internal table write those condition.................................
Data: gv_date TYPE mch1-vfdat,
gv_vdate(10) TYPE c.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
date_internal = gv_date
IMPORTING
date_external = gv_vdate
EXCEPTIONS
date_internal_is_invalid = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
2014 Aug 06 6:36 AM
Hello kabil,
I still want the date to be written as yyyymmdd format, but that the cell type will be "general" in excel.
2014 Aug 06 6:23 AM
2014 Aug 06 6:49 AM
Hi Daniel,
Try using the FM 'DATE_CONVERT_TO_FACTORYDATE'..
Regards,
SriLalitha.
2014 Aug 06 6:53 AM
Try to pass date as string.
As date which appears in internal table might be different and internal table filed type should not be date.
while outputting to Excel if you passfrom internal table which is having Date as string type will send data in your requirement format.
Thanks
Naveen
2014 Aug 06 10:04 AM
Note to all.
OP wants to set a cell property of CSV file. This can't be done because CSV format does not support cell properties.
However date data can be sent to CSV in a way that is not recognized by Microsoft Excel as a date.
Different ways to get around it can be found by searching.
/.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |