Downloading to Excel with OLE concept

Hi All,
  I have created a program in 6.0 version which gives my exact requirement.
Please copy the code and execute the program.
*& Report  ZSK123                                                      *
REPORT  ZSK123                                  .
type-pools: ole2.
DATA: H TYPE I.
data: g_sno(5) type n.
DATA: H_ZL TYPE OLE2_OBJECT,
      H_F  TYPE OLE2_OBJECT.
types: begin of x_comment,
        comment type string,
      end of x_comment.
DATA:  H_EXCEL TYPE OLE2_OBJECT,        " EXCEL OBJECT
H_MAPL TYPE OLE2_OBJECT,         " LIST OF WORKBOOKS
H_MAP TYPE OLE2_OBJECT.          " WORKBOOK
types: begin of x_jobs,
        sno(3) type n,
        jobname(50) type c,
        comment type string,"zrtr,
      end of x_jobs.
DATA: W_STRING(2000) TYPE C.
data: t_jobs type standard table of x_jobs,
      w_jobs type x_jobs.
data: hexcel type ole2_object,
      hrange type ole2_object.
data: l_string type string,
      w_tabix type sy-tabix.
w_jobs-sno = 100.
w_jobs-jobname = 'HAA'.
APPEND W_JOBS TO T_JOBS.
w_jobs-sno = 2.
w_jobs-jobname = 'BAI'.
APPEND W_JOBS TO T_JOBS.
loop at t_jobs into w_jobs.
w_tabix = sy-tabix.
w_jobs-comment = 'What is your name'.
concatenate w_jobs-comment 'My name is Subhani' into w_jobs-comment
          separated by cl_abap_CHAR_UTILITIES=>newline.
modify t_jobs from w_jobs index w_tabix transporting comment.
endloop.
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
  SET PROPERTY OF H_EXCEL  'VISIBLE' = 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.
OUTPUT COLUMN HEADINGS TO ACTIVE EXCEL SHEET
  PERFORM FILL_CELL USING 1 1 1 000 'SNO'(001).
  PERFORM FILL_CELL USING 1 2 1 000 'JOBNAME'(002).
  PERFORM FILL_CELL USING 1 3 1 000 'COMMENT'(003).
  LOOP AT T_JOBS INTO W_JOBS.
COPY DATATO ACTIVE EXCEL SHEET
    H = SY-TABIX + 1.
    PERFORM FILL_CELL USING H 1 0 000 W_JOBS-SNO.
    PERFORM FILL_CELL USING H 2 0 000 W_JOBS-JOBNAME.
    PERFORM FILL_CELL USING H 3 0 000 W_JOBS-COMMENT.
  ENDLOOP.
CALL METHOD OF H_EXCEL 'WORKBOOKS' = H_MAPL.
  CALL METHOD OF H_EXCEL 'WORKSHEETS' = H_MAPL." EXPORTIN    G #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'.
  LOOP AT T_JOBS INTO W_JOBS.
COPY FLIGHTS TO ACTIVE EXCEL SHEET
    H = SY-TABIX + 1.
    PERFORM FILL_CELL USING H 1 0 000 W_JOBS-SNO.
    PERFORM FILL_CELL USING H 2 0 000 W_JOBS-JOBNAME.
    PERFORM FILL_CELL USING H 3 0 000 W_JOBS-COMMENT.
  ENDLOOP.
  FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
*&      FORM  ERR_HDL
      OUTPUTS OLE ERROR IF ANY                                       *
-->  P1        TEXT
<--  P2        TEXT
FORM ERR_HDL.
  IF SY-SUBRC <> 0.
    WRITE: / 'BATCH JOB AUTOMATION CARRIED OUT SUCCESFULLY'.
    STOP.
  ENDIF.
ENDFORM.                    " ERR_HDL             .
      FORM FILL_CELL                                                *
      SETS CELL AT COORDINATES I,J TO VALUE VAL BOLDTYPE BOLD       *
FORM FILL_CELL USING I J BOLD COL VAL.
  CALL METHOD OF H_EXCEL 'CELLS' = H_ZL EXPORTING #1 = I #2 = J.
PERFORM ERR_HDL.
  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.
  SET PROPERTY OF H_F 'COLOR' = COL.
PERFORM ERR_HDL.
ENDFORM.                    "FILL_CELL
But in 4.6c there is no method called cl_abap_char_utilities=>newline. So how can i get the same output in 4.6c. please help.
Regards,
Subhani.

I don't see any method in class cl_abap_char_utilities with name newline.
But when i search class for this string, i see
constants NEWLINE type ABAP_CHAR1 value %_NEWLINE. "#EC NOTEXT
Check this once in your system too.
And you can declare similar variable in 46C and use the same in the program.

Similar Messages

  • Download to Excel with Header but one field data is repeating

    Hi All,
    I'm downloading to Excel with Header. But One field is repeating and another is not. This is happening only when I use   'CONCATENATE ' . With Out this key usage data download to excel is correct. But   CONCATENATE is required as constant need to add before the one field.
    My coding is as below.
    DATA: BEGIN OF IT_FINAL OCCURS 0,
          P1(10) TYPE C,
          SI(19) type c, 
            END OF IT_FINAL.
    DATA : BEGIN OF IT_HEADER OCCURS 0,
    TITLE(100) TYPE C,
    END OF IT_HEADER,WA_HEADER LIKE IT_HEADER.
    loop at it_final.
      CONCATENATE '894412' it_final-SI INTO IT_FINAL.
    modify it_final.
    endloop.
    CLEAR:WA_HEADER.
      WA_HEADER-TITLE = 'Mat No'.
      APPEND WA_HEADER TO IT_HEADER.
      CLEAR:WA_HEADER.
      WA_HEADER-TITLE = 'Serial'.
      APPEND WA_HEADER TO IT_HEADER.
    CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
        EXPORTING
          FILE_NAME  = P_FILE " path offile where u need to download
        TABLES
          DATA_TAB   = IT_FINAL
          FIELDNAMES = IT_HEADER.
    CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
        EXPORTING
          FILE_NAME  = P_FILE " path offile where u need to download
        TABLES
          DATA_TAB   = IT_FINAL
          FIELDNAMES = IT_HEADER.
    Excel OUT PUT:
    Mat No            Serial
    11Z52321     8944126000
    11Z52394     8944126000
    11Z52395     8944126000
    Thank You,
    Pranitha

    hi,
    it would have been better if u hve opt for creating workarea for ur internal table.
    Try to use "clear it_final" after
    CONCATENATE '894412' it_final-SI INTO IT_FINAL.
    n also change the modify statement :
    modify it_final transporting SI .
    hope this will surely help you
    Regards,
    Punit
    Edited by: punit raval on Aug 26, 2011 2:55 PM

  • ALV output download to excel with top of page

    Hi,
    i want to download ALV grid output to excel sheet including the top of page. i am using the icon in application tool bar. but only data's are download to excel sheet. i cannot download the top of page. with out write coding in program can we download it. if yes pls explain.
    thanks.

    I'm sorry but I can't find FM with DOWNLOAD_EXCEL_*.
    I want to know more detail thing.
    plz. give answer to me anytime.
    I'm waiting..
    Edited by: Kwang Seop Kim on Sep 26, 2008 6:57 AM

  • ALV  download to EXCEL  with column headings etc.

    Getting data from a grid to EXCEL can be done in "List" mode vis system==>save etc but it's not particularly user friendly and in any case if you are displaying a nice ALV why should the user have to switch into LIST mode anyway.
    Anyway here's a decent way to do it and it gives great formatted column headings etc etc.
    1) in the ON_TOOLBAR method add this code
    method ON_TOOLBAR.
    type-pools icon.
    CLEAR ls_toolbar.
    MOVE  0 TO ls_toolbar-butn_type.
        MOVE 'EXCEL' TO ls_toolbar-function.
        MOVE  space TO ls_toolbar-disabled.
        MOVE  icon_xxl TO ls_toolbar-icon.
        MOVE 'Excel' TO ls_toolbar-quickinfo.
        MOVE  'EXCEL' TO ls_toolbar-text.
        APPEND ls_toolbar TO e_object->mt_toolbar.
    2) In the ON_USER_COMMAND method add the following
    (if you have a class defined with SE24 you don't need the commented code).
    method ON_USER_COMMAND.
           FOR EVENT before_user_command OF cl_gui_alv_grid
           IMPORTING
             e_ucomm
             sender.
    CASE e_ucomm.
         .......   other toolbar funcs if you have any
          WHEN 'EXCEL'.
            CALL METHOD me->download_to_excel.
        ENDCASE.
    endmethod.
    3) code this method to download to EXCEL
    method DOWNLOAD_TO_EXCEL.
    FIELD-SYMBOLS:
           <fs0> TYPE STANDARD TABLE,
           <fs1> TYPE STANDARD TABLE.
        ASSIGN g_outtab1->* TO <fs0>.
        ASSIGN g_fldcat1->* TO <fs1>.
           CALL FUNCTION  'LVC_TRANSFER_TO_KKBLO'
          EXPORTING
            it_fieldcat_lvc   = <fs1>
        is_layout_lvc     = m_cl_variant->ms_layout
             is_tech_complete  = ' '
          IMPORTING
            es_layout_kkblo   = ls_layout
            et_fieldcat_kkblo = lt_fieldcat.
        LOOP AT lt_fieldcat INTO lt_fieldcat_wa.
          CLEAR lt_fieldcat_wa-tech_complete.
          IF lt_fieldcat_wa-tabname IS INITIAL.
            lt_fieldcat_wa-tabname = '1'.
            MODIFY lt_fieldcat FROM lt_fieldcat_wa.
          ENDIF.
          l_tabname = lt_fieldcat_wa-tabname.
        ENDLOOP.
        CALL FUNCTION 'ALV_XXL_CALL'
             EXPORTING
                  i_tabname           = l_tabname
                  is_layout           = ls_layout
                  it_fieldcat         = lt_fieldcat
                  i_title             = sy-title
             TABLES
                  it_outtab           = <fs0>
             EXCEPTIONS
                  fatal_error         = 1
                  no_display_possible = 2
                  OTHERS              = 3.
        IF  sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    endmethod.
    You get nice column headings etc and decently formatted EXCEL spreadsheet.
    For Office 2007 I think you need to apply a SAP note but it certainly works with OFFICE 2003 which is what we are still using.
    Cheers
    jimbo

    Getting data from a grid to EXCEL can be done in "List" mode vis system==>save etc but it's not particularly user friendly and in any case if you are displaying a nice ALV why should the user have to switch into LIST mode anyway.
    Anyway here's a decent way to do it and it gives great formatted column headings etc etc.
    1) in the ON_TOOLBAR method add this code
    method ON_TOOLBAR.
    type-pools icon.
    CLEAR ls_toolbar.
    MOVE  0 TO ls_toolbar-butn_type.
        MOVE 'EXCEL' TO ls_toolbar-function.
        MOVE  space TO ls_toolbar-disabled.
        MOVE  icon_xxl TO ls_toolbar-icon.
        MOVE 'Excel' TO ls_toolbar-quickinfo.
        MOVE  'EXCEL' TO ls_toolbar-text.
        APPEND ls_toolbar TO e_object->mt_toolbar.
    2) In the ON_USER_COMMAND method add the following
    (if you have a class defined with SE24 you don't need the commented code).
    method ON_USER_COMMAND.
           FOR EVENT before_user_command OF cl_gui_alv_grid
           IMPORTING
             e_ucomm
             sender.
    CASE e_ucomm.
         .......   other toolbar funcs if you have any
          WHEN 'EXCEL'.
            CALL METHOD me->download_to_excel.
        ENDCASE.
    endmethod.
    3) code this method to download to EXCEL
    method DOWNLOAD_TO_EXCEL.
    FIELD-SYMBOLS:
           <fs0> TYPE STANDARD TABLE,
           <fs1> TYPE STANDARD TABLE.
        ASSIGN g_outtab1->* TO <fs0>.
        ASSIGN g_fldcat1->* TO <fs1>.
           CALL FUNCTION  'LVC_TRANSFER_TO_KKBLO'
          EXPORTING
            it_fieldcat_lvc   = <fs1>
        is_layout_lvc     = m_cl_variant->ms_layout
             is_tech_complete  = ' '
          IMPORTING
            es_layout_kkblo   = ls_layout
            et_fieldcat_kkblo = lt_fieldcat.
        LOOP AT lt_fieldcat INTO lt_fieldcat_wa.
          CLEAR lt_fieldcat_wa-tech_complete.
          IF lt_fieldcat_wa-tabname IS INITIAL.
            lt_fieldcat_wa-tabname = '1'.
            MODIFY lt_fieldcat FROM lt_fieldcat_wa.
          ENDIF.
          l_tabname = lt_fieldcat_wa-tabname.
        ENDLOOP.
        CALL FUNCTION 'ALV_XXL_CALL'
             EXPORTING
                  i_tabname           = l_tabname
                  is_layout           = ls_layout
                  it_fieldcat         = lt_fieldcat
                  i_title             = sy-title
             TABLES
                  it_outtab           = <fs0>
             EXCEPTIONS
                  fatal_error         = 1
                  no_display_possible = 2
                  OTHERS              = 3.
        IF  sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    endmethod.
    You get nice column headings etc and decently formatted EXCEL spreadsheet.
    For Office 2007 I think you need to apply a SAP note but it certainly works with OFFICE 2003 which is what we are still using.
    Cheers
    jimbo

  • Customize download to excel with disclaimer

    I need to customize download link in dashboard so that results are downloaded to an Excel sheet but with client' s disclaimer message at the end. Client do not want the disclaimer to be shown on the dashboard. So basically we need to alter the download to Excel link at the system level, so that whenever it is clicked, the report gets downloaded to an excel with the disclaimer message at the end.
    I did some work and found that when we click on Download To Excel option, a function gets called from file \OracleBI\web\msgdb \viewscontrolmessages.xml, there we have:
    Download(&#39;@{command}&amp;Format=mht&am p;amp;Extension=.xls&#39;)
    I think someway we need to alter this download function so that it appends a disclaimer message to Excel after every download.
    Or let me know if you think any other way!
    We are using OBIEE 10g .
    Rahul

    This seems now "re-inventing the wheel" sort of requirement. I was looking into possibility of using GO URL to get the report in csv and then writing a java script to append the disclaimer text in the downloaded file . But am stuck on the front, how to store the file without any manual effort. Because when we use Go URL a save as pop-up throws, rather I want when user clicks on our customized Download link, it should download the data and store in a file and then append it with a disclaimer text and then throw a save as pop-up.
    Also has anyone any idea how to use the any OBIEE java functions in a java script written in text view ( with html enabled ) ?
    Let me know if anyone has any thoughts on how to do that!

  • Download to Excel with Images

    Hello
    The download to excel and PDF documents now includes images.  I have inlcuded images in my web templates to execute commands eg: Download to Excel, Bookmake etc.
    See below:
    img onclick="executeJS_EXPORT_XSLT120();" alt="Download to Excel" src="bwmimerep:///sap/bw/Mime/BEx/Icons/S_X_XLS.gif" border="0"
    These images are simply for command execution and look out of place and serve no purpose in the excel or PDF files.
    My Question:
    Is it possible to exclude these images in the docnload to excel and PDF?
    Thanks in advance.
    Ian
    Message was edited by:
            Ian Carbonel

    Thanks For your reply Prakash.
    This works well after some preliminary testing.
    Thanks
    Ian

  • Download to Excel with Column Headings.

    Hi All,
    I have a very small issue.I want to download the Data from an internal table to an Excel Sheet Along with the Column heading of the corresponding Field...
    I tried with ws_excel and gui_download... not reached to any conclusion,,,I cant go for OLE technique as i have huge amount of data in my internal table.
    If anyone have faced the same problem ...please suggest something.
    Thanks in advance,
    Mayank.

    Hi,
    Once I also faced the same problem.It was solved by the below coding.In my coding i_download is the internal table with two fields werks and matnr .w_download is its workarea.
    PARAMETERS    p_file  LIKE rlgrap-filename.     
      "File name
    Local Variable declaration
      DATA lv_file TYPE string.
      lv_file = p_file.
      PERFORM f1710_populate_heading.
      CALL FUNCTION 'GUI_DOWNLOAD'
           EXPORTING
                filename                = lv_file
                filetype                = 'ASC'
                write_field_separator   = 'X'
           TABLES
                data_tab                = i_download
           EXCEPTIONS
                file_write_error        = 1
                no_batch                = 2
                gui_refuse_filetransfer = 3
                invalid_type            = 4
                no_authority            = 5
                unknown_error           = 6
                header_not_allowed      = 7
                separator_not_allowed   = 8
                filesize_not_allowed    = 9
                header_too_long         = 10
                dp_error_create         = 11
                dp_error_send           = 12
                dp_error_write          = 13
                unknown_dp_error        = 14
                access_denied           = 15
                dp_out_of_memory        = 16
                disk_full               = 17
                dp_timeout              = 18
                file_not_found          = 19
                dataprovider_exception  = 20
                control_flush_error     = 21
                OTHERS                  = 22.
      IF sy-subrc = 0.
        MESSAGE i000 WITH text-005. "File downloded successfully
      ELSE.
        CASE sy-subrc.
          WHEN 1.
            MESSAGE i000 WITH text-014.
          WHEN 21.
            MESSAGE i000 WITH text-071.
        ENDCASE.
      ENDIF.
    ENDFORM.                    " f1500_download_data
    *&      Form  f1710_populate_heading
          Populate header records
    FORM f1710_populate_heading.
      CLEAR w_download.
    Design the text element to handle maximum length of
    the output
      w_download-werks = text-001.
      w_download-matnr   = text-002. 
        INSERT w_download INTO i_download INDEX 1.
    ENDFORM.                    " f1710_populate_heading
    Hope this is clear.
    If your problem is solved,could you please reward useful answers and close the thread.
    Rgds,
    J.Jayanthi

  • Download to excel with multiple lines in header

    Hi experts,
    Is there any Funtion module available to download an internal table contents into Local directory of PC with multiple lines in header.
    i.e.  let us say i hv internal table of 5 entries with 3 columns...
    i need to download this 5 entries into an excel file with some texts above the table contents...
    For eg : in the below format...
    Sample line 1
    sample line 2
    sample line 3
    colheader1     colheader2     colheader3
    item1                              
    item2
    item3
    item4
    item5
    Please help.
    Edited by: Lakshmiraj on Jul 15, 2010 3:26 AM

    There is another option of using OLE automation Please check the link below
    http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-OLEAutomationusing+MS-Excel
    OR
    chek for the example program in Tcode DWDM ( OLE example )
    OR
    Use FM KCD_EXCEL_OLE_TO_INT_CONVERT ( Fm Uses the same OLE automation)
    Hope it helps
    Anup

  • OBIEE-Values after decimal changing after download in excel format

    Hi,
    I have reports in OBIEE 11g,in which some columns have values in %.When i try the various export/download functions and noticed that the Excel download did not maintain the fomatting for pecentage values, they fields go out to about 12 decimal places or so.
    For eg..if a value in report is like 12.54
    After export in Excel it looks like 12.546780393345 .
    As i want the same format,pls suggest the solution.

    Hi,
    Refer below link:
    Downloading to Excel with three decimal precision
    format problem while download to excel
    Re: Formatting problem in download report into EXCEL Sheet
    BUG:
    •9107277 KEEP THE NUMBER PRECISION IN DATABASE WHEN “DOWNLOADING TO EXCEL”
    Thanks
    Deva

  • ALV download to Excel onto desktop using OLE concept.

    Hi Experts,
    I requriement is , through my se38 program i need to download report output to excel.
    i did this using OLE concepts code and excel is being downloaded good.
    But problem is all columns data is dumped into First column. But in my ALV i have 20 columns. So i except data in excel sheet to be in 20 columns.
    Below is the OLE code i used
    CREATE OBJECT wa_excel 'EXCEL.APPLICATION'. "Create object for Excel
      SET PROPERTY OF wa_excel  'VISIBLE' = 1. "In background Mode
      CALL METHOD OF wa_excel 'WORKBOOKS' = w_workbook.
      CALL METHOD OF w_workbook 'ADD'. "Create a new Workbook
      SET PROPERTY OF wa_excel 'SheetsInNewWorkbook' = 3. "No of sheets
    * Downloading header details to first sheet
      PERFORM download_sheet TABLES i_final USING 1 'Master Material Details'.
      GET PROPERTY OF wa_excel 'ActiveSheet' = w_worksheet.
    * Protect the first worksheet with a password
      CALL METHOD OF w_worksheet 'PROTECT
        EXPORTING #1 = 'infy@123'.
    * Save the Excel file
      GET PROPERTY OF wa_excel 'ActiveWorkbook' = w_workbook.
      CALL METHOD OF w_workbook 'SAVEAS'
        EXPORTING #1 = p_infile.
      FREE OBJECT: w_worksheet, wa_excel.
    FORM download_sheet TABLES p_tab  USING p_sheet TYPE i   p_name  TYPE string.
      CALL METHOD OF wa_excel 'WORKSHEETS' = w_worksheet
        EXPORTING
        #1 = p_sheet.
      CALL METHOD OF w_worksheet 'ACTIVATE'.
      SET PROPERTY OF w_worksheet 'NAME' = p_name.
      CALL METHOD OF wa_excel 'Range' = w_range
        EXPORTING
        #1 = 'A1'
        #2 = 'D1'.
      CALL METHOD OF w_range 'INTERIOR' = w_int.
      SET PROPERTY OF w_int 'ColorIndex' = 6.
      SET PROPERTY OF w_int 'Pattern' = 1.
    * Initially unlock all the columns( by default all the columns are locked )
      CALL METHOD OF wa_excel 'Columns' = w_columns.
      SET PROPERTY OF w_columns 'Locked' = 0.
    * Locking and formatting first column
      CALL METHOD OF wa_excel 'Columns' = w_columns
       EXPORTING
       #1 = 1.
    * Locking and formatting second column
      CALL METHOD OF wa_excel 'Columns' = w_columns
        EXPORTING
        #2 = 2.
      SET PROPERTY OF w_columns  'Locked' = 2.
      SET PROPERTY OF w_columns  'NumberFormat' = '@'.
    * Export the contents in the internal table to the clipboard
      CALL METHOD cl_gui_frontend_services=>clipboard_export
        IMPORTING
          data                 = p_tab[]
        CHANGING
          rc                   = w_rc
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
    * Paste the contents in the clipboard to the worksheet
      CALL METHOD OF w_worksheet 'Paste'.
    * Autofit the columns according to the contents
      CALL METHOD OF wa_excel 'Columns' = w_columns.
      CALL METHOD OF w_columns 'AutoFit'.
      FREE OBJECT: w_columns, w_range.
    Please help me if there is any SET Property of WA_EXCEL with which i can handle ALV data into Diffrenet columns.
    Regards,
    jayant.

    hi nabheet,
    we have implemnted this logic and it is workign fine. Bit it takes long time to download data in Excel sheet. Actually it is happening feild by field.
    Please advice any perfomance tuning to this logic.
    Rgs,
    jayant

  • 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 .

  • To upload excel file directly to the application server using OLE concept

    hi experts
    i have done a coding in OLE to download excel with graph to presentation server, is it possible to upload excel with graph directly to the application server  , the excel should have graph while downloading to presentation server fom app server.
    Moderator message - duplicate post locked
    Edited by: Rob Burbank on Jun 25, 2009 9:49 AM

    HI,
    have a look at tcode cg3z and then FM 'C13Z_FILE_UPLOAD_ASCII'.
    What you can do is, first create the file on presentation server using OLE automation, and then using this FM, write the file to Application server

  • Download data into excel with boxes

    Hi Folks,
               In my goods receipt report output, there is a footer with boxes for signature purpose.
               This output should be able to download in Excel format.
               Is it possible to show the boxes in excel file while downloading the output?
               If so, please suggest me how to do so..
              Thanks in advance,
              Shyam.

    Hi ermac,
                  Is there any simple process other than OLE application, as it is a simple report.
                       Thanks,
                       Shyam.

  • Download internal table to excel with header

    Hi All,
    I have a requirement to download internal table contents to excel with field headings. I tried searching in forums before posting but didn't got much help.
    I have used GUI_DOWNLOAD, WS_DOWNLOAD and EXCEL_OLE_STANDARD_DAT.
    But unable to download the header in excel..along with data...
    EXCEL_OLE_STANDARD_DAT is getting field header in excel but not downloading automatically , need to save manually which is not the requirement.
    The data is huge with around 151 columns....I got 2 internal tables.
    One for the data and the other with field names.
    Many Thanks,
    Ravi K

    Hi Ravi,
    You need to have 2 different internal tables for achieving the needful. One internal table would be having your data and another would store your table field names i.e., declare a structure of length 100 characters,
    TYPES : BEGIN OF GTY_FIELDNAMES,
                    TITLE(100),
                  END   OF GTY_FIELDNAMES.
    DATA: GIT_FIELDNAMES TYPE STANDARD TABLE OF GTY_FIELDNAMES,
                GWA_FIELDNAMES TYPE GTY_FIELDNAMES.
    DATA : GD_FILENAME TYPE STRING,
                GD_PATH     TYPE STRING,
                GD_FULLPATH TYPE STRING,
                GD_RESULT   TYPE I.
    Now have a subroutine where by you append your headings into the internal table i.e.,GIT_FIELDNAMES
       CLEAR GWA_FIELDNAMES.
       GWA_FIELDNAMES-TITLE = 'Material Number'.
       APPEND GWA_FIELDNAMES TO GIT_FIELDNAMES.
       CLEAR GWA_FIELDNAMES.
       GWA_FIELDNAMES-TITLE = 'Material Description'.
       APPEND GWA_FIELDNAMES TO GIT_FIELDNAMES.
    Once you are done with it you can call up the save dialog
    * Display save dialog window
       CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
         EXPORTING
           WINDOW_TITLE           = 'Save File As...'
           DEFAULT_EXTENSION  = 'XLS'
           DEFAULT_FILE_NAME  = 'SalesPlan'
           INITIAL_DIRECTORY      = 'C:\'
         CHANGING
           FILENAME                      = GD_FILENAME
           PATH                               = GD_PATH
           FULLPATH                      = GD_FULLPATH
           USER_ACTION               = GD_RESULT.
    * Check user did not cancel request
       CHECK GD_RESULT EQ '0'.
       CALL FUNCTION 'GUI_DOWNLOAD'
         EXPORTING
           FILENAME              = GD_FULLPATH
           FILETYPE                = 'ASC'
    *     APPEND                = 'X'
           WRITE_FIELD_SEPARATOR = 'X'
    *     CONFIRM_OVERWRITE     = 'X'
         TABLES
           DATA_TAB                 = GIT_FINAL                  " Internal table having data
           FIELDNAMES            = GIT_FIELDNAMES     " Internal table having headings
         EXCEPTIONS
           FILE_OPEN_ERROR       = 1                         "#EC ARGCHECKED
           FILE_WRITE_ERROR      = 2
           OTHERS                           = 3.
    Hope this gets sorted your problem.
    Thanks & Regards,
    Varun Kumar Sahu

  • Download excel with formula from alv grid

    I developed a alv report and I have one percentage field(say PER) in the grid.When I sum on that field PER then it comes in my formula basis.Suppose If I have 5 line items and all PER field have a value 2 then when I sum in PER column then it come 7 inseted of 10 becoze of my formula basis and it comes perfect.But my query is when I download to excel then it comes real value 10 insted of 7. here my formula basis sum which is 7 for all 5 line items is not comming. Can any body help me how will it come?
    Thanks,
    Rakesh

    Hi,
    I dont think its possible because... it uses its internal functionality in displaying the alv with the formula you have given.... but while downloading it only considers the internal table that will be downloaded so whatever is there in the internal table that only would be downloaded... you can do one thing..... instead of using a sort standard button include your own sort button and write its code for gui_download and in the internal table append a line which contains the formula you wanted that will work....
    Regards,
    Siddarth

Maybe you are looking for

  • How can I change the preferred WiFi network in my MacBook Pro

    How can I change the preferred order of networks on my MacBook Pro? There used to be one network at my office. Now there is a second higher speed wifi network also present which I would prefer to connect to, but the Macbook connects to the older one

  • Import multipage pdf in an Illustrator document

    Hello, Does a script exist to import multipages pdf document in an illustrator document ? I usually use InDesign to import multipage document with the script named "pdf import". The goal of the manipulation is to outline fonts, or resize the differen

  • Search for Function Name in multi seq files

    HI, How can you search for a Fucntion Name (calling a CVI dll) in multi seq files? The normal search function is looking for step name only.... so, as an example Step Name:  Test No. 1 Specify Module (CVI type step):  

  • Moving Project

    I'm moving my Help project with many baggage files from one machine to another with different directories. How do I handle the file references in the project, or do I have to be concerned about that? Does Robo7 take care of that? Thanks

  • Impact of SATA III - Especially for RAID

    Hello, I am wondering what difference in throughput/speed SATA III will bring to RAID arrays... for example, will a 6 x 1T SATA III RAID (any level) be as fast as a 12 x 1T SATA II RAID (comparable level). The practical reason for my question is this