on 10-30-2012 6:47 AM
Hi All,
We have a requirement in WD ABAP to export table contents to excel. As we do not need any other ALV functionalities for the table we have been using the manual export to excel using the below approach.
DATA text TYPE string.
DATA xtext TYPE xstring.
LOOP AT LT_int_table INTO ls_structure.
CONCATENATE TEXT
ls_structure-field1
ls_structure-field2
ls_structure-field3
CL_ABAP_CHAR_UTILITIES=>NEWLINE into text separated by
CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
ENDLOOP.
IF text IS NOT INITIAL.
call function 'SCMS_STRING_TO_XSTRING'
exporting
TEXT = TEXT
importing
BUFFER = XTEXT.
WDR_TASK=>CLIENT_WINDOW->CLIENT->ATTACH_FILE_TO_RESPONSE(
I_FILENAME = 'Document.xls'
I_CONTENT = XTEXT
I_MIME_TYPE = 'EXCEL' ).
ENDIF.
The issue is - One of these fields <String field> have comma separated numbers like 123456,783241 etc i.e. it is two serial numbers separated by a comma.While converting to excel it is picking this field as a number and displaying 123,456,783,241 though the data type is string. Is there anyway the format can be preserved as on screen with just one comma as in the table, like a string field?
Any inputs or pointers will be of great help.
Thanks & Regards,
Gayathri Shanbhag
Hi,
The problem is that excel automatically formats the numbers.
If you can work with a tab delimited text file,you would be able to retain the formatting.
Thanks,
Sowmya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try putting a single quote (') before the number.
i.e. '12345,67890
Regards,
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.