Download SAP data to Excel file in Presentation server

Hi gurus,
I need to download SAP data to excel file. for that im using SAP_CONVERT_TO_XLS_FORMAT   function module. I have to download with column header and also date should be in YYMMDD format. Im changing the format in ITAB but when populating to excel leading zero's were removed.(EX. 12102007 is converted to 071012 and it was populated as 71012). can someone explain how to use this function module or give someother solution for this....And if possible explain the parameters of the function module SAP_CONVERT_TO_XLS_FORMAT. Is there any function module for converting date as required format?
Thanks,
Amal

Hi Amal...
The Problem you are facing is because of Display properties of Microsoft Excel itself. I believe this can not be solver with in SAP. Instead I would suggest you to go for a .csv format. which can also be viewed in Excel.
In any case if you get to find a different solution for this, I would appriciate if you can share it with me :).
Santosh

Similar Messages

  • HOW TO DOWNLOAD SAP OUTPUT TO EXCEL FILE

    Hi SAP Gurus,
        I would like to ask if you have any Function Module or codes on how to download SAP Output into Excel file. Thanks! Hope you could help me.

    You can transfer the contents of internal table to excel using this code..
    data: begin of itab occurs 0,
          vbeln like vbak-vbeln,
          posnr like vbap-posnr,
          end of itab.
    select vbeln
           posnr
           from vbap
           up to 20 rows
           into table itab.
    * EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    * handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_WORK  TYPE OLE2_OBJECT,
          H_SHEET TYPE OLE2_OBJECT,
          H_CELL  TYPE OLE2_OBJECT,
          V_COL   LIKE SY-TABIX.     " column number of the cell
    DATA:
      V_STEP(30),
      V_FILE LIKE RLGRAP-FILENAME.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Creating Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * start Excel
      V_STEP = 'Starting Excel'.
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
    *  CALL METHOD OF H_EXCEL 'OPEN' EXPORTING  #1 = 'C:DMC_REC.XLS'.
    *  PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * Get the list of workbooks
      V_STEP = 'Preaparing Excel'.
      CALL METHOD OF H_EXCEL 'WORKBOOKS' = H_WORK.
      PERFORM ERR_HDL.
    ** Add new workbook (create a file)
      CALL METHOD OF H_WORK 'ADD'.
      PERFORM ERR_HDL.
    * Get the created worksheet
    ************************Sheet Number
      CALL METHOD OF H_EXCEL 'WORKSHEETS' = H_SHEET EXPORTING #1 = 3.
    ************************Sheet Number
      PERFORM ERR_HDL.
    * Activate (select) the first sheet
      CALL METHOD OF H_SHEET 'ACTIVATE'.
      PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * output column headings to active Excel sheet
      V_STEP = 'Adding data to Excel'.
      LOOP AT ITAB.
        V_COL = SY-TABIX.
        PERFORM FILL_CELL USING 1 V_COL ITAB-vbeln.
        PERFORM FILL_CELL USING 2 V_COL ITAB-posnr.
      ENDLOOP.
      V_STEP = 'Releasing Excel'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
      H_EXCEL-HANDLE = -1.
    *&      Form  ERR_HDL
    *       text
    *  -->  p1        text
    FORM ERR_HDL.
      IF SY-SUBRC <> 0.
        WRITE: / 'Error in processing Excel File:', V_STEP.
        STOP.
      ENDIF.
    ENDFORM.                    " ERR_HDL
    *&      Form  FILL_CELL
    *       text
    *      -->P_1      text
    *      -->P_1      text
    *      -->P_1      text
    FORM FILL_CELL USING  ROW COL VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_CELL
                     EXPORTING #1 = ROW #2 = COL.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_CELL 'Value' = VAL .
      PERFORM ERR_HDL.
    ENDFORM.                    " FILL_CELL

  • Downloading internal table in excel file on application server

    Hi,
        I am trying to download ITAB into excel file on my application server . I am using FM 'SAP_CONVERT_TO_XLS_FORMAT' for that .
        When I run the report I can see file getting generated on APP server but no ITAB data is saved in that excel.
        After debugging I found that error code  'SAVE_DOCUMENT_FAILED'  is retuned in above FM.
        Could any one please suggest how to go about this?
    Regards,
    Ganesh

    Hi ganesh,
    Please have a look into the below link
    [Link1|How to Upload Excel file to Application Server]
    [Link2|Error in Downloading the Text file on Application Server]
    Hope this will be Helpful
    Thanks
    Kalyan

  • Settings for download of data to excel file.

    Hi
    I am trying to download the report from the classical drill down report to excel file. But it not coming in appropriate format. The whole data is coming in a single row. Is there any settings that i have to do in order to download the file in apporpriate format.
    Earlier it was coming in proper format of rows and columns, but now the data is coming in only single row.
    Please help or tell me is there any settings that i have to check.
    The same i have check for FBL3N also and for S_ALR_87012277
    Regards
    IPS Narang
    Edited by: IPS Narang on Jan 29, 2009 7:59 PM

    Hello,
    Please note that your GL short text is not expected to have a "," (COMMA) or unallowable symbol.
    If that is there in any on of the GL Account description, from that row, the whole report will come into a single cell.
    Therefore, please check the report, is there any unallowable symbols in the description and correct your master records of GL.
    It will solve your issue.
    Regards,
    Ravi

  • Execute in background but download the data into excel file

    I would like to know if it is possible to exceute the report in background but generate the output in excel file instead of to spool request.

    Hi
          It is possible.You can use Open_Dataset to do this.Also you can use
    "Set_Function_Code" also to do this. I think to download to excel the function code is "%EXCEL". Try this..
    Hope this willl solve your query.
    Reward All Helpfull Answers.......

  • How to create an EXCEL file in Presentation server

    hello experts,
    please suggest  me a solution for the following problem :
    I have an internal table with some data.
    how can i create an excel file with that data in Presentation Server.
    Thanks & Regards
    sasi.

    hi,
        u can use FM: 'DOWNLOAD'.
    it will prompt u for destination - just give the requd filename and extension.                      
    Ex:
        call function 'DOWNLOAD'
             exporting
                 filename                =
                  filetype                = 'DAT'
             tables
                  data_tab                = tb_output
                  fieldnames              = tb_fld_nam
             exceptions
                  invalid_filesize        = 1
                  invalid_table_width     = 2
                  invalid_type            = 3
                  no_batch                = 4
                  unknown_error           = 5
                  gui_refuse_filetransfer = 6
                  customer_error          = 7
                  others                  = 8.
    where,
             tb_output = internal table having the fields which u want in the O/P
    Ex:
             data:  begin of tb_output occurs 0,
                               name_1(20)      type c,
                               name_2(20)      type c,
                       end of tb_output.
             tb_fld_nam = Field headings :
    Ex:
             data:  begin of tb_fld_nam occurs 0,
                            name(25)              type c,
                      end of tb_fld_nam.
                     tb_fld_nam-name = 'Name 1'.
                     append tb_fld_nam.
                     tb_fld_nam-name = 'Name 2'.
                     append tb_fld_nam.
    Thanx & Regards,
    Ajoy

  • UPLOADING EXCEL FILE INTO PRESENTATION SERVER

    hi guys,
    any one can provide the function module to upload an EXCEL file fromt he presentation server into SAP-CRM system.
    regards
    viswa guntha

    Hi Viswa,
    you should try to use the SDN Search. I've searched for "Excel upload" and the second link was:
    Uploading Data From Excel Sheet to SAP Database Tables
    Regards
    Gregor

  • Populate existing excel file in presentation server

    Hi,
    My requirement is to populate an existing excel file in the presentation server. After the data has been uploaded the file needs to be saved in another name .
    Could someone help me out on this.
    thanks

    hi,
    check this sample code...
    hope it works..
    data: begin of itab occurs 0,
          vbeln like vbak-vbeln,
          posnr like vbap-posnr,
          end of itab.
    select vbeln
           posnr
           from vbap
           up to 20 rows
           into table itab.
    * EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    * handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_WORK  TYPE OLE2_OBJECT,
          H_SHEET TYPE OLE2_OBJECT,
          H_CELL  TYPE OLE2_OBJECT,
          V_COL   LIKE SY-TABIX.     " column number of the cell
    DATA:
      V_STEP(30),
      V_FILE LIKE RLGRAP-FILENAME.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Creating Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * start Excel
      V_STEP = 'Starting Excel'.
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
      CALL METHOD OF H_EXCEL 'APPEND'
        EXPORTING  #1 = 'D:SappdfABAP Trainingsheettr.xls'.
    *  PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * Get the list of workbooks
      V_STEP = 'Preaparing Excel'.
      CALL METHOD OF H_EXCEL 'WORKBOOKS' = H_WORK.
      PERFORM ERR_HDL.
    ** Add new workbook (create a file)
      CALL METHOD OF H_WORK 'ADD'.
      PERFORM ERR_HDL.
    * Get the created worksheet
    ************************Sheet Number
      CALL METHOD OF H_EXCEL 'WORKSHEETS' = H_SHEET EXPORTING #1 = 3.
    ************************Sheet Number
      PERFORM ERR_HDL.
    * Activate (select) the first sheet
      CALL METHOD OF H_SHEET 'ACTIVATE'.
      PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * output column headings to active Excel sheet
      V_STEP = 'Adding data to Excel'.
      LOOP AT ITAB.
        V_COL = SY-TABIX.
        PERFORM FILL_CELL USING 1 V_COL ITAB-vbeln.
        PERFORM FILL_CELL USING 2 V_COL ITAB-posnr.
      ENDLOOP.
      V_STEP = 'Releasing Excel'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
      H_EXCEL-HANDLE = -1.
    *&      Form  ERR_HDL
    *       text
    *  -->  p1        text
    FORM ERR_HDL.
      IF SY-SUBRC <> 0.
        WRITE: / 'Error in processing Excel File:', V_STEP.
        STOP.
      ENDIF.
    ENDFORM.                    " ERR_HDL
    *&      Form  FILL_CELL
    *       text
    *      -->P_1      text
    *      -->P_1      text
    *      -->P_1      text
    FORM FILL_CELL USING  ROW COL VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_CELL
                     EXPORTING #1 = ROW #2 = COL.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_CELL 'Value' = VAL .
      PERFORM ERR_HDL.
    regards
    satesh

  • How to upload data in excel file to an internal table

    hi,
    how can we upload data in excel file on presentation server to an internal table..?
    Any pointers on this would be helpful.
    Regards,
    Anil.

    hi
    use the fm ALSM_EXCEL_TO_INTERNAL_TABLE
    check this example
    TYPES: BEGIN OF ty_mara,
             matnr LIKE mara-matnr,
             mbrsh LIKE mara-mbrsh,
             mtart LIKE mara-mtart,
             maktx LIKE makt-maktx,
             meins LIKE mara-meins,
          END OF ty_mara.
    DATA: it_mara TYPE table of ty_mara WITH HEADER LINE.
    parameters : p_file like RLGRAP-FILENAME.
    data : itab type table of ALSMEX_TABLINE WITH HEADER LINE.
    start-of-selection.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = p_file
        i_begin_col                   = 1
        i_begin_row                   = 1
        i_end_col                     = 5
        i_end_row                     = 4
      tables
        intern                        = itab.
    loop at itab.
      CASE ITAB-COL.
        WHEN '1'.
          it_mara-matnr = ITAB-VALUE.
        WHEN '2'.
         it_mara-mbrsh = ITAB-VALUE.
        WHEN '3'.
          it_mara-mbrsh = ITAB-VALUE.
        WHEN '4'.
         it_mara-maktx  = ITAB-VALUE.
        WHEN '5'.
          it_mara-meins = ITAB-VALUE.
      ENDCASE.
    AT END OF ROW.
      APPEND it_mara.
      CLEAR it_mara.
    ENDAT.
      endloop.
    regards
    prasanth

  • Download the file in presentation server while the program runs in backgrou

    Hi,
    Usually we will never download the file in presentation server while the job is scheduled in back ground.
    But now i need to do that. I need to download the data in excel file and the same program is scheduling in background.
    Can any one suggest how can we do this?
    Thanks in Advance,
    Ravi

    Hi,
    There is an alternative provided by SAP. The program RFCEXEC has to be installed locally on the PC.
    In SAP R/3 we have to define a destination link to your local PC to the RFCEXEC program. And in the ABAP program we have to invoke the connection by calling the FM  RFC_REMOTE_FILE.
    I haven’t tried this before but a detailed documentation is available in this link.
    http://sapabap.iespana.es/sap/info/rfcexec/rfcexec_e.htm
    Reward if useful
    Regards
    Shiva

  • Download & upload of an excel file

    Hi,
          I have a requirement where the data needs to be downloaded into an excel file and user will upload the same excel file after making required changes in the data.
    I have used 'GUI_DOWNLOAD' to download the data to excel file. I have tried to upload the same excel file using 'ALSM_EXCEL_TO_INTERNAL_TABLE' and 'TEXT_CONVERT_XLS_TO_SAP' function modules. But it is giving exceptions if I upload the same downloaded file directly. If I copy the data in the downloaded file to another excel file and upload this file, it is working.
    I have tried using 'GUI_UPLOAD' with field separator which was also specified in 'GUI_DOWNLOAD' but in this case the data is uploaded into the internal table like,.
    ###&jkj, 0000 .......
    Please suggest any other alternative.
    Thanks & Regards,
    Vishnu Priya

    Hi,
    You may like to give a try to this FM
    RH_START_EXCEL_WITH_DATA.it will take care of your formatting problem.
    go thru this program..
    *& Report  RHVERI_EXCEL_DOWNLOAD                                       *
    REPORT  rhveri_excel_download.
    DATA: g_excelpath    TYPE string,
          g_excelversion TYPE string,
          g_codepage     TYPE abap_encod,                       "XMK#754232
          g_return_code  TYPE i,                                "XMK#754232
          BEGIN OF gt_data OCCURS 0,
            f1 TYPE char20,
            f2 TYPE char20,
            f3 TYPE char20,
            f4 TYPE char20,
          END   OF gt_data.
    END-OF-SELECTION.
      gt_data-f1 = 'C1'.
      gt_data-f2 = 'C2'.
      gt_data-f3 = 'C3'.
      gt_data-f4 = 'C4'.
      APPEND gt_data.
      gt_data-f1 = '10'.
      gt_data-f2 = '11'.
      gt_data-f3 = '12'.
      gt_data-f4 = '13'.
      APPEND gt_data.
      gt_data-f1 = '20'.
      gt_data-f2 = '21'.
      gt_data-f3 = '22'.
      gt_data-f4 = '23'.
      APPEND gt_data.
      "XMK#754232
      gt_data-f1 = 'AEIOU'.                                     "#EC NOTEXT
      gt_data-f2 = 'aeiou'.                                     "#EC NOTEXT
      gt_data-f3 = '*?#/&§$#'.                                 "#EC *
      gt_data-f4 = 'äöüÄÖÜßaé'.                                 "#EC *
      APPEND gt_data.
      "XMK#754232
      CALL FUNCTION 'RH_CHECK_EXCEL_SUPPORT'
        IMPORTING
          excel_exe_path      = g_excelpath
          excel_version       = g_excelversion
        EXCEPTIONS
          no_batch            = 1
          internal_error      = 2
          excel_not_installed = 3
          wrong_frontend_os   = 4
          OTHERS              = 5.
      IF sy-subrc <> 0.
        WRITE / 'Testaufruf von Excel endete mit Fehlercode:'(002).
        WRITE: sy-subrc, / sy-msgv1, sy-msgv2, sy-msgv3, sy-msgv4.
        MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        EXIT.
      ELSE.
        WRITE: / 'Pfad von Excel'(005), g_excelpath.
        WRITE: / 'Version von Excel'(006), g_excelversion.
      ENDIF.
      "XMK#754232
      IF cl_abap_char_utilities=>charsize <> 1.
        WRITE / 'Unicode system'(007).
        CALL METHOD cl_gui_frontend_services=>get_saplogon_encoding
          CHANGING
            file_encoding = g_codepage
            rc            = g_return_code
          EXCEPTIONS
            OTHERS        = 1.
        IF sy-subrc <> 0.
          g_codepage = '4110'.
        ENDIF.
        WRITE: / 'Codepage is'(009), g_codepage.
      ELSE.
        WRITE / 'Non-Unicode system'(008).
      ENDIF.
      "XMK#754232
      CALL FUNCTION 'RH_START_EXCEL_WITH_DATA'
       EXPORTING
         data_filename             = 'TEST.DAT'
         data_path_flag            = 'W'
       DATA_ENVIRONMENT          =
         wait                      = 'X'
         data_table                = gt_data[]
       EXCEPTIONS
         no_batch                  = 1
         excel_not_installed       = 2
         internal_error            = 3
         cancelled                 = 4
         download_error            = 5
         no_authority              = 6
         file_not_deleted          = 7
         OTHERS                    = 8.
      IF sy-subrc <> 0.
        WRITE / 'Aufruf von Excel endete mit Fehlercode:'(003).
        WRITE: sy-subrc, / sy-msgv1, sy-msgv2, sy-msgv3, sy-msgv4.
        MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        EXIT.
      ELSE.
        WRITE / 'Aufruf von Excel lieferte keinen Fehler.'(004).
      ENDIF.
    Regards,
    Amit

  • FM to tansfer data in flat file from presentation to application server

    Hi Experts,
    Please tell the FM to tansfer data in flat file from presentation server to application server or vice versa in ECC 6.0.
    Thanks.

    Hi,
    This is how you can achieve it:
    1. You read the flat file from presentation layer and store the file content in internal table gt_inrec
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = gw_filename
          filetype                = 'ASC'
        IMPORTING
          filelength              = gw_length
          header                  = gw_header
        TABLES
          data_tab                = gt_inrec
        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.
    2. Create a new file at the application server:
      OPEN DATASET p_ofile FOR OUTPUT IN
      TEXT MODE ENCODING DEFAULT.
    3. Transfer the content from the internal table into the file at the application server:
        LOOP AT gt_inrec.
          TRANSFER gt_inrec-record TO p_ofile.
        ENDLOOP.
    Hope it helps,
    Lim....

  • Read data from Excel file and diaplay in Webdynpro

    Hi all,
    I need some help. I have a Excel file with set of  name, phonenumbers . I want to know how to display the data using Webdynpro. Could some one help me. help is appreciated and I promise to award points for right answer.
    Thank you
    Maruti

    <b>Hi
    i can explain you to read data from Excel file
    First You have to download the jxl.jar file. You can get this file from the Below site
    </b><a href="http://www.andykhan.com/jexcelapi/download.html">jexcelapi jar</a>
    It will be in Compressed Fromat So Unzip it to get the Contents
    After Unzipping The File You will get a Folder (jexcelapi/jxl.jar)
    Now in NWDS open web dynpro explorer, Right Click Your Project, a popup menu will appear and in that click Properties
    You will get window displaying your Project Properties
    On Left Side of the window You Will Find "Java Build Path"
    Click That "Java Build Path" and you will get 4 Tabs Showing ( Source,Projects,Libraries,Order and Export)
    Click Libraries Tab
    You will find options many options buttons
    In that click the Button "Add External Jars"
    You will get Window in order to fecth the jxl.jar file from the location you had stored
    After selecting the jxl.jar i will get displayed and click ok
    Now Open Navigator
    Open Your Project
    You will find Lib folder
    Copy the jxl.jar to that lib folder
    Note : You cannot Read the Content from the excel file directly
    First You Have to copy that file to the Server,
    And from the Server you can get the file absolute path
    With the absolute path you can read the contents of the Excel file
    You have to save the Excel file as .xls Format and Not as xlsx format i will not accept that...
    You have Upload the Excel file from the Server Using the File Upload UI Element
    This Coding will extract 3 columns from the Xls File
    Coding
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import jxl.Cell;
    import jxl.Sheet;
    import jxl.Workbook;
    import com.sap.fileupload.wdp.IPrivateFileUpload_View;
    import com.sap.tc.webdynpro.services.sal.datatransport.api.IWDResource;
    public void onActionUpload_File(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload_File(ServerEvent)
        IPrivateFileUpload_View.IContextElement element1 = wdContext.currentContextElement();
        IWDResource resource = element1.getFileResource();
        element1.setFileName(resource.getResourceName());
        element1.setFileExtension(resource.getResourceType().getFileExtension());
        //@@end
    public void onActionUpload_File_in_Server(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload_File_in_Server(ServerEvent)
        InputStream text=null;
        int temp=0;
        try
             File file = new File(wdContext.currentContextElement().getFileResource().getResourceName().toString());
             FileOutputStream op = new FileOutputStream(file);
             if(wdContext.currentContextElement().getFileResource()!=null)
                  text=wdContext.currentContextElement().getFileResource().read(false);
                  while((temp=text.read())!=-1)
                       op.write(temp);                                      
             op.flush();
             op.close();
             path = file.getAbsolutePath();
             wdComponentAPI.getMessageManager().reportSuccess(path);
        catch(Exception e)
             e.printStackTrace();
        //@@end
    public void onActionUpload_Data_into_Table(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload_Data_into_Table(ServerEvent)
        try
              Workbook wb =Workbook.getWorkbook(new File(path));
              Sheet sh = wb.getSheet(0);
              //wdComponentAPI.getMessageManager().reportSuccess("Columns = "+sh.getColumns());
              //wdComponentAPI.getMessageManager().reportSuccess("Rows = "+sh.getRows());
              int columns = sh.getColumns();
              int rows = sh.getRows();
              int i=0;
             for(int j=1;j<=rows;j++)
                       ele=wdContext.nodeTable_Data().createTable_DataElement();
                       Cell c1 = sh.getCell(i,j);
                      ele.setTab_Name(c1.getContents());
                       Cell c2 = sh.getCell(i+1,j);
                       ele.setTab_Degree(c2.getContents());
                          Cell c3 = sh.getCell(i+2,j);
                       ele.setTab_Percentage(c3.getContents());
                       wdContext.nodeTable_Data().addElement(ele);
        catch(Exception ex)
             wdComponentAPI.getMessageManager().reportSuccess(ex.toString());
        //@@end
       * The following code section can be used for any Java code that is
       * not to be visible to other controllers/views or that contains constructs
       * currently not supported directly by Web Dynpro (such as inner classes or
       * member variables etc.). </p>
       * Note: The content of this section is in no way managed/controlled
       * by the Web Dynpro Designtime or the Web Dynpro Runtime.
      //@@begin others
      String path;
      IPrivateFileUpload_View.ITable_DataElement ele;
    //@@end
    Regards
    Chandran S

  • Downloading the data in excel format

    Hi All,
       I am downloading the data in excel format using FM CONVERT_SAP_TO_XLS_FORMAT and able to open the file in my machine since my machine is having EXCEL 2003 version. In some other machines i tried to download and open,  but after downloading the data in some machines we couldnt open the file since those machines are having the excel2007 versions. but my requirement is i need to open in 2007 version also, please tell me solution.
    With Regards,
    Prasad.

    Hi Lalit,
    Thank you for your information,
    but this function modules EXCEL_OLE_STANDARD_DAT, RH_START_EXCEL_WITH_DATA   cant help to solve my issue,  my requirement is i need to download sap data in excelformat, problem comes here, if i download internal table, in that any text that starts with double cotes and ending with not double cotes, the data is not downloading properly and all the data cramped into one cell. To solve this issue i have used functinal module SAP_CONVERT_TO_XLS_FORMAT and i am able to download without any problem,  but in clients machines they are able to download and they are not able to open as they are having EXCEL 2007 in their machines.
    if is there any solution, please update me.
    Thanks in Advance
    Prasad
    Edited by: bs prasad on Mar 28, 2009 8:03 AM
    Edited by: bs prasad on Mar 28, 2009 8:05 AM

  • How to convert SAPScript data to Excel file

    Hi Experts,
    Curenntly I am converting SAP Script data to PDF file and send an e-mail with attachment (PDF file).
    Same like this, is that possible to covert thda Script data to Excel file to send mail with attachment.???
    If, yes please sugget with respective Function Modules.
    Thanks In Advance.
    Best Regards.

    Hi,
    Thanks for response, Here providing more inforamation.
    Presently my report displaying Customer information. As per user requirement, coverting the Script data to PDF by using
    CALL FUNCTION 'CONVERT_OTF_MEMORY'
              EXPORTING
                format                = 'PDF'
                max_linewidth         = 132
              IMPORTING
                bin_filesize          = doc_size
              TABLES
                lines                 = htline.
    Now user want to add two radiobuttons on selection screen for PSF file & Excel file
    If user seleacts Excel fiel radio button, then I need to covert the SAP Script data to Excel file lik I have done for PDF.
    I'd like to know is that possible covert the Script data to Excel file. If yes, suggest with FMs or process.
    Best Regards.

Maybe you are looking for