Formating an excel file by BSP Download
I have made a BSP application which can dowload file into an excel file.But now i have a requirement in which i have to format the excel file with colour and cell width.I have to colour the column header of the excel file with some colours like blue,red etc.
Please suggest me how we can achieve this?
Thanks and regards,
Manish Kumar
Hi Manish,
This can be achieved using javascirpts and active x objects. Check this wiki,
http://wiki.sdn.sap.com/wiki/display/CRM/DownloaddatafromwebuitoExcelandPPT
Regards,
Arun
Similar Messages
-
Writing into Excel file using PL/SQL and formatting the excel file
Hi,
I am writing into a excel file using PL/SQL and I want to make the first line bold on the excel. Also let me know if there are any other formatting options when writing into excel.
Regards,
-AnandI am writing into a excel file using PL/SQL
Re: CSV into Oracle and Oracle into CSV
check that thread or search in this forum... -
To Send HTML Format and excel file attachment in same mail
Dear All,
Have requerment ,to send a mail options HTML table format and same data in excel file attachement.have capable to do the html format using methods BCS .but how to send excel format attachment in same mail.
Please guide me how to do it.
Regards ,
Santhu
Edited by: santosh jajur on Apr 9, 2010 1:54 PMSanthosh,
please check the code:
report bcs_example_7.
This report provides an example for sending an Excel
attachment in Unicode Systems
constants:
gc_tab type c value cl_bcs_convert=>gc_tab,
gc_crlf type c value cl_bcs_convert=>gc_crlf.
parameters:
mailto type ad_smtpadr
default 'ur mail id'. "#EC *
data send_request type ref to cl_bcs.
data document type ref to cl_document_bcs.
data recipient type ref to if_recipient_bcs.
data bcs_exception type ref to cx_bcs.
data main_text type bcsy_text.
data binary_content type solix_tab.
data size type so_obj_len.
data sent_to_all type os_boolean.
start-of-selection.
perform create_content.
perform send.
form send.
try.
send_request = cl_bcs=>create_persistent( ).
create document object from internal table with text
append 'Hello world!' to main_text. "#EC NOTEXT
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = main_text
i_subject = 'Test Created By BCS_EXAMPLE_7' ). "#EC NOTEXT
add the spread sheet as attachment to document object
document->add_attachment(
i_attachment_type = 'xls' "#EC NOTEXT
i_attachment_subject = 'ExampleSpreadSheet' "#EC NOTEXT
i_attachment_size = size
i_att_content_hex = binary_content ).
add document object to send request
send_request->set_document( document ).
--------- add recipient (e-mail address) -----------------------
create recipient object
recipient = cl_cam_address_bcs=>create_internet_address( mailto ).
add recipient object to send request
send_request->add_recipient( recipient ).
---------- send document ---------------------------------------
sent_to_all = send_request->send( i_with_error_screen = 'X' ).
commit work.
if sent_to_all is initial.
message i500(sbcoms) with mailto.
else.
message s022(so).
endif.
endtry.
endform. "send
form create_content.
data lv_string type string.
data ls_t100 type t100.
columns are separated by TAB and each line ends with CRLF
concatenate 'This Is Just Example Text!' "#EC NOTEXT
gc_crlf gc_crlf
into lv_string.
header line
concatenate lv_string
'MSGID' gc_tab
'MSGNO' gc_tab
'Language' gc_tab "#EC NOTEXT
'Text' gc_crlf "#EC NOTEXT
into lv_string.
data lines
select * from t100 into ls_t100
where arbgb = 'SO' and msgnr = '182'.
concatenate lv_string
ls_t100-arbgb gc_tab
ls_t100-msgnr gc_tab
ls_t100-sprsl gc_tab
ls_t100-text gc_crlf
into lv_string.
endselect.
select * from t100 into ls_t100
where arbgb = 'SO' and msgnr = '316'.
concatenate lv_string
ls_t100-arbgb gc_tab
ls_t100-msgnr gc_tab
ls_t100-sprsl gc_tab
ls_t100-text gc_crlf
into lv_string.
endselect.
try.
cl_bcs_convert=>string_to_solix(
exporting
iv_string = lv_string
iv_codepage = '4103' "suitable for MS Excel, leave empty
iv_add_bom = 'X' "for other doc types
importing
et_solix = binary_content
ev_size = size ).
catch cx_bcs.
message e445(so).
endtry.
endform. "create_content
Thanks. -
Create and Format an Excel File as a Background Process(Application Server)
Hi all,
I have a requirement to Output a formatted(Bold fonts, Merged Cells etc.) Excel File.
It is to be run as background process. So ideally, the file will be produced in the ApplicationServer and will already contain the formatting. If I am to use ole2 functions such as
*--Opening the existing document
call method of gs_wbooks 'Open' = gs_wbook
exporting #1 = file_path.
Is this possible? can file_path point to the file created in the ApplicationServer?
Any answers, suggestions or workarounds would be greatly appreciated.
Thanks in Advanceno.
that works only in dialog
A. -
How to format a excel file use java.
hi,
everyone, i meet a problem.i want to write a excel file use java.i can use .csv input the date to excel.but i want to know how to format it.
thanks
Jovehi,
everyone, i meet a problem.i want to write a excel
el file use java.i can use .csv input the date to
excel.but i want to know how to format it.
thanks
JoveIf I understand your question correctly you need to know the format of a .csv file for use in an Excel spreadsheet. A .csv file is a comma-delimited file so all that you need to do is write your data elements to the file with commas in between them. Having done something similar in the past, let me warn you that when Excel is reading your file, it uses some characters other than commas as field delimiters. for example, / : and ; are treated as commas. To defeat this, you will need to surround fields containing those characters in double quotes.
Hope that helps
Mark -
Incorrect format in Excel file
I have 2 columns in a table -
Column C1 is a varchar2 with values like -ABC, -MNO etc i.e. every value has a '-' as the first character.
Column C2 is a number column.
Through a procedure, I send them to Excel file but the column C2 is displayed as text column left aligned. How do I get it as a number column in the Excel file? It happens due to the '-' in the first column.What is the purpose of the - character? I don't understand why Excel thinks c2 is not a number field, if it contains values like -111. A .CSV with a column of negative numbers would open up in the general number format.
Through a procedureWhat sort of procedure? Something using SYLK? Or some other PL/SQL API?Or a Stored Java Procedure? Or UTL_FILE to write a .CSV file?
Honestly I don't know how you expect us to solve your problem when you give us so little to go on.
Regards, APC -
How to read data in correct format from EXCEL file into an internal table??
Hi Experts,
My requirement is to upload data from an excel file on presentation server into an internal table on <b>SRM</b> server.
I used 'GUI_UPLOAD' function module to achieve the same but all the the data is getting uploaded in # only.I had set in the 'HAS_FIELD_SEPARATOR' to 'X' to overcome this problem.
But all the efforts are in vain. The function module 'ALSM_EXCEL_TO_INTERNAL_TABLE' doesn't exist on SRM Server and I am not getting any other function module having similar functionality available on SRM server.
I have written the following code:-
TYPES: BEGIN OF ty_addr_loc,
userid TYPE xubname, "User Id
addr_code TYPE char4, "3 Digit Site Location Code/4 Digit
"Alternate Address
loc_id TYPE bbp_location, "Indicator: Address is standard address
END OF ty_addr_loc.
*Retrieving file name
parameters: p_file type rlgrap-filename.
DATA:
Local variable holding file name
l_file TYPE string,
Local Variable holding the file type,
l_type TYPE filetype VALUE 'ASC',
Local Variable holding the field separator
l_sep TYPE char01,
i_tab type standard table of ty_addr_loc.
Clearing local variables
CLEAR:
l_file,
l_sep.
Initializing the local variables
MOVE p_file TO l_file.
l_sep = 'X'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
filetype = l_type
has_field_separator = l_sep
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = i_tab
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
IF sy-subrc <> 0.
Throwing an information message
MESSAGE i003. "Data Upload Failed
LEAVE LIST-PROCESSING.
ENDIF.
Please tell me a way out. I have to make a delivery urgently.
Thanks in advance,
Swati GuptaHi
Try the FM <b>KCD_EXCEL_OLE_TO_INT_CONVERT</b>
Sample:
call function 'KCD_EXCEL_OLE_TO_INT_CONVERT'
exporting
filename = i_filename
i_begin_col = l_begin_col
i_begin_row = l_begin_row
i_end_col = l_end_col
i_end_row = l_end_row
tables
intern = xt_intern
exceptions
INCONSISTENT_PARAMETERS = 201
UPLOAD_OLE = 201.
if sy-subrc <> 0.
e_subrc = sy-subrc.
exit.
endif.
<b>reward if Helpful.</b> -
An Excel file won't download from a website in Firefox but it does in IE
I currently go to a website to request a report which is generated as an Excel file. It still works in IE and use to work in firefox, but when I upgraded my firefox to version 7.0.1 nothing happens when click the button to generate the report.
Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.com/kb/Safe+Mode
*https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes -
Issues with format of Excel file created from an Oracle Report
I'm running Oracle Reports 6i. My reports run fine but when I covert them to Excel files I lose my column headings (they end of being repeated for each row in their own columns) and the ordering of my other columns. I can't figure out what is determining the column order as it is not the order of the items in Report Builder or in the query. Could someone tell me why this might be happening and how to fix the issue? Any help would be greatly appreciated as I'm a very new user. Thanks!
Hi,
First of all let me clear out generating a report pdf is different from excel.
The Repeating Frame and boxes,lines etc., used in your reports plays a vital role in excel.
Because, the fields in the reports are segmented into XL cells and displayed as the output.
For Better results in excel...Follow the below instructions,
--Remove Boxes,lines,etc.,
--Make your repeating frame and main frame visible (don't put 'NO_LINE') for any frames,
--Don't leave any unnecessary spaces in reports between fields,frames etc.,
--Then run your report.
It will work fine,
Regards,
Soofi -
Formatting an Excel File in Java
Hi,
I have created a Excel file in Java, But i want to put each column with a specific width. How can i do this?
Help anyone?I have this piece of code.
outputFile=new java.io.File(vVirtualDir+nomeFicheiro.toString());
java.io.FileWriter out1 = new java.io.FileWriter(outputFile);
String dados="\15\12";
out1.write("\15\12");
dados+="Column Name 1";
dados+="Column Name 2";
dados+="Column Name 3";
dados+="\15\12";
dados+="Regsiter1";
dados+="1";
dados+="1";
dados+="\15\12";
dados+="Regsiter2";
dados+="2";
dados+="2";
dados+="\15\12";
String res =new String(dados.getBytes("ISO-8859-1"));
out1.write(res);
out1.close();
This creates me the content of a Excel File. But i want to define the width of each column. How can i do that? -
How to download alv grid output(with field catalog) into excel file format
Hi all,
How to download alv grid output(with field catalogs) into excel file format and same file has to download to application server.
Please help.
Regards,
Satya.Hi,
On list where alv is displayed, select export icon( green color -> ),select spread sheet.
This will display records in Excel sheet. -
Format excel file when it is downloaded
How to format excel file when it downloaded from SAP table
Hi,
In my opinion this would not be straight forward . Actully there are two possibilities :
1. Create a dynamic itab with the structure as you desire in your requirement. But is it possible to have a itab where each row has a different structure. ? experts pls comment on this. ( extract & field group concepts are used to acheive the different structures for each line ).
2. The more possible way i feel is to use the OLE excel concepts. Here we can add data to the excel sheet as wanted by you. Pls check for a beginners article by Rehan Zaidi ( SAP tips ).
In this case you can keep on adding values to the excel ( may be in a loop over your data table ) . For ex : you can add the title Annual Price Book for Program - B4, then the customer & date data & finally the material data. This needs to be repeated again for the next Sales order.
Regards,
Sharat. -
Error while downloading data into excel file.
Hi,
I have a requirement to download data available in xstring to excel file.
I have a RFC which has export parameter 'file_data' of type xstring. When i call RFC
from web dynpro abap application it gives data out pout in xstring format.
I am opening excel file using that xstring data as below
cl_wd_runtime_services=>attach_file_to_response(
i_filename = 'file.xls'
i_content = ls_data_source-data_source ***[xstring data from RFC]
i_mime_type = 'x-excel/application'
i_in_new_window = abap_true ).
But excel file not coming in correct format. its giving an error while download
excel file
Error is
" the file you are trying to open , 'file[1].xls', is in a different format than
specified by the file 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? "
If i click on 'YES' button file opening but not in proper excel format. Data is coming
in tab delimiter format in excel file.
Please suggest any solution for this problem.
Thanks,
Venkat.Hi Thomas,
Following is the logic implemented in RFC which is giving XSTRING as export parameter
STEP1 create a dynamic internal table
Create field catalog for the table using LVC_FIELDCATALOG_MERGE
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = dyn_table.
CREATE EXCEL SHEET BY SENDING FIELD CATALOG AND DATA TAB
STEP2 # Convert text table to xstring.
CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'
IMPORTING
buffer = l_content
TABLES
text_tab = lt_data_tab
EXCEPTIONS
failed = 1
OTHERS = 2.
STEP3 *# Psss Data to Netweaver
PERFORM pass_data_to_nw USING is_import
CHANGING es_attachment_metadata. -
Formatting of EXCEL Sheets during download
Hi all,
There is a requirement for Formatting EXCEL Sheets when downloaded into an FTP site in background.
The internal table is saved in application server with .xls extension and transferred to FTP thru RFC.
is there any way to format this EXCEL file and get it formatted in FTP when it is seen.
The report will run in background daily and every day the report has to be in same format.
Thanks in Advance..
Vivek ..Hi
You can not format EL file that is uploaded. You have to format the internal table before generation XL file from the internal table. Internal table should have all fields in char type. set char length for each field like
data: begin of itab..
field1(20) type c,
field2(20) type c,
Append header record if u want into this itab as first record.
Append all records into this itab.
Generate XL file from this itab.
I suggest you that..
Upload this itab in to application server as 'DAT' format then generate XL file from this file. Dont set .xls when you upload itab to appl. server.
Bala
Note: Award points if helpful -
Regarding ALV output to Excel file download
Hi all,
i had a requirement when downloading the ALV output to the Excel file it should ask for the password.if the user enters the password then this pass word shuld be assigned to the Excel file that was downloaded.
Can i know how this can be implementedHi,
Using EXCEL_OLE_STANDARD_DAT you can specify the PASSWORD & PASSWORD OPTION.
Regards,
Sharat
Maybe you are looking for
-
Editing same project on two computers
Sorry if this is elementary but I would appreciate advice. I am cutting a project on my desktop. I did about 25% of it. I then transferred the project (all the files) to my laptop and cut some more when I was out of town. I did some new voice over on
-
How to change the banner at top of homepage
There is a decorative banner at the top of the homepage and every webpage. How do I get rid of it?
-
This happens only in Safari. When I'm in the "Top Site" view and click on one of my "sites" at least 1/2 the time before the site pops up on the screen I get this odd sort of gray green giant pixilation thing. Sort of an extreme closeup view of the t
-
Why is it that if I make QT setting changes to get the vids to work and then change them back to what they were the vids still work? Seems they would not work if I change them back to test.
-
Can you change the color of the interface rows in history in PS?
Hello all, . . . I recently installed CS5.5 Standard and am giving the new app a run through. (PS right now) . . . I just upgraded from CS2 so it's a fairly big jump and a great one. I love pretty much all the new features. One thing I am wanting to