Announcement:
wanna exchange links? contact me at sapchatroom@gmail.com.
Posted by
Admin at
Did G. Did find out some interesting stuff. Was looking for the skinny. So Thanks Dave. Your time is highly appreciated! Neal
| | | ---------------Original Message--------------- From: Dave Thornburgh Sent: Friday, May 20, 2011 9:12 PM Subject: Writing an Excel file to Ap server Neal - I would answer with "GIYF", but since it's you... ABAP2XLSX is a community project hosted in the SAP Code Exchange. As such, it's completely free. The project home page is at https://cw.sdn.sap.com/cw/groups/abap2xlsx (if the URL survives being posted here, of course). It's installed via SAPLink - another great community project! - or via transports for the stable versions. Version 4 was just released as stable in the last 2 weeks. I haven't used it in any projects yet myself, but the included demo programs show some real neat features. The actual code that creates the various spreadsheets in the demo programs is really light - seems almost easier than some of my own code to create .dat files! Some of the demos - each of which creates at least one file - are around 100 lines including comments. Here's an example - this code (plus some data declarations and housekeeping) takes an internal table and downloads an Excel file. If ToolBox mangles it, you might want to read the message in a fixed-width font. " Creates active sheet create object lo_excel. " Get active sheet lo_worksheet = lo_excel->get_active_worksheet( ). lo_worksheet->set_title( ip_title = 'Internal table'). data lt_test type table of sflight. select * from sflight into table lt_test. ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium2. ls_table_settings-show_row_stripes = abap_true. lo_worksheet->bind_table( ip_table = lt_test is_table_settings = ls_table_settings ). lo_worksheet->freeze_panes( ip_num_rows = 3 ). "freeze column headers when scrolling column_dimension = lo_worksheet->get_column_dimension( ip_column = 'E' ). column_dimension->set_width( ip_width = 11 ). " Write to Excel 2007 create object lo_excel_writer type zcl_excel_writer_2007. lv_file = lo_excel_writer->write_file( lo_excel ). " Convert to binary call function 'SCMS_XSTRING_TO_BINARY' exporting buffer = lv_file importing output_length = lv_bytecount tables binary_tab = lt_file_tab. " Save the file cl_gui_frontend_services=>gui_download( exporting bin_filesize = lv_bytecount filename = lv_full_path filetype = 'BIN' changing data_tab = lt_file_tab ). | | __.____._ Copyright © 2011 Toolbox.com and message author. Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251 | | R. N. Wilhite SAP ABAP Helper
Posted helpful replies on 5 threads in a group to earn a Bronze Achievement Popular White Papers In the Spotlight _.____.__ |