Regarding saving of excel sheet to presentation server...

Hi,
am using OLE inorder to create the EXCEL sheet, but the problem is am not able to save it to presentation server using the following program.. We have to do it Manually..
Please go through it and help me and how will i save it using programm...
this report demonstrates how to send some ABAP data to an
EXCEL sheet using OLE automation.
INCLUDE ole2incl.
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
      h_cell TYPE ole2_object,
      p_filename TYPE rlgrap-filename.
TABLES: spfli.
DATA  h TYPE i.
table of flights
DATA: vert TYPE numc2 VALUE '90'.
DATA: h_format TYPE ole2_object,
      l_cols TYPE ole2_object,
      l_entcol TYPE ole2_object,
      color TYPE char1 VALUE '4'.
DATA: it_spfli LIKE spfli OCCURS 10 WITH HEADER LINE.
*&   Event START-OF-SELECTION
START-OF-SELECTION.
read flights
  SELECT * FROM spfli INTO TABLE it_spfli UP TO 10 ROWS.
display header
  ULINE (61).
  WRITE: /     sy-vline NO-GAP,
          (3)  'Flg'(001) COLOR COL_HEADING NO-GAP, sy-vline NO-GAP,
          (4)  'Nr'(002) COLOR COL_HEADING NO-GAP, sy-vline NO-GAP,
          (20) 'Von'(003) COLOR COL_HEADING NO-GAP, sy-vline NO-GAP,
          (20) 'Nach'(004) COLOR COL_HEADING NO-GAP, sy-vline NO-GAP,
          (8)  'Zeit'(005) COLOR COL_HEADING NO-GAP, sy-vline NO-GAP.
  ULINE /(61).
display flights
  LOOP AT it_spfli.
    WRITE: / sy-vline NO-GAP,
             it_spfli-carrid COLOR COL_KEY NO-GAP, sy-vline NO-GAP,
             it_spfli-connid COLOR COL_NORMAL NO-GAP, sy-vline NO-GAP,
             it_spfli-cityfrom COLOR COL_NORMAL NO-GAP, sy-vline NO-GAP,
             it_spfli-cityto COLOR COL_NORMAL NO-GAP, sy-vline NO-GAP,
             it_spfli-deptime COLOR COL_NORMAL NO-GAP, sy-vline NO-GAP.
  ENDLOOP.
  ULINE /(61).
tell user what is going on
  CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
     EXPORTING
          PERCENTAGE = 0
           text       = text-007
       EXCEPTIONS
            OTHERS     = 1.
start Excel
  CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
  SET PROPERTY OF h_excel  'Visible' = 1.
  CALL METHOD OF h_mapl 'SaveAs' EXPORTING #1 = 'C:\Documents and Settings\jrozar\Desktop\SKV.XLS'.
PERFORM ERR_HDL.
tell user what is going on
  CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
     EXPORTING
          PERCENTAGE = 0
           text       = text-008
       EXCEPTIONS
            OTHERS     = 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.
tell user what is going on
  CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
     EXPORTING
          PERCENTAGE = 0
           text       = text-009
       EXCEPTIONS
            OTHERS     = 1.
output column headings to active Excel sheet
  PERFORM fill_cell1 USING 90 1 1 1 'Flug'(001).
  PERFORM fill_cell1 USING 90 1 2 0 'Nr'(002).
  PERFORM fill_cell1 USING 90 1 3 1 'Von'(003).
  PERFORM fill_cell1 USING 90 1 4 1 'Nach'(004).
  PERFORM fill_cell1 USING 90 1 5 1 'Zeit'(005).
  LOOP AT it_spfli.
copy flights to active EXCEL sheet
    h = sy-tabix + 1.
    PERFORM fill_cell USING h 1 0 it_spfli-carrid.
    PERFORM fill_cell USING h 2 0 it_spfli-connid.
    PERFORM fill_cell USING h 3 0 it_spfli-cityfrom.
    PERFORM fill_cell USING h 4 0 it_spfli-cityto.
    PERFORM fill_cell USING h 5 0 it_spfli-deptime.
  ENDLOOP.
changes by Kishore  - start
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
PERFORM ERR_HDL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP  EXPORTING #1 = 2.
PERFORM ERR_HDL.
tell user what is going on
SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
          PERCENTAGE = 0
          TEXT       = TEXT-009
      EXCEPTIONS
           OTHERS     = 1.
output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL USING 1 3 1 'Von'(003).
PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
   H = SY-TABIX + 1.
   PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
   PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
   PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
   PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
   PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
changes by Kishore  - end
disconnect from Excel
CALL METHOD OF H_MAPL 'Saveas' EXPORTING  #1 = 'C:\tst.xls'.
  p_filename = 'C:\tst.xls'.
  CALL METHOD OF h_mapl 'Saveas'
    EXPORTING
    #1 = p_filename.
  CALL METHOD OF h_excel 'Close'.
FREE OBJECT H_EXCEL.
  PERFORM err_hdl.
      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.
  CALL METHOD OF h_zl 'Interior' = h_format.
      IF J EQ  2.
      color = 2.
SET PROPERTY OF h_format 'ColorIndex' = color.
    ELSE.
      color = 4.
    ENDIF.
  SET PROPERTY OF h_format 'ColorIndex' = color.
  CALL METHOD OF h_zl 'Columns' = l_cols
    EXPORTING
    #1 = 2.
  CALL METHOD OF l_cols 'EntireColumn' = l_entcol.
  CALL METHOD OF l_entcol 'Autofit'.
  SET PROPERTY OF h_zl 'Value' = val .
  PERFORM err_hdl.
  GET PROPERTY OF h_zl 'Font' = h_f.
  PERFORM err_hdl.
  SET PROPERTY OF h_f 'Bold' = bold .
  PERFORM err_hdl.
ENDFORM.                    "FILL_CELL
*&      Form  FILL_CELL1
      text
     -->VERT       text
     -->I          text
     -->J          text
     -->BOLD       text
     -->VAL        text
FORM fill_cell1 USING vert i j bold val.
  CALL METHOD OF h_excel 'Cells' = h_zl EXPORTING #1 = i #2 = j.
  PERFORM err_hdl.
  SET PROPERTY OF h_zl 'Orientation' = vert.
  CALL METHOD OF h_zl 'Interior' = h_format.
    IF J EQ  2.
      color = 2.
SET PROPERTY OF h_format 'ColorIndex' = color.
    ELSE.
      color = 4.
    ENDIF.
  SET PROPERTY OF h_format 'ColorIndex' = color.
  CALL METHOD OF h_zl 'Columns' = l_cols
    EXPORTING
    #1 = i.
  SET PROPERTY OF h_zl 'Value' = val .
  PERFORM err_hdl.
  GET PROPERTY OF h_zl 'Font' = h_f.
  PERFORM err_hdl.
  SET PROPERTY OF h_f 'Bold' = bold .
  PERFORM err_hdl.
ENDFORM.                                                    "FILL_CELL1
*&      Form  ERR_HDL
      outputs OLE error if any                                       *
-->  p1        text
<--  p2        text
FORM err_hdl.
  IF sy-subrc <> 0.
    WRITE: / 'Fehler bei OLE-Automation:'(010), sy-subrc.
    STOP.
  ENDIF.
ENDFORM.                    " ERR_HDL

Hello Subhash,
Try this
data: sheet TYPE ole2_object.
data: lv_file(512) default 'C:tst.xls'.
* Save excel speadsheet to particular filename
  GET PROPERTY OF h_excel 'ActiveSheet' = sheet.
  CALL METHOD OF sheet 'SaveAs'
    EXPORTING
      #1 = lv_file     "filename
      #2 = 1.                      "fileFormat

Similar Messages

  • Sending an Email by taking excel sheet from Application Server.

    Hi.
    I Searched in SDN related 'Sending an Email by taking excel sheet from Application Server'.
    But i didnt get. I got sending mails from local pc.
    Can some bdy provide me sample code how to send mail with an attachment. the attached file should get from Application Server
    Regards,
    Renu

    Hi,
    For writing data to app server from internal table:
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/prog%252bon%252bopen%252bdataset%252binput
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/prog%252bon%252bopen%252bdataset%252boutput
    Checkout this wiki for sending XL in mail attachment:
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/multiple%252battachment%252bon%252be_mail
    Thanks,
    Krishna

  • Error in importing multiple excel sheets to SQL Server

    I have a package which imports multiple excel sheets to SQL server using a For each Container. However I am getting the following error message "Excel Source failed validation and returns validation status "VS-NEEDSNEWMETADATA".
    Can you please advise me of the steps to potentially resolve this issue ?
    Many thanks
    Scott

    Hi Scott,
    Based on your scenario, you need to implement dynamic columns mapping which is not natively supported by managed source/destination adapters. To achieve dynamic columns mapping, we need to make use of Script Component to parse the input columns and dynamically
    map them to the destination columns.
    References:
    http://munishbansal.wordpress.com/2009/06/09/dynamic-columns-mapping-%E2%80%93-script-component-as-destination-ssis/ 
    http://blog.quasarinc.com/ssis/best-solution-to-load-dynamically-change-csv-file-in-ssis-etl-package/ 
    http://stackoverflow.com/questions/13836874/script-task-in-dft-doesnt-get-excecuted 
    Regards,
    Mike Yin
    TechNet Community Support

  • Downloading logo in excel sheet from application server

    hi all
    how can i download a logo in excel sheet from the application server(logo is in OAOR tcode) .you can also specify with OOPS concept.
    rewards assured.
    Reagrds
    Swarnali Basu

    hi naresh
    i think there is some miscommunication in case of my question,my requirement is to add a logo in excel sheet from application server,i mean when the user clicks to download the excel sheet the logo should immediately appear in the excel sheet,and it is not a fixed logo it can be anything which appears in applicaton server(on that program).
    as far as excel sheet stanalone is concerned i know to do it and as well as to get the logo  in the application server standalone ,but i cant download the logo in excel sheet from the application server.now does my question make sense ?
    Reagrds
    Swarnali

  • 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

  • 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

  • Facing Problem in saving to Excel Sheet

    Hi,
    This is Anupam from Kolkata of India.
    I am writing a jsp in which I am facing some problem .I am trying to save the content of a table to a excel shhet.The code is follows
    <%@ page contentType="application/vnd.ms-excel" %>
    <html>
    <%-- Set the content disposition header --%>
    <%
    response.setHeader("Content-Disposition", "inline; filename=\"mult-table1.xls\"");
    %>
    <body>
    <table>
    <% for(int i = 1; i <= 12; i++){ %>
    <tr>
    <% for(int j = 1; j <= 12; j++){ %>
    <td>
    <%= i * j %>
    </td>
    <% } %>
    </tr>
    <% } %>
    </table>
    </body>
    </html>
    The jsp is saving the the table to the Excel Sheet but in the browser I am getting the Error Message
    Internet Explorer was unable to link to the Web page you requested. The page might be temporarily unavailable
    This may be because I have changed the changed the content type from text/html.
    Another problem I am facing that I am creating a portlet in the weblogic Portal but it is displaying error message box informing that the jsp can not be downloaded.
    Can any body help me out
    Thanks in advance
    Anupam Sarkar

    Your code works, when I try to access your JSP page, it correctly downloads the table data into an excel spreadsheet.
    Regarding the weblogic portlet you can check with Weblogic forum or provide more details so we can diagnose the problem.

  • 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

  • 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

  • Internal Table data to Excel Sheet

    Hi All,
    I have an internal table have some data , which I have to populate and save  excel sheet on presentation server and application server both according to options, with column heading and header text through program.
    could any one help me how to do it, if possible a sample code.
    thanks
    bobby

    HI bobby,
    Transferring Data from ABAP Internal Table to Excel Sheet
    If you wish to transfer data from ABAP internal table to EXCEL you can use the following function module.
    MS_EXCEL_OLE_STANDARD_DAT
    This function module populates an existing excel sheet with the data from the ABAP internal table. Please find below code which shows hwo to declare and populate the import and important parameters. In the next section we will see in depth how this function module operates.
    REPORT ZEX_DATATOEXCEL .
    Parameters: P_file like RLGRAP-FILENAME.
    data : begin of int_head occurs 0,
    Filed1(20) type c,                     " Header Data
    end of int_head.
    data : begin of int_data occurs 0,
    Field1(20) type c,                     " Data
    Field2(20) type c,
    Field3(20) type c,
    Field4(20) type c,
    end of int_data.
    int_head-Filed1 = 'Sales Ord'.
    APPEND int_head.
    CLEAR  int_head.
    int_head-Filed1 = 'Sold-to-Party'.
    APPEND int_head.
    CLEAR  int_head.
    int_head-Filed1 = 'Purchase Ord'.
    APPEND int_head.
    CLEAR  int_head.
    int_head-Filed1 = 'Ship-to-Party'.
    APPEND int_head.
    CLEAR  int_head.
    int_data-field1 = '1JOHN'.
    int_data-field2 = '2TOM'.
    int_data-field3 = '3BRAD'.
    int_data-field4 = '4PETER'.
    Append int_data.
    Clear int_data.
    CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
    EXPORTING
    file_name = p_file " path offile where u need to download
    CREATE_PIVOT = 0
    DATA_SHEET_NAME = ' '
    PIVOT_SHEET_NAME = ' '
    PASSWORD = ' '
    PASSWORD_OPTION = 0
    TABLES
    PIVOT_FIELD_TAB =
    data_tab = int_data "internal table with data
    fieldnames = int_head "internal table with header
    EXCEPTIONS
    file_not_exist = 1
    filename_expected = 2
    communication_error = 3
    ole_object_method_error = 4
    ole_object_property_error = 5
    invalid_filename = 6
    invalid_pivot_fields = 7
    download_problem = 8
    OTHERS = 9
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    thanks
    karthik

  • How to Get the excel sheet formula from the server side into the j2me app?

    How to Get the excel sheet formula from the server side into the j2me application?
    Here the excel sheet is in server side.i want to do get the excel sheet values (only some part of the excel sheet based on some conditions) from server side into j2me.In j2me I want to done some client side validation based on the formula of excel sheet.Then i resend the new updated data to the server.
    But here deosn't know any mehtod to get the excel sheet formula from server side.So kindly help me to get the excel sheet formula from the server.
    So how to get the excel sheet formula frome the server side into j2me Application...
    Plz guide me to solve this issue...
    thanks & regards, Sivakumar.J

    You should not post a thread more than once. You've crossposted this question to another forum. I have deleted that one.

  • Opening Excel sheet from server

    Hi I have one requirement to open Excel Sheet.
    The Excel sheet is residing in a directory parallel to WEB-INF. I am using Jboss server in Linux. in UI whenever I click on link I have to open Excel sheet from the server. Before opening Excel sheet I have to fill with some data. i am using JSP/Servlets .
    Can any one help me on this?
    Guru

    this piece of code is just open a xsl file with writing some data on the file
    it may be helpful for u .i am giving only logic.
    import java.util.*;
    import java.io.* ;
    import java.text.* ;
    public class a{
         // Main method
         public static void main (String args[])
              // Stream to write file
              //File file;
              FileWriter fout;
              String TimeStamp;
              try
              // Open an output stream
              Calendar currentdate= Calendar.getInstance();
                   int currmonth=currentdate.get(Calendar.MONTH)+1;
                   String strMonth="";
                   if(currmonth<10)
                        strMonth="0"+currmonth;
                   String wbname="Equifax"+strMonth+currentdate.get(Calendar.YEAR)+".xls";
                   System.out.println(wbname);
              BufferedWriter outfile = new BufferedWriter(new FileWriter(wbname));
                   //file=new File(filename);
                   fout = new FileWriter (wbname);
              // Print a line of text
              TimeStamp = new java.util.Date().toString();
              //String filename1=file.getName();
              outfile.write(" Apply ");
              // Close our output stream
              outfile.close();          
              // Catches any error conditions
              catch (IOException e)
                   System.err.println ("Unable to write to file");
                   System.exit(-1);
    }

  • Excel sheet values are displayed in Chinese while reading from server in WD

    Hi,
    I am reading an excel file values, from the excel sheet which is in the server. I am able to the read the values from webdynpro, but the values which i'm getting are in Chinese language. But the excel sheet there in server has the values in English.
    Please help on this.
    Thanks,
    Suresh
    Edited by: SureshKumar Arumugam on May 10, 2009 4:01 PM

    Hi,
    On the Microsoft Side: Ensure that the Excel Sheet - indeed has values in English. It may be that you may be reading the wrong excel sheet in the wrong folder. If not and the characters are in English and you are still reading in other languages - go to [Microsoft Help on Multiple Languages|http://office.microsoft.com/en-us/excel/HP052558391033.aspx]. Follow the procedure and change the languages for only English.
    On the SAP Side: If the above still does not work - check if you are using any .xlf files for Chinese. For more information on .xlf files and internationalization, please go to : [Internationalization of WDJ Projects|http://help.sap.com/saphelp_nw04s/helpdata/en/8e/7ce87a2aede645ae3cdc857b791590/frameset.htm]
    Thanks.
    p256960

  • EXCEL WORKBOOK ON APPLICATION SERVER IN BACKGROUND

    Dear Experts,
    I have to download a file as excel workbook in background on application server.
    I have used open / close data set using  that I am able to download .CSV and Tab Delimated file(with extension as .xls) but not excel workbook.
    Regards and Thanks,
    Vikas

    Hi Vikas,
        what i understood is , u hav a excel file on presentation server (desktop)  and want to upload it to the appln server. if so do the following :
    step one :  save the excel file with all the data u wanted in it.
    step two : save as  the excel file  in tab delimited format.
    step three : save as the tab delimited file in ansi    .txt format.
    Now cg3z to upload the text file (.txt) in appln server .
    open the file as below:
    DATA: begin of itab,
               col1  type <>,
               col2  type <>,
              end of itab.
    DATA : wa_itab   like itab.
    DATA: wa(100)       TYPE c,
               xeof(1)        TYPE c.
    PARAMETERS: p_file(30) TYPE c DEFAULT 'appln server path .txt' LOWER CASE
                                             OBLIGATORY,
    OPEN DATASET  <p_file> FOR INPUT IN TEXT MODE
                           ENCODING DEFAULT.
      IF sy-subrc NE 0.
        WRITE  : ' error opening the file "
        EXIT.
      ELSE.
        DO.
          READ DATASET p_file INTO wa.
          IF sy-subrc NE 0.
            xeof = 'X'.
            EXIT.
          ENDIF.
          IF sy-subrc EQ 0.
            PERFORM split_data.
          ELSE.
            EXIT.
          ENDIF.
        ENDDO.
        CLOSE DATASET p_file .
    FORM split_data .
      SPLIT wa AT  cl_abap_char_utilities=>horizontal_tab
                                          INTO  wa_itab-col1  wa_itab-col2  wa_itab-col3.
      APPEND wa_itab TO gi_itab.
    ENDFORM.                    " SPLIT_DATA

  • Download File from BSP to presentation server.

    Hi all,
    We have a requirement to Download and Upload a file in Standard BSP application HRECM_BDG_MAINT.
    Flow of the logic is : 
    1.  On click on Download button.  A Save file dialog should come and then user will select the path for saving the file.  Then the internal table sholud be save in excel on the presentation server.
    2.  User will modify the excel file.
    3   on click of upload button again the open dialog should come and then user will select the excel file from the presentation server and then file will be uploaded into the BSP application.
    Note : We are very much clear with the functionality.  Over main concern is to get the file dialog popup on the BSP application.
    Changes in the layout (Download & Upload Button) has been created.
    Actually HRECM_BDG_MAINT call another BSP application HR_ECM_BDG_SRV02.
    Controller class of of page budget_details.bsp (HR_ECM_BDG_SRV02) is CL_HRECM00_BSP_BDG_DETAILS.
    All the button displayed in this BSP page are created at runtime in class (CL_HRECM00_BSP_BDG_DETAILS) in method DO_REQUEST.  We have used enhancement spot and added two more buttons (Download and Upload).
    Now our main problem is to get file dialog popup on the BSP screen when we click on that button.
    Kindly help
    Ankit Gupta

    Hello
    I have a BSP that shows all the client data and generate a file when a boton is push.
    What I need to know is; how can i made that the system generate a file for each client without having the internet explorer pup-up for download each time, furthermore, I want that these files to be located at the local unit C:\.
    The code i have is as follow:
    DATA: fichero TYPE string.
      CONCATENATE 'F' vnomfich '.xls' INTO vnomfich.
    some Browsers have caching problems when loading Excel format
      response->delete_header_field( name = if_http_header_fields=>cache_control ).
      response->delete_header_field( name = if_http_header_fields=>expires ).
      response->delete_header_field( name = if_http_header_fields=>pragma ).
    start Excel viewer either in the Browser or as a separate window
      response->set_header_field( name  = if_http_header_fields=>content_type
                                  value = 'application/vnd.ms-excel' ).
      CONCATENATE ' attachment; filename= ' vnomfich INTO fichero.
      response->set_header_field( name  = 'Content-Disposition'
                                  value = fichero ).
    finally display Excel format in Browser
      response->set_cdata( data = l_output ).
    do not process Layout, response has been rendered
      navigation->response_complete( ).

Maybe you are looking for