Prevent copy of excel cells using OLE

Hi All,
I have protected my excel worksheet. But the cells can be copied. I want to prevent this copy of cells using OLE.
I have gone through the EXCEL proerties. But dont know how to exact use them?
Thanks in Advance
-neha

Hello Neha,
I don't think CutCopyMode is the correct answer
Try the below code. It prevents the selection of cells, hence preventing copying.
REPORT  zkris_ole_protectsheet.
*                  Start of Selection                                  *
START-OF-SELECTION.
  TYPE-POOLS ole2 .
  DATA:
         workbook TYPE ole2_object,
         excel     TYPE ole2_object,
         sheet TYPE ole2_object,
         cells TYPE ole2_object.
  CREATE OBJECT excel 'EXCEL.APPLICATION'.
  IF sy-subrc NE 0.
    WRITE: / 'No EXCEL creation possible'.
    STOP.
  ENDIF.
  SET PROPERTY OF excel 'DisplayAlerts' = 0.
  CALL METHOD OF excel 'WORKBOOKS' = workbook .
  SET PROPERTY OF excel 'VISIBLE' = 1.
* creating workbook
  SET PROPERTY OF excel 'SheetsInNewWorkbook' = 1.
  CALL METHOD OF workbook 'ADD'.
  CALL METHOD OF excel 'WORKSHEETS' = sheet
    EXPORTING
    #1 = 1.
* naming and activating the index sheet
  SET PROPERTY OF sheet 'NAME' = 'Index'.
  CALL METHOD OF sheet 'ACTIVATE'.
  CALL METHOD OF sheet 'Cells' = cells
    EXPORTING
    #1 = 3
    #2 = 3.
  SET PROPERTY OF cells 'Value' = 'You cannot select me'.
  CALL METHOD OF sheet 'PROTECT'
    EXPORTING
      #1 = 'pass' " Password
      #2 = 1 " Protect Drawing Objects
      #3 = 1 " Protect Contents
      #4 = 1." Protect Scenarios
  SET PROPERTY OF sheet 'EnableSelection' = -4142.

Similar Messages

  • I have a problem in formatting cells in Excel while using OLE method.

    Hi All,
    I have a problem in formatting cells in Excel while using OLE method.
    My requirement is to have certain fields of a cell as text and amount fields should be in number format.
    How to format a cell in Excel in OLE method of downloading data to excel.
    For example I have plant field whose value is 0002 in internal table while coming to excel it is showing as 2 .
    I want that field to be shown as 0002.(text format)
    Material field whose value in internal table is 000000000000000051 is shown as 51 which has to be shown as
    000000000000000051.(text format).
    Amount field should be in number format so that totalling is possible .
    So I need some cells in text format and some in number format.
    Please suggest a sloution.
    Thanks in advance,
    Regards,
    vidyulatha.U

    https://forums.sdn.sap.com/click.jspa?searchID=21931962&messageID=6852860
    hope this helps.

  • Create a check box in excel cell  using sap abap

    Dear Sap Master's,
    Please give me some idea on  how to create a check box in excel cell using abap program..
    (OLE concept).
    Thanks
    Moderator message: please search for available information first.
    Edited by: Thomas Zloch on Jan 12, 2012

    select the cell then open the cell formatter:
    process should be similar in the iOS version.  I do not have any iOS devices with Numbers so I cannot check.  I did find this link that may help:
    http://support.apple.com/kb/PH3374?viewlocale=en_US

  • Create heck box in excel cell using sap

    Dear Sap Master's,
    Please give me some idea on how to create a check box in excel cell using abap program..
    (OLE concept).
    Thanks,
    Naveen.
    Moderator message: please do some research before posting, show what you have done yourself when posting.
    Edited by: Thomas Zloch on Jan 17, 2012

    Not resolved

  • Regading Excel Creation using OLE

    hi friends,
    i got a new requirement where i have to create the Excel document using OLE. one more thing is some cells has to be filled with some colour and in some cells the text has to come in Vertical manner, this text is used for Header purpose.
    please help me urgently...
    Suitable Answers will get more points..........

    Hello,
    Also take a look at this code
    *& Report  ZKRIS_OLE3_PALETTE
    *& Displays the full OLE color range in excel
    REPORT  ZKRIS_OLE3_PALETTE.
    TYPE-POOLS ole2 .
    DATA:  count TYPE i,
           count_real TYPE i,
           application TYPE ole2_object,
           workbook TYPE ole2_object,
           excel     TYPE ole2_object,
           sheet TYPE ole2_object,
           cells TYPE ole2_object.
    CONSTANTS: row_max TYPE i VALUE 256. " change to 16384 for excel 2007
    DATA index TYPE i.
    DATA:
          h_cell        TYPE ole2_object,        " cell
          h_f           TYPE ole2_object,        " font
          h_int         TYPE ole2_object,
          h_width       TYPE ole2_object,
          h_columns     TYPE ole2_object,
          h_rows        TYPE ole2_object,
          h_font        TYPE ole2_object,
          h_entirecol   TYPE ole2_object.
    DATA: h_range       TYPE ole2_object.
    DATA: h_merge       TYPE ole2_object.
    CREATE OBJECT excel 'EXCEL.APPLICATION'.
    IF sy-subrc NE 0.
      WRITE: / 'No EXCEL creation possible'.
      STOP.
    ENDIF.
    SET PROPERTY OF excel 'DisplayAlerts' = 0.
    CALL METHOD OF excel 'WORKBOOKS' = workbook .
    SET PROPERTY OF excel 'VISIBLE' = 1.
    * creating workbook
    SET PROPERTY OF excel 'SheetsInNewWorkbook' = 1.
    CALL METHOD OF workbook 'ADD'.
    CALL METHOD OF excel 'WORKSHEETS' = sheet
      EXPORTING
        #1 = 1.
    SET PROPERTY OF sheet 'NAME' = 'Color Palette'.
    CALL METHOD OF sheet 'ACTIVATE'.
    DATA: col TYPE i VALUE 1,
    row TYPE i VALUE 2,
    col1 TYPE i VALUE 2,
    col_real TYPE i VALUE 1.
    row = 1.
    col = 3.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'No.'.
    col = col + 1.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'Background'.
    col = col + 1.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'Foreground with white background'.
    col = col + 1.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'Foreground with black background'.
    CALL METHOD OF excel 'Rows' = h_rows
      EXPORTING
        #1 = '2:2'.
    SET PROPERTY OF h_rows 'WrapText' = 1.
    col = 9.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'No.'.
    col = col + 1.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'Background'.
    col = col + 1.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'Foreground with white background'.
    SET PROPERTY OF h_cell 'Bold' = 1.
    col = col + 1.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'Foreground with black background'.
    CALL METHOD OF excel 'Rows' = h_rows
      EXPORTING
        #1 = '1:1'.
    SET PROPERTY OF h_rows 'WrapText' = 1.
    GET PROPERTY OF h_rows 'Font' = h_font.
    SET PROPERTY OF h_font 'Bold' = 1.
    count = 1.
    count_real = count.
    row = 2.
    col = 3.
    DO 56 TIMES.
      PERFORM write_num_and_color.
    ENDDO.
    * autofit
    CALL METHOD OF excel 'Columns' = h_columns
      EXPORTING
        #1 = 'C:L'.
    GET PROPERTY OF h_columns 'EntireColumn' = h_entirecol.
    SET PROPERTY OF h_entirecol 'Autofit' = 1.
    * write palette on lhs
    *range
    CALL METHOD OF excel 'Range' = h_range
      EXPORTING
        #1 = 'A2'
        #2 = 'A20'.
    CALL METHOD OF h_range 'Merge' = h_merge .
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = 2
        #2 = 1.
    SET PROPERTY OF h_cell 'Value' = 'Palette'.
    SET PROPERTY OF h_cell 'Orientation' = 90.         "angled.
    SET PROPERTY OF h_cell 'HorizontalAlignment' = 3.  "center align
    GET PROPERTY OF h_cell 'Font'    = h_f.
    SET PROPERTY OF h_f 'Bold' = 1.                    "bold
    SET PROPERTY OF h_f 'Name' = 'Comic Sans MS'.
    SET PROPERTY OF h_f 'Size' = '14'.
    SET PROPERTY OF h_cell 'VerticalAlignment' = 2.  "center align
    * autofit
    CALL METHOD OF excel 'Columns' = h_columns
      EXPORTING
        #1 = 'A:A'.
    GET PROPERTY OF h_columns 'EntireColumn' = h_entirecol.
    SET PROPERTY OF h_columns 'ColumnWidth' = 4.
    *&      Form  write_num_and_color
    *       text
    FORM write_num_and_color.
      index = row_max * ( row - 1 ) + col.
      CALL METHOD OF sheet 'Cells' = cells
        EXPORTING
          #1 = index.
      SET PROPERTY OF cells 'Value' = count_real.
      col = col + 1.
      CALL METHOD OF excel 'Cells' = h_cell
        EXPORTING
          #1 = row
          #2 = col.
      GET PROPERTY OF h_cell 'Interior'   = h_int.
      SET PROPERTY OF h_int  'ColorIndex' = count_real.
      col = col + 1.
      CALL METHOD OF excel 'Cells' = h_cell
        EXPORTING
          #1 = row
          #2 = col.
      SET PROPERTY OF h_cell 'Value' = 'Sample Text'.
      GET PROPERTY OF h_cell 'Font'    = h_f.
      SET PROPERTY OF h_f 'ColorIndex' = count_real.
      col = col + 1.
      CALL METHOD OF excel 'Cells' = h_cell
        EXPORTING
          #1 = row
          #2 = col.
      GET PROPERTY OF h_cell 'Interior'   = h_int.
      SET PROPERTY OF h_int  'ColorIndex' = 1.
      SET PROPERTY OF h_cell 'Value' = 'Sample Text'.
      GET PROPERTY OF h_cell 'Font'    = h_f.
      SET PROPERTY OF h_f 'ColorIndex' = count_real.
      row = row + 1.
      col = col - 3.
      count = count + 1.
      IF count = 29.
        count = 1.
        row = 2.
        col = col + 6.
      ENDIF.
      count_real = count_real + 1.
    ENDFORM.                    "write_num_and_color

  • Call Excel SpreadSheet using OLE and set format = text

    Hi All,
    I am working on an object, where I need to call Excel SpreadSheet using OLE.
    In SpreadSheet, I need to show data as text (Without Excel Internal Modifications).
    i.e
    if i pass 03/2007 as month in excel, it should show  01/2007 not jan-07.
    I am trying to use the code as below.
    call method of cell 'SET_FORMAT' = text.
    set property of text 'CATEGORY' = 4.
    this code is not giving me desired output.
    Is there any other method i can call? or property I can set?
    can somebody pls send me a document with list of all formattiong methods and properties. I will really appreciate the help.
    Regards,
    Hardik

    Hi, you should concatenate the character ( ' ) into your text, example
    CONCATENATE '''' text INTO text.
    Then print the variable Text into excel and you will see the format as Text,
    Thanks and regards.
    David Carballido
    PD: Sry for my bad English

  • Data download to multiple sheets in Excel without using OLE

    Hi,
    Please let me know if it is possible to download data to multiple sheets in excel without using OLE method
    I am in SRM system and the OLE methods are not working
    Please share some sample code or reference links if any
    Thanks
    SekharJ
    Edited by: SekharJ on Sep 8, 2009 8:43 AM

    Here is my code
      LOOP AT it_final INTO wa_final.
        AT FIRST.
          l_ixml = cl_ixml=>create( ).
          l_document = l_ixml->create_document( ).
          l_element_flights  = l_document->create_simple_element(
                      name = 'PO_Details'
                      parent = l_document ).
        ENDAT.
        l_element_airline  = l_document->create_simple_element(
                    name = 'PO'
                    parent = l_element_flights  ).
        l_value = wa_final-object_id.
        l_rc = l_element_airline->set_attribute( name = 'Objectid' value =
                                                             l_value ).
        l_value = wa_final-description.
        l_rc = l_element_airline->set_attribute( name = 'Description' value =
                                                             l_value ).
        l_value = wa_final-number_int.
        l_rc = l_element_airline->set_attribute( name = 'Item' value =
                                                             l_value ).
        l_value = wa_final-description1.
        l_rc = l_element_airline->set_attribute( name = 'Description1' value =
                                                             l_value ).
        l_value = wa_final-quantity.
        l_rc = l_element_airline->set_attribute( name = 'Quantity' value =
                                                             l_value ).
        l_value = wa_final-capex.
        l_rc = l_element_airline->set_attribute( name = 'Capex' value =
                                                             l_value ).
        l_value = wa_final-ser_num.
        l_rc = l_element_airline->set_attribute( name = 'SerialNo' value =
                                                             l_value ).
        l_value = wa_final-plant.
        l_rc = l_element_airline->set_attribute( name = 'Plant' value =
                                                             l_value ).
        l_value = wa_final-loc.
        l_rc = l_element_airline->set_attribute( name = 'Location' value =
                                                             l_value ).
        l_value = wa_final-bundle.
        l_rc = l_element_airline->set_attribute( name = 'Bundle' value =
                                                             l_value ).
      ENDLOOP.
      l_streamfactory = l_ixml->create_stream_factory( ).
      l_ostream = l_streamfactory->create_ostream_itable( table =
    l_xml_table ).
      l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                                            document = l_document ).
      l_rc = l_renderer->render( ).
      l_xml_size = l_ostream->get_num_written_raw( ).
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            bin_filesize = l_xml_size
            filename     = 'c:\temp\flights.xlsx'
            filetype     = 'BIN'
          CHANGING
            data_tab     = l_xml_table
          EXCEPTIONS
            OTHERS       = 24.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Edited by: SekharJ on Sep 8, 2009 12:04 PM
    Edited by: SekharJ on Sep 8, 2009 12:15 PM

  • How to set border of excel cell through ole ?

    How to set border either of left / right / top / bottom of excel cell through ole ?

    Click on the outside the line above header and select all the columns and rows and set the border horz and vert this will solve your problem. if you select current data alone then it will select the current data alone borders. if you runa diff criteria then for the new values borders wont be there. so better always try selecting the column top i.e above the column header and set the border.

  • Is it possible to create Excel Sheet using OLE automation in App server

    Hi,
       Is it possible to create Excel Sheet using OLE automation in Application server(Open Dataset)
    Thanks in advance...

    Unless your application server is on Windows OS, or it is connected to a Windows server by RFC. What is the requirement exactly, I don't understand?

  • To Display Logo on all the pages of Excel Sheet using OLE

    Dear friends,
                         I have developed one report using OLE which display output in Excel. I have display logo using OLE.
    I am able to display logo on first page of excel sheet. but I am not able to display it on all the pages.
                        Need your help. Please, suggest any good solution.
    Thanks & Regards,
    Sandip Sonar

    Excel repeats only HEADER and FOOTER information on every page. The data on cell is relevant only for that page.
    If you want to print something on every page in Excel, you will have to include it on HEADER/FOOTER section of the excel file.
    To check this, go to excel, on meny go to File->PageSetup. Then select Header/Footer Tab... select Custom Header or custom footer. 
    Whatever you inset here (including image) will be printed on every page of Excel. Don't know OLE property to set this but I feel something should be available to set custom header footer for your file.

  • Create Excel sheet using OLE

    Hi All,
           Can any one help me to create an multiple excel sheet in an work book using OLE. I want to create more than 3 sheets in excel, which is default sheets in excel when we one excel.

    Hi,
    Check the below sample code.
    Here I'm downloading the same table twice into 2 different sheets for example purpose.
    TYPE-POOLS ole2.
    DATA: wf_cell_from  TYPE ole2_object,
          wf_cell_from1 TYPE ole2_object,
          wf_cell_to    TYPE ole2_object,
          wf_cell_to1   TYPE ole2_object,
          wf_excel      TYPE ole2_object,   " Excel object
          wf_mapl       TYPE ole2_object,   " list of workbooks
          wf_map        TYPE ole2_object,   " workbook
          wf_worksheet  TYPE ole2_object,   " Worksheet
          wf_cell       TYPE ole2_object,   " Cell Range
          wf_cell1      TYPE ole2_object,
          wf_range      TYPE ole2_object,   " Range of cells to be formatted
          wf_range2     TYPE ole2_object,
          wf_column1    TYPE ole2_object.   " Column to be Autofit
    DATA: BEGIN OF t_hex,
          l_tab TYPE x,
          END OF t_hex.
    DATA: wf_deli(1) TYPE c,            "delimiter
          wf_action TYPE i,
          wf_file TYPE string,
          wf_path TYPE string,
          wf_fullpath TYPE string.
    TYPES: t_data1(1500) TYPE c,
           int_ty TYPE TABLE OF t_data1. "line type internal table
    *All the data was prepared as line type internal tables for faster
    *download
    DATA: int_matl  TYPE int_ty ,
          int_matl1 TYPE int_ty ,
          wa_matl   TYPE t_data1.
    TYPES: BEGIN OF ty_mara,
           matnr TYPE matnr,
           mtart TYPE mtart,
           matkl TYPE matkl,
           meins TYPE meins,
           END OF ty_mara.
    DATA: int_mara TYPE STANDARD TABLE OF ty_mara,
          wa_mara TYPE ty_mara.
    FIELD-SYMBOLS: <fs> .
    DATA: wc_sheets LIKE sy-index.  "no.of sheets
    DATA: it_tabemp TYPE filetable,
          gd_subrcemp TYPE i.
    CONSTANTS wl_c09(2) TYPE n VALUE 09.
    CLEAR wc_sheets.
    DEFINE ole_check_error.
      if &1 ne 0.
        message e001(zz) with &1.
        exit.
      endif.
    END-OF-DEFINITION.
    SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
    PARAMETERS: p_file   LIKE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK block1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      REFRESH: it_tabemp.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title         = 'Select File'
    *      default_extension    = 'xls'
          default_file_name    = 'Material Details'
    *      with_encoding        =
          file_filter          = '*.xls'
          initial_directory    = 'C:\'
          prompt_on_overwrite  = ' '
        CHANGING
          filename             = wf_file
          path                 = wf_path
          fullpath             = wf_fullpath
          user_action          = wf_action
    *      file_encoding        =
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF wf_action EQ 9.
        MESSAGE 'No File have been Selected' TYPE 'S'.
      ELSE.
        p_file = wf_fullpath.
        PERFORM create_excel.
      ENDIF.
    *&      Form  create_excel
    *       text
    FORM create_excel.
      LOOP AT it_tabemp INTO p_file.
      ENDLOOP.
    * START THE EXCEL APPLICATION
      CREATE OBJECT wf_excel 'EXCEL.APPLICATION'.
      PERFORM err_hdl.
    * PUT EXCEL IN FRONT
      SET PROPERTY OF wf_excel  'VISIBLE' = 1.
      PERFORM err_hdl.
    * CREATE AN EXCEL WORKBOOK OBJECT
      CALL METHOD OF wf_excel 'WORKBOOKS' = wf_mapl.
      PERFORM err_hdl.
      SET PROPERTY OF wf_excel 'SheetsInNewWorkbook' = 3. "no of sheets
      PERFORM err_hdl.
      CALL METHOD OF wf_mapl 'ADD' = wf_map.
      PERFORM err_hdl.
    *Assign the Delimiter to field  symbol.
      ASSIGN wf_deli TO <fs> TYPE 'X'.
      t_hex-l_tab = wl_c09.
      <fs> = t_hex-l_tab.
      CLEAR int_matl.
      REFRESH int_matl.
      SELECT matnr
           mtart
           matkl
           meins
          FROM mara
          INTO CORRESPONDING FIELDS OF TABLE int_mara.
    *first the headings will be displayed  in the excel sheet
      CONCATENATE 'Material Number'
      'Material type'
      'Material Group'
      'Base Unit of Measure'
      INTO wa_matl
      SEPARATED BY wf_deli.
      APPEND wa_matl TO int_matl.
      LOOP AT int_mara INTO wa_mara.
        CONCATENATE wa_mara-matnr
                    wa_mara-mtart
                    wa_mara-matkl
                    wa_mara-meins
                    INTO wa_matl
                    SEPARATED BY wf_deli.
        APPEND wa_matl TO int_matl.
        CLEAR wa_matl.
      ENDLOOP.
    *Copyng thae same contents to another table to display in
    *new sheet
      MOVE int_matl TO int_matl1.
      PERFORM f_material_details
      TABLES int_matl
      USING  1.
      PERFORM f_material_details
      TABLES int_matl
      USING  2.
      GET PROPERTY OF wf_excel 'ActiveSheet' = wf_map.
      GET PROPERTY OF wf_excel 'ActiveWorkbook' = wf_mapl.
      CALL FUNCTION 'FLUSH'
        EXCEPTIONS
          cntl_system_error = 1
          cntl_error        = 2
          OTHERS            = 3.
      IF sy-subrc = 0.
        CALL METHOD OF wf_map 'SAVEAS'
          EXPORTING #1 = p_file.
      ENDIF.
      CALL METHOD OF wf_mapl 'CLOSE'.
      CALL METHOD OF wf_excel 'QUIT'.
      FREE OBJECT wf_mapl.
      FREE OBJECT wf_map.
      FREE OBJECT wf_excel.
    ENDFORM.                    "create_excel
    *&      Form  ERR_HDL
    *       text
    FORM err_hdl.
      IF sy-subrc <> 0.
        WRITE: / 'OLE ERROR: RETURN CODE ='(i10), sy-subrc.
        STOP.
      ENDIF.
    ENDFORM.                    "ERR_HDL
    *-- End of Program
    *&      Form  f_material_details
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f_material_details
       TABLES lint_matl
      USING l_sheet_no TYPE i.
      DATA: lv_lines TYPE i,
            lv_sheet_name(50) TYPE c.
      wc_sheets = l_sheet_no.
      CASE l_sheet_no.
        WHEN 1.
          lv_sheet_name = 'Material_sheet1'.
        WHEN 2.
          lv_sheet_name = 'Material_sheet2'.
      ENDCASE.
    *-- activating the worksheet and giving a  name to it
      CALL METHOD OF wf_excel 'WORKSHEETS' = wf_worksheet
        EXPORTING
        #1 = wc_sheets.
      CALL METHOD OF wf_worksheet 'ACTIVATE'.
      SET PROPERTY OF wf_worksheet 'NAME' = lv_sheet_name.
    *--formatting the cells
      CALL METHOD OF wf_excel 'Cells' = wf_cell_from
        EXPORTING
        #1 = 1
        #2 = 1.
      DESCRIBE TABLE lint_matl LINES lv_lines.
      CALL METHOD OF wf_excel 'Cells' = wf_cell_to
        EXPORTING
        #1 = lv_lines
        #2 = 4.
    *--range of cells to be formatted (in this case 1 to 4)
      CALL METHOD OF wf_excel 'Range' = wf_cell
        EXPORTING
        #1 = wf_cell_from
        #2 = wf_cell_to.
    *--formatting the cells
      CALL METHOD OF wf_excel 'Cells' = wf_cell_from1
        EXPORTING
        #1 = 1
        #2 = 1.
      DESCRIBE TABLE lint_matl LINES lv_lines.
      CALL METHOD OF wf_excel 'Cells' = wf_cell_to1
        EXPORTING
        #1 = lv_lines
        #2 = 1.
      CALL METHOD OF wf_excel 'Range' = wf_cell1  " Cell range for first
                                                  " column(Material)
        EXPORTING
        #1 = wf_cell_from1
        #2 = wf_cell_to1.
      SET PROPERTY OF wf_cell1 'NumberFormat' = '@' . "To disply zeros
      "in Material number
      DATA l_rc TYPE i.
    *DATA download into excel first sheet
      CALL METHOD cl_gui_frontend_services=>clipboard_export
        IMPORTING
          data         = lint_matl[]
        CHANGING
          rc           = l_rc
        EXCEPTIONS
          cntl_error   = 1
          error_no_gui = 2
          OTHERS       = 4.
      CALL METHOD OF wf_worksheet 'Paste'.
      CALL METHOD OF wf_excel 'Columns' = wf_column1.
      CALL METHOD OF wf_column1 'Autofit'.
      FREE OBJECT wf_column1.
    ENDFORM.                    " f_material_details
    Regards,
    Manoj Kumar P
    Edited by: Manoj Kumar on Mar 5, 2009 11:25 AM

  • How to populate arrayList values in a Excel cell using java

    Hi ,
    Iam trying to create Excel sheet using java with Apache-POI api's.I need to display values from an arrayList into Excel cell as drop down.kindly suggest me any idea or share any code if u have any.
    Thanks in advance
    Regards
    Rajesh

    I suggest you use google to find examples.

  • Read an Excel cell using LabView

    Hello,
    I'm trying to read Excel cells with LabView, witch can be numeric data
    or text.
    I want to chose the Excel cell to read.
    I try to use AtiveX commands in order to do so, but it doesn't work,
    and I don't understand all concepts of activeX.
    I searched on the web, but I didn't find any simple example witch can
    run for me.
    Can we do it without activeX commands?
    Do you have any simple example to send me?
    Thank you for your help.
    Jean-Louis, France.

    Here is a simple VI that uses ActiveX to read an Excel cell. It is set up for string values, but it can be changed. If you get a broken run arrow, than you may have to reconfigure some of the propery nodes for your version of Excel.
    Attachments:
    Get_Excel_Cell_Sub.vi ‏99 KB

  • Setting the aixs minimum in excel chart using OLE.

    Hi All,
              The problem am facing is that say if all the values in the chart data range is high  then excel adjusts itself so that the axis minimum doesn't start from zero. But i need the axis to always start from zero. How do i set this using OLE?

    Hi
    Here is ur expected coding...
    REPORT ZCREATEEXCEL.
    TYPE-POOLS OLE2.
    DATA: EXCEL TYPE OLE2_OBJECT,
    WORKBOOKS TYPE OLE2_OBJECT,
    WORKBOOK TYPE OLE2_OBJECT.
    DATA: FILENAME LIKE RLGRAP-FILENAME.
    START THE EXCEL APPLICATION
    CREATE OBJECT EXCEL 'EXCEL.APPLICATION'.
    PERFORM ERR_HDL.
    PUT EXCEL IN FRONT
    SET PROPERTY OF EXCEL 'VISIBLE' = 1.
    PERFORM ERR_HDL.
    INFORM USER OF THE CURRENT STATUS
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
    PERCENTAGE = 0
    TEXT = TEXT-I08
    EXCEPTIONS
    OTHERS = 1.
    CREATE AN EXCEL WORKBOOK OBJECT
    CALL METHOD OF EXCEL 'WORKBOOKS' = WORKBOOKS.
    PERFORM ERR_HDL.
    CALL METHOD OF WORKBOOKS 'ADD' = WORKBOOK.
    PERFORM ERR_HDL.
    EXCEL FILENAME
    CONCATENATE SY-REPID '_' SY-DATUM6(2) '_' SY-DATUM4(2) '_'
    SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.
    CALL METHOD OF WORKBOOK 'SAVEAS' EXPORTING #1 = FILENAME.
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
    WRITE: / 'OLE ERROR: RETURN CODE ='(I10), SY-SUBRC.
    STOP.
    ENDIF.
    ENDFORM.
    Reward if usefull

  • Problem  in  excel  download using  OLE concept

    Hi ,
        i am trying to  create two sheets using OLE concept.
    i am able to create the excel successfully but i can't save it .
    i have one problem .
    GET PROPERTY OF excel 'ActiveSheet' = sheet.
    CALL METHOD OF sheet 'FILESAVEAS' EXPORTING #1 = w_filename1.
    IF sy-subrc eq 0.
    the sy-subrc value comes as  2.
    i am passing 'C:\SKD.XLS'  to  w_filename.
    is anything wrong.
    how can check  this method  and it's exceptions.

    i am getting the file name from user input using the  method
    *"Calling method for getting file name as saved by the user.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title         = w_title
        CHANGING
          filename             = w_filnam
          path                 = w_path
          fullpath             = w_filename1
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
    w_filename1 is of sting type .
    i am passing the  full  path to  it .
    please  let  me  i am doing anything wrong .

Maybe you are looking for