Preserving prefixed zeros in down load to excel file
In My application lot of character field have character zero as the starting characters. Like Company code= 0600, Property= 00390898 .
When I do a download from Internal table to excel sheet, this character fields are showing with the zeros in front like 600 & 390898. Is there any way preserve the zeros in the excel sheet ?
Also I would Like to know How can I move the character ( ' ) . If I used ''' then it gives compile error.
If I can prefix this character ( ' ) , the field's will be shown with the zeros.
Thanks for your help.
Manoranjan
Hi Manoranjan,
What is the data type you are using for the Company Code in your internal table?
You can try this way.Suppose your main internal table is itab1 where in the company code is refering the database table (T001-BUKRS).
Declare one more internal table itab2 with company code as Character data type.
Before downloading to excel move itab1 to itab2 and then try to use that itab2 for downloading. Now your excel sheet will have the numbers with zeros preceeding.
Another option is after downloading to excel, I think you can change the properties of the column through Format Cells->Number tab->Text.
Thanks,
Srinivas
Similar Messages
-
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. -
Hi gurus,
I wanna generate a report that should download the data from the internal table to the presentation server in word formart, but the length of the word file should not be greater than 156 characters as the downloaded data is sent to RBI.
Thanks and Regards,
Alson.Hi Alson,
you can wrap the text to a length of 156 chars using the function module:-
CALL FUNCTION 'RKD_WORD_WRAP'
for eg if u have any variable v_text which is 1000 chars long then u can give the outputlen = 100. This way u can split 1000 chars into 1000/100 = 10 rows. you can either store these lines in an internal table or it is also possible to store these as separate variables each of length 100 chars .
you can refer to the following code:-
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
textline = v_text
DELIMITER = ' '
outputlen = 156
TABLES
out_lines = i_long_text
EXCEPTIONS
outputlen_too_large = 1
OTHERS = 2.
Plz reward points if useful.
Thanks
Rahul -
Stuck - load the Excel file dynamically with different columns and worksheet names
I have a situation where I want to load the Excel file dynamically, and the excel file have different columns or even worksheet name. Any idea how I could
approach this? I believe there's no way to modify the meta data (specifically the mapping) in the data flow.Hi Chimumu,
The SSIS stock adapters don't supporting dynamic column mapping, to achieve your goal, you need to use Script Task/Component to read the Excel sheet name and the columns in the worksheet, and then map to the output columns of the script component. You can
also refer to the following blogs:
http://micktechblog.blogspot.com/2011/06/ssis-excel-import-with-unknown-number.html
http://wikiprogrammer.wordpress.com/2011/04/08/dynamic-column-mapping-in-ssis-part-1/
Regards,
Mike Yin
TechNet Community Support -
Hi all,
I am sorry i am asking this question here but i cant find TOAD specific thread.
I want to load an excel file from OS to my database table using TOAD.
Can anyone tell me how to do this?
Thanks
Edited by: user10380680 on Nov 6, 2008 3:17 PMHi,
Check the steps given by "sbmk_design " using TOAD.
How to load excel-csv file into oracle database
Else go for
SQL LOADER
http://www.adp-gmbh.ch/ora/tools/sql_loader/example_3.html
http://lbd.epfl.ch/f/teaching/courses/oracle8i/server.815/a67792/ch04.htm
- Pavan Kumar N -
How can we load an excel file to BI system?
If then can we load a file having multiple sheets inside it?Check if you have the mapping done for it, also only the active sheet will be uploaded.
-
I have just renewed my PC ( old one self destructed) and want to re- down load my purchased files onto my new computer. How do I do this?
Copy the media from the old computer or the backup of the old computer to the new computer.
-
Loading an Excel file into a Z-Table
Hi Gurus,
Can somebody guide me how to load an excel file into a Z-Table.Hi,
You need to write a ABAP code for this....
The following is the code for loading data into an internal table:
types: begin of ttab,
rec(1000) type c,
end of ttab.
types: begin of tdat,
fld1(10) type c,
fld2(10) type c,
fld3(10) type c,
end of tdat.
data: itab type table of ttab with header line.
data: idat type table of tdat with header line.
data: file_str type string.
parameters: p_file type localfile.
at selection-screen on value-request for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting
static = 'X'
changing
file_name = p_file.
start-of-selection.
file_str = p_file.
call function 'GUI_UPLOAD'
exporting
filename = file_str
tables
data_tab = itab
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
delete itab index 1.
loop at itab.
clear idat.
split itab-rec at cl_abap_char_utilities=>horizontal_tab
into idat-fld1
idat-fld2
idat-fld3.
append idat.
endloop.
loop at idat.
write:/ idat-fld1, idat-fld2, idat-fld3.
endloop.
From this internal store it onto the database.....
Sharma one more thing you must have posted this question in ABAP fourum for better results....
Hope it helps,
Thanks,
Happy Life,
Aravind -
How to down load the .js files
Hi Experts
How to download the individual js files attached to the Workspace Applcation ?
I tried to down load the Uploaded file Using FireFox when i Saved the Files & it is saving all the uploaded Files in one page !
Instead of this i wanted to download an individual file wise as we uploaded to the Application
We use Apex 4.0/Oracle 10g/Unix OS
many thanks
Edited by: jrDba - atm on Jun 1, 2011 1:14 AM
Edited by: jrDba - atm on Jun 1, 2011 1:23 AMjrDBA,
You can use Firefox + Firebug to see the associated APEX JavaScript files. Keep in mind that the APEX JJavaScript files are minified - compressed so that they are hard to read, but smaller to transmit. Thus, you will need a de-minifier tool to read them. There's a number of those available for use with Firefox - one that comes to mind that actually integrates with Firebug is YSlow.
Thanks,
- Scott -
http://spendolini.blogspot.com
http://www.sumneva.com -
How to down load videos on file on my comuter to my ipad using itunes
with the new itues,how do I down load movies on file in my computer (which I got from Grabiod) down to my ipad?
Nothing to download.
Import the content to iTunes and sync it to the iPad, this assumes the media is in a format supported by iTunes and the iPad. -
Hi I changed my version of acrobat from 8 to X Pro, now I get this message when down loading an acrobat file. I tried to create a new down load folder, did not help. Cannot find where tochange the association in preferences.
C:\DOCUME~1\Owner\LOCALS~1\Temp\Image Honda MPR Oct - Dec 2011-2.pdf could not be opened, because the associated helper application does not exist. Change the association in your preferences.
Thanks,
[email protected]Message was edited by: leroydouglas
better yet, try this solution:
https://discussions.apple.com/message/12351186#12351186 -
Se16 down load into excel sheet problem with PO number
Dear All,
While I download vbak table data using se16 from table VBAK ( using System > List> save --> local File --> Spreadsheet ), I get the PO number converted as error like at it's end, the last digit is becoming zero when po number is of 16 digits. means only the last digit is converted to 0.
For example : se16 -> vbak table -> the po numbers
1238643210249039, when I down load in the excel sheet it is appearing as 1238643210249030
(I means the last digit of the PO number is downloaded with error, it is always a u201C0u201D.
if the PO number is of less than 16 digits... the above problem is not there )
How to correct the error ? How to tell solution to functional consultant ? Can you please suggest me
Do we need to apply any OSS message ?
Thanks in ADVANCE.
Edited by: sam kumar on Dec 8, 2008 5:40 PMHi,
Just found that 'Numbers in Microsoft Excel can never have more than 15 significant digits'.
check this link from Microsoft: [http://support.microsoft.com/kb/158071|http://support.microsoft.com/kb/158071]
check this [http://office.microsoft.com/en-us/excel/HA102748231033.aspx|http://office.microsoft.com/en-us/excel/HA102748231033.aspx]
[http://office.microsoft.com/en-us/excel/HA102748231033.aspx#5|http://office.microsoft.com/en-us/excel/HA102748231033.aspx#5]
What i can suggest is, put a apostrophe (') for the value of first cell content at the beginning.
Use Format painter to apply the same for all values in that column.
Regards
Raj
Edited by: Rajasekhar Dinavahi on Dec 8, 2008 10:59 PM
Edited by: Rajasekhar Dinavahi on Dec 8, 2008 11:00 PM
Edited by: Rajasekhar Dinavahi on Dec 8, 2008 11:05 PM -
When I am trying to down load the ALV report to EXCEL. The report fields are not coming in the same order as they are in the report.
Please advice.
<b><REMOVED BY MODERATOR></b>
Thank you.
Gouri.
Message was edited by:
Alvaro Tejada GalindoHi,
You can use the FM - ALV_XXL_CALL.
It is the same function module invoked when you click on the export to excel button of the ALV.
You can pass teh field catalog of the ALV here along with the name of ur internal table and the internal table itself. It will download everything to Excel alongwith the Column headers ( depending on ur field catalog definition). Just make sure ur field catalog has the COL_Heading correctly populated.
<b>
Sample Code -</b> CALL FUNCTION 'ALV_XXL_CALL'
EXPORTING
i_tabname = 'T_GRID' " Name of the Internal table
it_fieldcat = t_fcatk[] " Field catalog
TABLES
it_outtab = t_grid " Interbnal table with data
EXCEPTIONS
fatal_error = 1
no_display_possible = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e806(bk).
ENDIF.
Regards
Sudheer -
ALV Logo is not down loading to excel.
Hi All,
when we are downloading the ALV output to excel logo is not appearing..
please tell me how to down load logo to excel file,
Thanks in advance..Hi Satya,
Can you kindly share how?
I am also facing the same requirement.
Thanks! -
friends,
I have a requirement to down load a list which is displayed hierarchially into an excel sheet.
1000
18271218 qiuwiquw
289283 djksdjskd
1001
23232 ssdsdsdcheck parameters.
and pass it according to your req,
like file name & type
separated by...!!
and atlast pass the formated internal table
and generate file.
reward if helpful
call function 'GUI_DOWNLOAD'
exporting
BIN_FILESIZE =
filename = txtfile
filetype = 'ASC'
APPEND = ' '
write_field_separator = 'X'
confirm_overwrite = 'X'
tables
data_tab = it2_oh
Maybe you are looking for
-
JBO-26030 and ORA-00054 error when updating a certain row
I have a page that saves data when you leave a cell in a table. Everything seems to work fine, but when you get to some cells the JBO-26030 error pops up and then no matter what you do you can't ever save anything on that cell. You can close everythi
-
ABAP DUMP - OBJECTS_OBJREF_NOT_ASSIGNED
Hi Experts We are facing the dump OBJECTS_OBJREF_NOT_ASSIGNED very regularly in ST22. Error Details Short text Access via 'NULL' object reference not possible. What happened? Error in the ABAP Application Program The current ABAP prog
-
How to delete diagnostic and usage data on iPhone 5s without resetting the phone
In my iPhone 5s I would like to--- remove the long list of, diagnostic and usage data ,---without resting the phone. Any way out. I tried selecting each one and deleting, but not possible. Hoping for a reply soon. Thanking you in advance.
-
Photoshop CS5.1 Brushes Window UI Problem
Im using Vista 64 bit. Photoshop did not open for me, then Windows pops up a window saying it has adjusted my display settings and photoshop should work. So I open photoshop and things look alright but the brushes window UI display is frozen and goes
-
USB Audio distorts when using Stanton T90
I have a Stanton T90 USB turntable that works ok with a PC. However when used on my Mini Mac after a short time the audio starts distorting. It seems to be application independent and in the logs I have seen: Oct 30 23:22:01 Macintosh kernel[0]: WARN