Export oracle table to excel

Dear sirs,
now i want to send oracle table to excel that is through forms 6i
and i used ole2 package but i can send the column fields name and i want to put as 3 lines as a header for the table name and date
anybody help me please
Thanks in advance
Yasser

hi
try this code.
PROCEDURE test IS
i_reporttitle VARCHAR2(200) := 'My excel';
dno number(2);
dn varchar2(14);
dl varchar2(13);
r number := 2;
c number := 1;
i_orientation VARCHAR2(200) := '1';
i number :=1;
/* definiton for commonly used variables and constants and exceptions */
ExcelID ole2.obj_type;
ExcelWorkBooksID ole2.obj_type;
ExcelWorkBookID ole2.obj_type;
ExcelWorkSheetsID ole2.obj_type;
ExcelWorkSheetID ole2.obj_type;
ExcelCellID ole2.obj_type;
ExcelFontID ole2.obj_type;
ExcelPageSetupID ole2.obj_type;
ExcelArgs ole2.list_type;
BEGIN
ExcelID := ole2.create_obj('Excel.Application');
ExcelWorkBooksID := ole2.get_obj_property(ExcelID, 'Workbooks');
ExcelWorkBookID := ole2.invoke_obj(ExcelWorkBooksID, 'Add');
ExcelWorkSheetsID := ole2.get_obj_property(ExcelWorkBookID, 'Worksheets');
ExcelWorkSheetID := ole2.invoke_obj(ExcelWorkSheetsID, 'Add');
ExcelPageSetupID := ole2.get_obj_property(ExcelWorkSheetID, 'PageSetup');
ole2.set_property(ExcelPageSetupID, 'Orientation',i_orientation);
ole2.release_obj(ExcelPageSetupID);
  loop
     go_block('dept');
ExcelArgs := ole2.create_arglist;
ole2.add_arg(ExcelArgs,i);
ole2.add_arg(ExcelArgs,c);
ExcelCellId := ole2.get_obj_property(ExcelWorkSheetId,'cells',ExcelArgs);
ole2.destroy_arglist(ExcelArgs);
ole2.set_property(ExcelCellId, 'Value', :dept.deptno);
ExcelFontId := ole2.get_obj_property(ExcelCellId, 'Font');
ole2.set_property(ExcelFontId, 'Bold', 'True');
ole2.set_property(ExcelFontId, 'Size', '10');
ole2.release_obj(ExcelFontId);
ole2.release_obj(ExcelCellId);
ExcelArgs := ole2.create_arglist;
ole2.add_arg(ExcelArgs,i);
ole2.add_arg(ExcelArgs,c+1);
ExcelCellId := ole2.get_obj_property(ExcelWorkSheetId,'cells',ExcelArgs);
ole2.destroy_arglist(ExcelArgs);
ole2.set_property(ExcelCellId, 'Value', :dept.dname);
ExcelFontId := ole2.get_obj_property(ExcelCellId, 'Font');
ole2.set_property(ExcelFontId, 'Bold', 'True');
ole2.set_property(ExcelFontId, 'Size', '10');
ole2.release_obj(ExcelFontId);
ole2.release_obj(ExcelCellId);
ExcelArgs := ole2.create_arglist;
ole2.add_arg(ExcelArgs,i);
ole2.add_arg(ExcelArgs,c+2);
ExcelCellId := ole2.get_obj_property(ExcelWorkSheetId,'cells',ExcelArgs);
ole2.destroy_arglist(ExcelArgs);
ole2.set_property(ExcelCellId, 'Value', :dept.loc);
ExcelFontId := ole2.get_obj_property(ExcelCellId, 'Font');
ole2.set_property(ExcelFontId, 'Bold', 'True');
ole2.set_property(ExcelFontId, 'Size', '10');
ole2.release_obj(ExcelFontId);
ole2.release_obj(ExcelCellId);
     exit when :SYSTEM.LAST_RECORD = 'TRUE';
next_record;
i := i+1;
end loop;
ExcelArgs := ole2.create_arglist;
ole2.add_arg(ExcelArgs,i+1);
ole2.add_arg(ExcelArgs,1);
ExcelCellId := ole2.get_obj_property(ExcelWorkSheetId,'cells',ExcelArgs);
ole2.destroy_arglist(ExcelArgs);
ole2.set_property(ExcelCellId, 'Value', 'END');
ExcelFontId := ole2.get_obj_property(ExcelCellId, 'Font');
ole2.set_property(ExcelFontId, 'Bold', 'True');
ole2.set_property(ExcelFontId, 'Size', '10');
ole2.release_obj(ExcelFontId);
ole2.release_obj(ExcelCellId);
ole2.set_property(ExcelID, 'Visible','TRUE');
-- ... and release the allocated resources because they are no longer used by forms
ole2.release_obj(ExcelWorkSheetID);
ole2.release_obj(ExcelWorkSheetsID);
ole2.release_obj(ExcelWorkBookID);
ole2.release_obj(ExcelWorkBooksID);
ole2.release_obj(ExcelID);
END;try this code too.
PROCEDURE FormToExcel IS
i_reporttitle VARCHAR2(200) := 'My excel';
dno number(2);
dn varchar2(14);
dl varchar2(13);
r number := 2;
c number := 1;
i_orientation VARCHAR2(200) := '1';
i number :=1;
/* definiton for commonly used variables and constants and exceptions */
ExcelID ole2.obj_type;
ExcelWorkBooksID ole2.obj_type;
ExcelWorkBookID ole2.obj_type;
ExcelWorkSheetsID ole2.obj_type;
ExcelWorkSheetID ole2.obj_type;
ExcelCellID ole2.obj_type;
ExcelFontID ole2.obj_type;
ExcelPageSetupID ole2.obj_type;
ExcelArgs ole2.list_type;
BEGIN
ExcelID := ole2.create_obj('Excel.Application');
ExcelWorkBooksID := ole2.get_obj_property(ExcelID, 'Workbooks');
ExcelWorkBookID := ole2.invoke_obj(ExcelWorkBooksID, 'Add');
ExcelWorkSheetsID := ole2.get_obj_property(ExcelWorkBookID, 'Worksheets');
ExcelWorkSheetID := ole2.invoke_obj(ExcelWorkSheetsID, 'Add');
ExcelPageSetupID := ole2.get_obj_property(ExcelWorkSheetID, 'PageSetup');
ole2.set_property(ExcelPageSetupID, 'Orientation',i_orientation);
ole2.release_obj(ExcelPageSetupID);
  loop
go_block('t');
ExcelArgs := ole2.create_arglist;
ole2.add_arg(ExcelArgs,i);
ole2.add_arg(ExcelArgs,c);
ExcelCellId := ole2.get_obj_property(ExcelWorkSheetId,'cells',ExcelArgs);
ole2.destroy_arglist(ExcelArgs);
ole2.set_property(ExcelCellId, 'Value', :t.a_number);
ExcelFontId := ole2.get_obj_property(ExcelCellId, 'Font');
ole2.set_property(ExcelFontId, 'Bold', 'True');
ole2.set_property(ExcelFontId, 'Size', '10');
ole2.release_obj(ExcelFontId);
ole2.release_obj(ExcelCellId);
     exit when :SYSTEM.LAST_RECORD = 'TRUE';
next_record;
i := i+1;
end loop;
ExcelArgs := ole2.create_arglist;
ole2.add_arg(ExcelArgs,i+1);
ole2.add_arg(ExcelArgs,1);
ExcelCellId := ole2.get_obj_property(ExcelWorkSheetId,'cells',ExcelArgs);
ole2.destroy_arglist(ExcelArgs);
ole2.set_property(ExcelCellId, 'Value', 'END');
ExcelFontId := ole2.get_obj_property(ExcelCellId, 'Font');
ole2.set_property(ExcelFontId, 'Bold', 'True');
ole2.set_property(ExcelFontId, 'Size', '10');
ole2.release_obj(ExcelFontId);
ole2.release_obj(ExcelCellId);
ole2.set_property(ExcelID, 'Visible','TRUE');
-- ... and release the allocated resources because they are no longer used by forms
ole2.release_obj(ExcelWorkSheetID);
ole2.release_obj(ExcelWorkSheetsID);
ole2.release_obj(ExcelWorkBookID);
ole2.release_obj(ExcelWorkBooksID);
ole2.release_obj(ExcelID);
END;sarah
Edited by: QGIRCO on Jan 20, 2010 12:59 AM

Similar Messages

  • How to export a table in excel (in JSP)???

    hi all,
    I am using AJAX functionality in jsp to export a table into Excel.But i don't want to use it as it gives a hyperlink whereas i want a button which should work similar to hypelink.
    I mean to say i want a saperate export button which should work similar to the hyperlink.
    if anybody has any idea abt it....plz reply it soon.......

    So what you want to do is redirect to a page when the user clicks the button?
    So just put the button in a form with the action attribute set to wherever the hyperlink points now.
    And in case the button is already a part of a form, then on the onClick() event of the button, change the action attribute of the form to this particular hyperlink target and then cause it to submit.
    That ok?
    Or do you want the Excel file you're generating to be sent to the browser causing it to popup a dialog asking the user to save or open? If so take a look here http://forum.java.sun.com/thread.jspa?threadID=5170452&messageID=9655276

  • Problem export pdf table to excel spreadsheed

    Hi, my name is Marco.
    Last month a customer has bought a copy of Adobe Acrobat Professional 9 in my computer shop for edit some pdfs files.
    After some days he told me that he need to export a table to excel's spreadsheet but the function "open table in excel spreadsheet" work ONLY for the page where i right-click. How can i copy all the document in excel (without lose the format)?
    Sorry for the bad english, if you don't understand i try to rewrite it better or in Italian!
    Thank you!

    A lot depends on the structure of the PDF. I it has tags included that provide the format information, then the conversion may be easy. If the tags are not included, then retaining the format is almost impossible. This may even be a problem with recognizing columns. In that case, selecting columns with the ctrl key held during the selection. More information is available under "Copying Text" in the help menu (complete help). The help also talks about the ability to retain format as I have suggested.
    To select items on multiple pages, you have to use continuous view.
    It might be easier to the Save As to DOC and go from there. The backward conversion is not the forte or intent of Acrobat. In reality, one should never delete the original XLS (or other) file with the intent of going back in the future. Sounds like it is too late for your customer.

  • How to export Oracle tables and data to mySQL

    Hi,
    I am new to Oracle.. and would appreciate all help on the issues below.
    Currently, we have Oracle8i on HP-UX, and Oracle8i on IBM-AIX. We would like to be ble to browse the information on the web, thus, a decision to use mySQL as the web database was made. In order to achieve the above, we need to perform the following:
    1) Export Oracle tables to mySQL, from both the HP-UX and IBM-AIX machines.
    2) Include an additional column to the tables that need to be exported from Oracle to mySQL.
    3) Implement the export as a daily extraction that will run at a certain time of the day.
    How may I achieve the above?
    I have just installed the Oracle Enterprise Manager... will this have any help to the above???
    Appreciate all help given... greatly appreciated!
    Thanks and Brgds,
    Alicia

    I'd first make sure you really need to create a separate database just for making the data available to the web. The web application you create could just as well query the existing Oracle databases. You don't necessarily have to create a separate database just to display info over the web.
    Secondly, if you still want to create a separate database, I'd also question the use of mySQL. In my opinion, mySQL is not a relational database. It acts like a relational database; you can query it via SQL. But because of all the features which mySQL says it does not support yet, I don't consider it to be a true RDBMS. This may not be an issue in your case since you're using it just for read access. Still, I'd take a long look at the list of feature mySQL does not support and make sure you can live with those limitations.
    Also, if you create a separate database for the web app and use Oracle for that database instead of mySQL, you could use Oracle's built in data replication to automatically refresh the web db from the existing db
    If you conclude that you still want to create a separate database for the web app and use mySQL I think you'll have to write some code to support the interface between the dbs (but hey, I'm a developer). The reason I say this is because it sounds like you're merging data from two databases into one and you may even be merging data from two separate databases into a single table of the new web database. If this is the case, simple data extract utilities will not be sufficient. Also, it sounds like the new column added to the web database may not be able to be populated from existing data. And then there's the question of what you need to do with the existing web data each time you run the data extraction ? The easiest case is that you'll always add data to the web db from existing db. If you have to purge the web db first and then refresh it with existing data then there's another step in the process. Overall, writing code to support an interface like this gives you complete control over the process and provides a lot of flexibility in how it is run. In my experience, there are usually new requirements added to the interface as time goes on. The code based approach can deal with changing requirements. The tools approach eventually falls short.
    One other issue to keep in mind is how to protect your existing database while exposing your web database to the Net. Since you need to support an automated interface between the two systems, you'll need to provide a path between the two databases without letting Net users gain access to your internal database. Some serious network security issues to resolve here, but I'm not a network admin.
    hth,
    Frank
    Hi,
    I am new to Oracle.. and would appreciate all help on the issues below.
    Currently, we have Oracle8i on HP-UX, and Oracle8i on IBM-AIX. We would like to be ble to browse the information on the web, thus, a decision to use mySQL as the web database was made. In order to achieve the above, we need to perform the following:
    1) Export Oracle tables to mySQL, from both the HP-UX and IBM-AIX machines.
    2) Include an additional column to the tables that need to be exported from Oracle to mySQL.
    3) Implement the export as a daily extraction that will run at a certain time of the day.
    How may I achieve the above?
    I have just installed the Oracle Enterprise Manager... will this have any help to the above???
    Appreciate all help given... greatly appreciated!
    Thanks and Brgds,
    Alicia

  • Export BSP Table to Excel

    Hi,
    I have made an application in BSP which reads a database table and fills up an internal table. I have displayed the result in a tableView <htmlb:tableView>
    Now I have to export this list to an excel file.
    How can I do it?
    Kindly help me solve the problem.
    Thanks,
    Reema

    check out the following threads
    Re: File Upload & Download into excel
    Re: export bsp-table to excel
    Re: Download to Excel
    and close your previous threads in BSP forum
    BSP Application URL
    Target Frame with navigation->next_page
    Event Handling in treeNode
    BSP Exception: CX_SY_CONVERSION_NO_NUMBER
    Regards
    Raja

  • How to export oracle table?

    Does anybody knows how to export oracle table into sql format? I know by using PL/SQL Developer can do it,but I have a table,it contains a column,it's type is LONG,PL/SQL can't export it! How to export long type table into sql format?
    Any idea will be appreciated!

    My table structure is follows:
    create table MyDates
    COL1 LONG,
    COL2 VARCHAR2(20)
    In column col1,I store some date in it,then I want to export this table,but I don't want to export this table into dmp file,I only want to export this table' structure and export it into SQL File,such export filename is mydata.sql
    I don't know how to export this table's structure? Because it contains LONG type column.How to export it? By the way,would you tell me how to export other type table,such as it contains column type is blob?

  • Problem While exporting HTML table to Excel(.CSV) in SharePoint 2010

    Hi ,
    I was exporting HTML table to .CSV file. 
    Problem is if any field contains '>' or '<' symbol then after exporting to .CSV, it was showing like '&gt' and '&lt' and the code is  as below.
    //Export HTML table to CSV 
    function toCSV() {
          var data = document.getElementById('reportstable');
          var csvData = [];
          var tmpArr = [];
          var tmpStr = '';
          for (var i = 0; i < data.rows[0].cells.length; i++) 
            tmpArr.push((data.rows[0].cells[i].innerText || data.rows[0].cells[i].textContent));
          csvData.push(tmpArr.join('\t'));
          for (var i = 1; i < data.rows.length; i++) 
            tmpArr = [];
            for (var j = 0; j < data.rows[0].cells.length; j++) 
            tmpArr.push(data.rows[i].cells[j].innerHTML);
            csvData.push(tmpArr.join('\t'));
          var output = csvData.join('\n');
          SaveContents(output);
    //For saving the file
    function SaveContents(element) {
            if (document.execCommand) {
                var oWin = window.open("about:blank","_blank");
                oWin.document.write(element);
                oWin.document.close();
                var success = oWin.document.execCommand('SaveAs', false, "FilteredReport.xls")
                oWin.close();
    Thanks in Advance

    Hi,
    According to your post, a problem occurred when you exported the HTML table to Excel(.CSV).
    The following code for your reference:
    function toCSV() {
    var data = document.getElementById('reportstable');
    var csvData = [];
    var tmpArr = [];
    var tmpStr = '';
    for (var i = 0; i < data.rows[0].cells.length; i++)
    tmpArr.push((data.rows[0].cells[i].innerText || data.rows[0].cells[i].textContent));
    csvData.push(tmpArr.join('\t'));
    for (var i = 1; i < data.rows.length; i++)
    tmpArr = [];
    for (var j = 0; j < data.rows[0].cells.length; j++)
    tmpArr.push(data.rows[i].cells[j].innerHTML);
    csvData.push(tmpArr.join('\t'));
    var output = csvData.join('\n');
    SaveContents(output.replace(/&lt;/g, '<').replace(/&gt;/g, '>'));
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Problem while exporting ADF table to excel

    Hello,
    I have some columns of random size which are left padded with 0.
    now the problem comes when I export the table containing these columns to excel, excel remove all those zeros from left.
    eg: 000000003726819563(table column value) after exporting to excel shows as 3726819563.
    Along with this I also want the footer part of table in excel.
    For some of the columns I have summary filed(i.e. sum) at the footer of the table which I want to show in excel.
    Can someone please guide me through these issues.
    Thanks in advance.

    Take a look at this: http://adfreusablecode.blogspot.com/2012/07/export-to-excel-with-styles.html
    With this code you can export the footer: http://dl.dropbox.com/u/22312971/adf-samples/ExportToExcelDemo/ViewController/src/view/ExcelBean.java
    Here is the entire demo project: http://dl.dropbox.com/u/22312971/adf-samples/ExportToExcelDemo.zip
    I a few days I will update the above post.
    Hope this help.
    AP

  • Export Oracle tables and metadata to file for importation into another Db

    Hi all,
    In relation to past posts I'm wondering if a tool exists that allows one to export chosen table(s), along with associated metadata (hopefully automatic incorporation of associated triggers etc) to an export file and then add (import) this data to another Oracle Database?
    Looking at remote application development on specific data on a 'standalone' PC running Oracle XE at home.

    Hi,
    well there is only a version of datapump.
    You can set a 'VERSION' parameter for compatibility..
    Check this out
    http://download-uk.oracle.com/docs/cd/B14117_01/server.101/b10825/toc.htm
    It can help you. :)

  • Export adf table to Excel

    Hi All,
    Does anybody know how to export adf table records to excel sheet without using DCIteratorBinding.

    Hi Frank,
    Thanks for your suggestion.in the below method
    public void exportToExcel(ActionEvent actionEvent) throws
    IOException {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application application = facesContext.getApplication();
    // BindingContainer bindings = this.getCustomers();
    ValueBinding customerListBind =
    application.createValueBinding("#{CustomerViewBean}");
    customerView customer =
    (customerView)customerListBind.getValue(facesContext);
    customer.exportHtmlTableToExcel();
    in this method i need to send CustomerViewBean to the exportHtmlTableToExcel method.

  • Export UI5 table to Excel

    Hello Experts,
    I have created a table in UI5 based on Odata Model.
    Now I want to download this table to Excel.
    I checked that this is possible through creating a xsjs file as mentioned here:
    Export to Excel in XS Project
    As seen in the thread, they have written query
    var query = 'SELECT TOP 25000 "PurchaseOrderId", "PartnerId","CompanyName", "CreatedByLoginName","History.CREATEDAT", "GrossAmount" '
    + 'FROM "sap.hana.democontent.epm.data::purchaseOrderHeaderExternal" order by "PurchaseOrderId"';
    Now my problem is that I am using input parameters in my UI to load table.
    So I want to know how to pass the input parameters to my xsjs file.
    And also is there any other way that I can use to export odata table directly to Excel?
    Regards,
    Rohit

    Hi Jacob,
    If you're on Java stack (which you are if you're using Apache POI anyway ), the most simple way is :
    1) Create a REST service which generates the Excel workbook:
        @GET
        @Path("/getexcelfile")
        public void getExcelFile(@Context HttpServletRequest request, @Context HttpServletResponse response) throws InternalServerErrorException {
            try {
                OutputStream out = null;
                try {
                    List yourData = <get your list of data>
                    String filename = "myexcel.xls";
                    response.setContentType("application/vnd.ms-excel");
                    response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
                    WritableWorkbook writableWorkbook = Workbook.createWorkbook(response.getOutputStream());
                    WritableSheet writableSheet = writableWorkbook.createSheet("My Excel Worksheet", 0);
                    createExcelHeaderRow(writableSheet);
                    createExcelSheetContent(yourData, writableSheet);
                    writableWorkbook.write();
                    writableWorkbook.close();
                } catch (Exception exception) {
                } finally {
                    if (out != null) out.close();
            } catch (Exception exception) {
    2) in your UI5 app, simply use a link to download your Excel file:
        var oDownloadExcelButton = new sap.ui.commons.Link( {
            text : "Download Excel File",
            href : "/<your_EAR_context>/<your_REST_context>/getexcelfile"

  • Is it possible to create a workflow that exports PDF tables to Excel?

    Afternoon all,
    I've seen that it's possible to export tabulated information within a PDF document to Excel (http://www.adobe.com/products/acrobat/pdf-to-excel-xlsx-converter.html) but this is a very manual process.
    I'm wondering if it's possible to create an automated set of steps that I can point to a directory of PDF files, which'll run through the files and export thier contents to Excel.  PhotoShop has something similar in its image resizing actions.  This'll save me a lot of manual time going forward, so any help would be appreciated.
    Thanks,
    Steven

    This is possible with an action in Acrobat Pro.

  • Export internal table to excel...

    Hello everyone!
    I have an ALV with one column like this:
    netwr LIKE vbrp-netwr
    In the ALV Catalog, i allready tried this options:
      CLEAR fieldcat_linha.
      fieldcat_linha-fieldname = 'NETWR'.
    *  fieldcat_linha-ref_tabname = 'VBRP'.
    *  fieldcat_linha-ref_fieldname = 'NETWR'.
      fieldcat_linha-reptext_ddic = text-126.
      fieldcat_linha-decimals_out = '2'.
      APPEND fieldcat_linha TO fieldcat_tab.
    The problem is, when i export this to an excel file, i get 2 decimals only in values like this: '1.000,00'
    If the value is '200,00' the export returns only '200' in the excel file. Does anyone know how to round this problem?
    Thank you.
    Message was edited by: Nuno Santos

    I dont think this is the problem with ABAP. Try changing the customising settings for excel from control panel.
    Ankur Bhandari
    p.s Rewqard appropriate points if the answer helped
    Message was edited by: Ankur Bhandari

  • To export pivot table from excel and save as picture using powershell

    I am trying to automate my work by attaching an excel file to email and send it across using powershell . But also, I want to paste the screenshot of  pivot table to my email body .
    One way to do it is to save only the pivot table as picture format like jpeg or png , then attach this picture to the email body .
    I am looking for an powershell script which will save my pivot table as picture format . I am using powershell V1.0
    please help .

    I'm not familiar with PowerShell script, we usually use VBA script within excel.
    The following article describes how to export Excel Range to a Picture File and attach it as the email body by VBA code, it might not be the answer you are looking for, but hope it will give you some inspirations.
    http://www.jpsoftwaretech.com/export-excel-range-to-a-picture-file/
    Also you can post your question to PowerShell forum to get better support.
    Best Regards,
    Wind Zhang

  • Export internal table to Excel file pressing a new button created in ALV

    Hello, I am trying to implement the functionality to export to excel file inside a button that i have created into my ALV. I don't want to use FileDownload UI.
    The code I have set for event handler of this button is the following:
    METHOD attach_files .
      TYPES:
        BEGIN OF tipo_alv_tab,
          tipod    TYPE objid,
          descd   TYPE p1000-stext,
          begda   TYPE begdatum,
          endda   TYPE enddatum,
          pernr     TYPE pernr_d,
          nombre  TYPE ad_namefir,
          email     TYPE ad_smtpadr,
          posicion TYPE p1000-stext,
          uodesc   TYPE p1000-stext,
        END OF tipo_alv_tab.
      DATA:
        i_alv_tab    TYPE TABLE OF tipo_alv_tab,
        conv_out     TYPE REF TO cl_abap_conv_out_ce,
        content      TYPE xstring,
        lv_filename  TYPE string,
        xml_out      TYPE string.
    Fill values from memory
      IMPORT name1 TO i_alv_tab  FROM MEMORY ID 'ZCA'.
    Build XML file with internal table information
      CALL TRANSFORMATION ('ID') SOURCE tab = i_alv_tab[] RESULT XML xml_out.
    Build XSTRING with XML
      CALL FUNCTION 'CRM_IC_XML_STRING2XSTRING'
        EXPORTING
          instring   = xml_out
        IMPORTING
          outxstring = content.
    Format XSTRING
      conv_out = cl_abap_conv_out_ce=>create( encoding = 'UTF-8'  ).
    Convert data
      conv_out->convert( EXPORTING data = xml_out IMPORTING buffer = content ).
    Save file
      CALL METHOD cl_wd_runtime_services=>attach_file_to_response
        EXPORTING
          i_filename      = 'Excel File.xls'
          i_content       = content
          i_mime_type     = 'application/msexcel'
          i_in_new_window = i_in_new_window
          i_inplace       = i_inplace.
    ENDMETHOD.
    When pressing the button, the file created is without extension, and with a rare name. When trying to open the file, it seems to be corrupted.
    Does anyone know what am I doing wrong???
    Please, help is really really appreciated!!!!

    Hi Jorge,
    The export data to excel functionality is available inbuilt in ALV and you dont have to write any implementation. However, if you want to create your own button for it, you can do so as below.
    data:
    lr_button type ref to cl_salv_wd_fe_button,
    lr_function type ref to cl_salv_wd_function.
    CREATE OBJECT lr_button.
    lr_button->set_text( 'Export to excel' ).
    lr_button->set_tooltip( 'Export data to excel' ).
    lr_function = l_alv_model->if_salv_wd_function_settings~create_function( id = 'EXCEL' ).
    lr_function->set_function_std( IF_SALV_WD_C_STD_FUNCTIONS=>EXPORT_EXCEL ).
    lr_function->set_editor( lr_button ).
    Now, you have created your own button, created a user defined function for the ALV and set this button as editor for the function. And using the set_function_std method, we have just mapped the functionality of your new button to the existing export to excel functionality in ALV.
    Hope this is what you are looking for.
    Regards
    Nithya

Maybe you are looking for

  • Multiple receivers for same rfc msg type

    I have a soap-XI-RFC scenario. I have to read the soap message and depending on the key field value, I have to send to two different SAP systems. For EX: Input Message: <input_msgType>   <item>       <Key>ABC-123452</Key>       <value>test1</value>  

  • How to make disk space when I can't see my desktop?

    I just got a low start up disk space message yesterday...turned on my MacBook pro today and all I get is a blue screen and error message that says "the iTunes application could not be opened.  An un known error occurred (13014)." the only thing I can

  • Disable Bluetooth running at startup.

    How can i disable bluetooth running each time windows starts, as i want it _only sometimes_ - not always. My notebook is A200 23W and i have wi-fi always on.

  • Quick Menu not opening up correctly

    Whenever I try to open up Quick menu the program will load and show up in the system tray but overlay with all the buttons will not come up at all. It had worked fine before restarting the computer but now nothing. I have tried to uninstall and reins

  • Reg: Dialog Programming

    Dear All, I'm new to this group. Now i'm learning ABAp. I need a small Help. I want to insert/Update the data into master tables using Dialog Programming. How can i do that. I'm using RF(Radio frequency)devices,which can access the SAP Screens in Cha