Leading zeros deleted while downloading to excel sheet
Hi ,
i am downloading data to excel sheet from internal table, iam using gui_download but its deletin leading zeros can any one tell me as to how i go about this
for ex i ahve a mterial no : 00123
i see 123 i want it to be 00123
Thanks
kajol
Hi,
try to explain to excel, that this field is character field (I think that it will be done by adding single quote as first character of string).
Pointing to my previous answer try:
Constants: c_single_quote(1) type c value ''''. " I _hope_ it works
loop at itab.
concatenate c_single_quote itab-matnr to texttab-c_matnr.
endloop.
Similar Messages
-
Field value is truncated while downloading to excel sheet from ALV report
Hi All,
I developed ALV report and displaying output.
In that output i had a filed VBRP-PRODH filed.
In the output it is coming correctly but while i click downlaod to excel the valus is truncted.
for Example the value for VBRP-PRODH is 03322764170100201
while downlaoding this one to excel it is showing 3322764170100200
Any inputs please..
Regards
JaiWrong forum..post in ABAP
-
Truncation of leading Zeros when Down Loading into Excel - OLE Objects
Hi,
Can any one help me on this.
I am using <b>OLE Objects</b> to download Data into Excel Sheet. Data with leading Zeros is getting truncated in Excel.
Ex: Report Output is showing Plant Number as 0002. But when i am downloading to Excel Plant value will become 2 .
I would like to have it as 0002 in Excel.
I have declared Werks as CHAR of 4.I am using OLE Obects for Downloading into Excel Sheet.
I am using "OLE2_OBJECT" I can not use any other FMs to down load to Excel.As i am modifying this program not creating.
Thanks In Advance.
K.Nirmala
Message was edited by: Nirmala ReddyHi Nirmala,
While downloading to excel sheet, u need to change the number format of cell from General to Text, then leading zero's won't get deleted. For that u need to set the property of the cell. Please check this sample code,
INCLUDE OLE2INCL.
tables : zobrent.
data : it_kna1 type table of zobrent with header line.
handles for OLE objects
DATA: H_EXCEL TYPE OLE2_OBJECT, " Excel object
H_MAPL TYPE OLE2_OBJECT, " list of workbooks
H_MAP TYPE OLE2_OBJECT, " workbook
H_ZL TYPE OLE2_OBJECT, " cell
H_F TYPE OLE2_OBJECT. " font
DATA H TYPE I.
DATA: cell1 TYPE ole2_object.
*& Event START-OF-SELECTION
START-OF-SELECTION.
select * from zobrent into table it_kna1
where zopanid = '10001'
and zo_brent = '050'.
start Excel
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
get list of workbooks, initially empty
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
PERFORM ERR_HDL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP.
PERFORM ERR_HDL.
output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'EDate'.
PERFORM FILL_CELL USING 1 2 1 'Brent'.
PERFORM FILL_CELL USING 1 3 1 'Zopanid'.
PERFORM FILL_CELL USING 1 4 1 'Contract Type'.
PERFORM FILL_CELL USING 1 5 1 'Price Type'.
PERFORM FILL_CELL USING 1 6 1 'Installation Type'.
PERFORM FILL_CELL USING 1 7 1 'Volume'.
PERFORM FILL_CELL USING 1 8 1 'AQ'.
PERFORM FILL_CELL USING 1 9 1 '00000123'.
LOOP AT IT_KNA1.
copy values to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_KNA1-zo_effdat.
PERFORM FILL_CELL USING H 2 0 IT_KNA1-zo_brent.
PERFORM FILL_CELL USING H 3 0 IT_KNA1-zopanid.
ENDLOOP.
CALL METHOD OF h_excel 'Cells' = cell1
EXPORTING
#1 = 1
#2 = 1.
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
if sy-subrc eq 0.
write : / 'year'(001).
endif.
FORM FILL_CELL
sets cell at coordinates i,j to value val boldtype bold
FORM FILL_CELL USING I J BOLD VAL.
CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
PERFORM ERR_HDL.
GET PROPERTY OF H_ZL 'Font' = H_F.
PERFORM ERR_HDL.
SET PROPERTY OF H_F 'Bold' = BOLD .
PERFORM ERR_HDL.
***Changing the format of the cell from General to Text
<b>SET PROPERTY OF H_ZL 'NumberFormat' = '@'.</b>
PERFORM ERR_HDL.
SET PROPERTY OF H_ZL 'Value' = VAL .
PERFORM ERR_HDL.
ENDFORM.
*& Form ERR_HDL
FORM ERR_HDL.
IF SY-SUBRC <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
U just paste this code in a sample program & see.
Please reward, if found helpful. -
Leading 0 while downloading to excel
Hi All,
I am displaying my output in ALV using REUSE_ALV_GRID_DISPLAY,but when i download the report to excel using standard download button in the tool bar(local file icon), the leading zeros are getting truncated
eg 0004 is displayed as 4
field is VBKD-ZTERM....
Whats the way out?
<REMOVED BY MODERATOR>
Regards
Gunjan
Edited by: Alvaro Tejada Galindo on Mar 4, 2008 2:52 PM1.Introduce another field in internal table of type Numeric.
2.Before you pass the internal table to Reuse_alv_grid Display
3.Move the character field to Numeric type and use this
numeric field to display in Reuse_alv_grid_display.
Then the leading zeros will also be displayed while downloading to Excel.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Mar 4, 2008 2:53 PM -
Warning while downloading an Excel file from WD ABAP
Hi folks,
In one of requirements, Client wants to download all the data that is appearing on the screen ( WD ABAP Application ) to an Excel with a layout in different manner.
We achieved this with Simple Transformations.
Now the question is while downloading the excel file, the framework/other is throwing an Warning like
" The file you are trying to open, 'info.xls', is in a different format than specified by the extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now? "
Note: All the users of my client are using MS Office 2002 / 2003.
I am using the following code........!
*------ Call Transformation for Excel OUTPUT
CALL TRANSFORMATION ZEXCEL_OUTPUT
SOURCE
t_dates = t_dates
t_info = t_info
RESULT XML l_xml_string.
REPLACE ALL OCCURRENCES OF '<?xml version="1.0" encoding="utf-16"?>' l_xml_string WITH '<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?>'.
**-- Call Function Module for converting string data to XSTRING
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = l_xml_string
mimetype = 'application/xml'
IMPORTING
buffer = l_xml_xstring
EXCEPTIONS
failed = 1
OTHERS = 2.
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = 'info.xml'
i_content = l_xml_xstring
i_mime_type = 'application/vnd.ms-excel'.
With this code I am generating a file of type XML SPREADSHEET 2003. While opening this file I am getting the above message which the user unwanted......
Can any one help me on this -
> How to avoid this warning?
Thanks and Regards,
Aneel Danda
Edited by: danda aneel on Jul 13, 2010 1:43 PMFirstly, Thanks for Your quick Response, Thomas.
Even though what ever may be the file name I am passing either info.xml or Info.xls , In error info.xls is coming.
Kindly provide me an alternative on this XML doesn't seem like it would match the 'application/vnd.ms-excel'.
what is the supported format.?
Similarly, It is not considering the UTF-8 / UTF-16 for xml.........same result is appearing in the output.
Edited by: danda aneel on Jul 14, 2010 7:52 AM -
While downloading to Excel Currency field should Blank instead of 0.00
Hi All,
While downloading to excel from ALV report currency field is downloading as 0.00. My requirement is when the value is 0.00 it should download as blank.
I tried by changing the data type to char but still have problem. Any idea how to fix it??
Regards,
JitendraHi Jitendra,
Please paste your sample code to understand Clearly.
Regards,
Srikanth -
Problem in downloading to excel sheet
hi,
i have a file in the application server which needs to be downloaded into excel sheet and send it via attachment to outlook id's..
file is getting downloaded into excel sheet ( Via custom function module) and the attachment is being sent to the mail box, but the problem is everything appears in the first column..how to set the delimiters in excel sheet, i mean each field should appear in a separate coloumn...
format of the file in the application server
data: begin of dt_string occurs 0,
data(150) type c,
end of dt_string.
ex: dt_string+0(4) = 'name'.
dt_string+4(5) = 'place'. .....
append dt_string
clear dt_string.
same way, each record is inserted into the dt_string and the table was transferred to the app server.
thanksHi Mahesh,
Assuming that you are using 'GUI_DOWNLOAD'.
Add the thing in bold <b>WRITE_FIELD_SEPARATOR</b>.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename =
* FILETYPE = 'ASC'
* APPEND = ' '
<b> WRITE_FIELD_SEPARATOR = '#' "Tab Delimiter between fields</b>
Regards,
AS -
Leading zeros from data downloads
Hello!
While downloading data from the ABAP tables, Excel removes the leading zeros automatically but in some SAP tables (NAST for example), those leading zeros are necessary to find the required associated data. Is there any way to prevent Excel from removing these zeros?
Thanks a lot!Hi,
There are two ways to solve it.
1) select complete columns in the Excel sheet and then assign the number format as ' TEXT ' in the sheet.Then u ll be able to see the leading zero's
2) If u donot want to wrk in Excel the way i have mentioned,then in the abap program just use the FM
"CONVERSION_EXIT_ALPHA_INPUT" over that field before uploading in a table.
By mistake i have told u the wrong way.the first way is for copying the data from text file to excel file and preserving the leading zeros.
regards
kanishak
Edited by: Kanishak Gupta on May 6, 2009 5:36 AM -
Download to excel sheet from ALV Grid report
Hi,
I need to download 3 lakhs of data to excel sheet but the constraint is that excel is having max limit of 65000 line items.
So i need to know the way in which i can create more than one sheet in excel while downloading so that each sheet can hold upto 65000 line items.
i need to create atleast 6 sheets in excel while downloading from report.
please help.Hi,
While downloading the data, it will prompt you save the list in file - Uncoverted, Spreadsheet, Rich text format, HTML format, Copy to Clipboard.
Why don't you try using Uncoverted format and give extension as .txt file.
So that you can download all 3 lacs of records.
Even if you use any FM, it will indirectly use excel for downloading and it will have restriction of having 65000 records only.
Thanks,
Sriram Ponna. -
Sap FICO tables download to excell sheet
hi,
I want to download the fico master tables to excell sheet.
somebody told me to SE16N and system-list-save-local file-(spread sheet)
while doing the same procedure i am struggling in localfile when i am clicking in same after that local file that time local file is showing properly, local file is there that is not allowing to pointout, therefore please explain me how to do and get the FICO master tables to excell sheet.
waiting your reply soon.
by
sujathaHi,
Transaction code SE16N enables to enter a specific table and get the contents or records in the table. Which table name you have entered for getting the Master Data tables?
Some of the Master data tables in FICO are as under:
SKA1 GL Accounts CoA data
SKB1 GL Accounts CC Data
BNKA Bank master record
KNA1 Customer master
KNB1 Customer / company
KNVV Customer sales data
KNBK Bank details
KNVH Customer hierarchy
KNVP Customer partners
KNVS Shipment data for customer
KNVK Contact persons
KNVI Customer master tax indicator
LFA1 Vendor master
LFB1 Vendor per company code
LFB5 Vendor dunning data
LFM1 Purchasing organization data
LFM2 Purchasing data
LFBK Bank details
KNMT Customer material info record
BNKA Master bank data
CSKS Cost Center Master Data
CSKT Cost center texts
CRCO Assignment of Work Center to Cost Center
Thanks
Murali. -
WUO-712 : Webutil Error while downloading into Excel
Hello Everyone,
I have installed oracle Application server 10g (10.1.2.0.2) with webutill.
But while downloading data into Excel sheet it's through an error WUO-712 randomly due to which some of the data is missed out.
We have installed webutil 10.5 with forms and reports 10g.
Please suggest some solution for the same.
Please revert for the same ASAP.
Thanks in advance
Regards,
Ajinkya
Edited by: Ajinkya on Nov 3, 2009 10:45 PMPlease reply for this thread.......:)
-
Getting Error while overiting the excel sheet
Hello,
My requirement is to overwrite the excel sheet instead of appending the next records. What I do to achieve this is drop sheet first then create sheet again. While doing this in execute sql task I am getting errors.
[Execute SQL Task] Error: Executing the query "CREATE TABLE `testtt` ( `case` VARCHAR(10), `case1` VARCHAR(50) ) " failed with
the following error: "Cannot modify the design of table 'testtt'. It is in a read-only database.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not
established correctly.
Same error for drop too. This is working fine when I do locally but when deploy it on server I get this type of errors. I assume this might be issue with accesses.
Please suggest me.
Ramu GadeHi Naveen,
Thanks for your reply. I am dropping the excel sheet and then creating the excel sheet and then exporting the data from database to this sheet. The whole idea is to avoid appending of the records to this sheet, it should be new records all together.
I am not sure if deleting the entire excel file and then creating the excel sheet will work. And other thing is that it works locally but when I point that package in my sql agent job then it fails with above error that I have mentioned in my first
conversation.
Please suggest.
Regards.
Ramu Gade
Why not create a excel template before hand which you can copy,rename and use each time. This will avoid appending records each time
See this as an example
http://visakhm.blogspot.in/2013/09/exporting-sqlserver-data-to-multiple.html
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
Delete a column in excel sheet through POI?
hi
Can anyone help me out on physically deleting a column in Excel using POI framework?
Though I am able to remove indidual cells,the cells remain blank. I want them be completly removed from the sheet.
pls helpSoph wrote:
hi
Can anyone help me out on physically deleting a column in Excel using POI framework?
Though I am able to remove indidual cells,the cells remain blank. I want them be completly removed from the sheet.
pls helpCan you do it in the Excel in your PC? I bet not
Then you are able to help me how to generate a chart in Excel using POI :D :D
But first, where to download POI library, Thanks
{EDIT} found it never mind
Edited by: mycoffee on Jul 1, 2010 12:15 PM -
Function module to download into excel sheet in crm
Hi,
Needed the Function module to download the data from internal table into the excel sheet in the CRM
<b></b>use
FM :- GUI_DOWNLOAD
Example Code.
lv_file_name = 'c:abcd.xls'
*----Load Detail Report Data to Excel File
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_file_name
filetype = 'DAT'
write_field_separator = 'X'
codepage = '4103'
TABLES
data_tab = lt_det_report
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
ENDIF.
IF sy-subrc <> 0.
* 202 : Error Occurred while writing data to the file.
MESSAGE e202(zusm_gen) .
EXIT.
ELSE.
WRITE :/ text-042 , lv_file_name.
ENDIF.
:- lt_det_report---> is table for storing data .
it can be any type
<b>Please Reward Points & Mark Helpful Answers</b>
To mark Helpful Answers ;click radio Button next to the post.
RadioButtons
<b>o</b> Helpful Answer
<b>o</b> Very helpful Answer
<b>o</b> Problem Solved.
Click any of the above button next to the post; as per the anwers
<b>To close the thread; Click Probelm solved Radio Button next to the post , which u feel is best possible answers</b> -
Alv output download to excel sheet spliting into three line
hi,
i have developed alv report with 62 fields (62 colums).when i download this output into excel sheet each line spliting into three line.each field has 20 char length.i want download each row as single line.
i am using local file (ctrl + shift+F9) -> spreadsheet option
please advice me to solve this issue. i am using fm REUSE_ALV_GRID_DISPLAY.
In layout i am using
DATA: min_linesize like sy-linsz, " if initial min_linesize = 80
max_linesize like sy-linsz. " Default 250
min_linesize = 100.
max_linesize = 1000.
gt_layout-zebra = 'X'. "space.
gt_layout-colwidth_optimize = space.
gt_layout-max_linesize = min_linesize.
gt_layout-max_linesize = max_linesize.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_bypassing_buffer = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET-PF-STATUS'
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = gt_fieldcat[]
it_events = gt_events[]
is_layout = gt_layout
is_variant = v_stru_disvar
i_default = 'X'
i_save = 'A'
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_final[]
EXCEPTIONS
program_error = 1
OTHERS = 2
Edited by: Raja Ram on Aug 4, 2009 12:40 PMsolved
Maybe you are looking for
-
My current project is like many I have created in the past. I have removed the sound from my video clips and laid another soundtrack under the entire project. Now, when I add an iphoto still image to the project, when it goes back into video there
-
okay so i updated itunes and now it wont let me sync anything it keeps giving me that "you can only be synced with one computer at a time erase and sync" but this is the only computer ive ever used!!! pleeeease help!! <Edited By Host>
-
Hey guys.. I'm plagued with this problem and haven't found a solution yet so I'd thought I'd come the experts: We routinely ship partial qty's per delivery line to customers if they choose.. ie- SalesOrder is for 3 widgets and we only have 1. We'll s
-
My requirement is to create a page in my apex application which accepts xml file/ xml data, does some processing on the data and finally populates the undelying database tables. Its like a import xml utlity for the user of my apex application. Can an
-
Back to School Deals, TVs & Home Theater
We've got some great deals on TV and Home Theater products as part of our Back to School Deals*. There are TVs from Samsung, Insignia, LG, Toshiba and Vizio, as well as some TV mounts, Blu-ray players, home audio systems and more! Here are some of th