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

Similar Messages

  • How to download report output to excel file??

    Hi all,
    I have a problem with downloading a report output to an excel file? May i know is there any functions or methods to do it?
    My situation is like this. I used Write function to print out the report. After user click on the execute button. The report output will show to the user in a table format. And there is one button 'Save To Excel' in the report output dipslay screen for user to click to save it into excel format.
    Appreciate if you could help.
    Thanks.
    Regards,
    Rachel

    Hi Rachel,
           You can use FM GUI_DOWNLOAD for transferring the data from your report program into excel sheet.
    And while saving give the filename extension as .xls.
    Reward if helpful.
    With regards,
    Syed

  • 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

  • How to Download displayed output to Excel Using Bsp Application

    Hi Experts,
    please give me some idea because I am New In BSP.
    How to Download displayed output to Excel Using Bsp Application.
    If any sample code please do send me.
    In my condition I am getting data in  2-3 table view formats on one page and i want download that in Excel.
    please help me.
    Regards & Thanks,
    Yogesh

    Hi,
    This is more a question for the BSP forum.
    Anyway, as such it's realy easy since you can use HTML in order to import to Excel. All you need to do is add
    runtime->server->response->set_header_field( name = 'Contnet-Type'
    value = 'application/vnd.ms-excel' ).
    runtime->server->response->delete_header_field( name = 'Cache-Control' ).
    runtime->server->response->delete_header_field( name = 'Expires' ).
    runtime->server->response->delete_header_field( name = 'Pragma' ).
    Also check threads like
    Download BSP data into Excel
    export bsp-table to excel
    Export BSP Table to Excel
    Eddy
    PS. Reward useful answers and earn points yourself

  • How to download internal structure in Excel file ?

    Hi,
    In a ABAP 4.7 program, we need to download internal table/structures in a excel file. Automatically (as manually with breakpoint and Excel export button),
    The SAP_CONVERT_TO_XLS_FORMAT doesn't work (empty file) certainly cause non STANDARD TABLE used.
    There is various internal tables/structures, see one below
    TYPES:
      BEGIN OF gty_rup,
        kunnr                   LIKE           bsid-kunnr,
        xref1                   LIKE           bsid-xref1,
        xref3                   LIKE           bsid-xref3,
      END OF gty_rup.
    TYPES:
      BEGIN OF gty_rup_tiers,
        zztie                   LIKE           bseg-zztie,
        zzdat                   LIKE           bseg-zzdat,
        zzsea                   LIKE           bseg-zzsea,
      END OF gty_rup_tiers.
    TYPES:
      BEGIN OF gty_data_solde,
        wrbtr                   LIKE           bsid-wrbtr,
        shkzg                   LIKE           bsid-shkzg,
        belnr                   LIKE           bsid-belnr,
        hkont                   LIKE           bsid-hkont,
        buzei                   LIKE           bsid-buzei,
        bldat                   LIKE           bsid-bldat,
        gjahr                   LIKE           bsid-gjahr,
        blart                   LIKE           bsid-blart,
      END OF gty_data_solde,
    DATA:
      BEGIN OF lt_prps            OCCURS         0,
        key_client              TYPE           gty_rup,
        key_tiers               TYPE           gty_rup_tiers,
        data                    TYPE           gty_data_solde,
      END OF lt_prps.
    Does someone know function working with only the table/structure name as parameter ?
    Thanks
    Herve

    here's what I did....I opened the xfile2.txt with Excel 2007 and stepped through the import wizard as a tab-delimited file.  You're quite right it seems about the XLS function module.... I couldn't get a file downloaded that I could open with that thing.  So I dropped it and just did the following:
    TYPES: BEGIN OF gtypx.
    INCLUDE TYPE gty_rup.
    INCLUDE TYPE gty_rup_tiers.
    INCLUDE TYPE gty_data_solde.
    TYPES END OF gtypx.
    DATA: lt_prps TYPE STANDARD TABLE OF gtypx WITH HEADER LINE.
    START-OF-SELECTION.
      lt_prps-kunnr = '1234'.
      APPEND lt_prps.
      LOOP AT lt_prps.
        WRITE:/ lt_prps-kunnr.
      ENDLOOP.
      DATA:  lv_filen type string value 'c:\xfile2.txt'.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
    *     BIN_FILESIZE                    =
          filename                        = lv_filen
         FILETYPE                        = 'ASC'
    *     APPEND                          = ' '
         WRITE_FIELD_SEPARATOR           = 'X'
    *     HEADER                          = '00'
    *     TRUNC_TRAILING_BLANKS           = ' '
    *     WRITE_LF                        = 'X'
    *     COL_SELECT                      = ' '
    *     COL_SELECT_MASK                 = ' '
    *     DAT_MODE                        = ' '
    *     CONFIRM_OVERWRITE               = ' '
    *     NO_AUTH_CHECK                   = ' '
    *     CODEPAGE                        = ' '
    *     IGNORE_CERR                     = ABAP_TRUE
    *     REPLACEMENT                     = '#'
    *     WRITE_BOM                       = ' '
    *     TRUNC_TRAILING_BLANKS_EOL       = 'X'
    *     WK1_N_FORMAT                    = ' '
    *     WK1_N_SIZE                      = ' '
    *     WK1_T_FORMAT                    = ' '
    *     WK1_T_SIZE                      = ' '
    *     WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
    *     SHOW_TRANSFER_STATUS            = ABAP_TRUE
    *   IMPORTING
    *     FILELENGTH                      =
        tables
          data_tab                        =  lt_prps
    *     FIELDNAMES                      =
    *   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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • ALV ( How to save the output as Excel file whenever we runs the Report )

    Hi,
          Can any one please let me know , how we can automatically save a ALV Grid Display report in Excel Format in presentation server whenever we execute the Report.
    Regards
    Avi.

    Hi,
    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
    TABLES: SPFLI.
    DATA  H TYPE I.
    table of flights
    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_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.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_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  - 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_EXCEL 'FILESAVEAS' EXPORTING  #1 = 'C:\SKV.XLS'.
      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.
      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.
    *&      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
    Please note that this example maybe slow at filling the excel table
    (perhaps four fields per second on a 900 MHz machine - almost 30 seconds
    for a short example).
    To get the data on properties and methods - there is a bit of smoke and mirrors
    going on here; they are EXCEL properties and methods, not sap ones - so you need
    to look at excel help to determine how a particular function is structured. then
    build the block in sap, as shown in the example.
    If you only want to transfer the data to Excel like when you transfer the data from
    ALV to Excel simply use the Function Modules:
    XXL_SIMPLE_API
    If you want more modifications when you transfer it to Excel use:
    XXL_FULL_API
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

  • How to export report output into excel file

    hi friends,
    i would like to get the solution from you for how to export the report output into a .xls file. i know how to convert it into .rtf and .txt files but i think it's difficult to do this .xls way, could you help me to comeover this problem?
    thankyou very much.

    The official answer is "delimited", which
    generates adequate comma or other delimited
    text. No formatting, and without extra
    effort no support for non-ASCII characters.
    Might be sufficient for you.
    Note that Excel can read html files - we
    built programs to generate html files with
    name of "blah.xls" and some Excel-ish
    extensions, so Excel is automatically opened
    and the document is all nice and pretty.
    (Oracle html output has some odd logic about
    choosing number of columns, we didn't use
    it.)
    -- Allan Plum

  • How to download a text, bat, excel file from a page

    Hi All,
    I have written a jsp code that will list all the present in a particular folder. Those are displayed as links and on click, I want to download the file (pop-up message with the option to open or save it)...
    But this is working properly for files like .exe, .pdf, .so etc. But when I am trying to download a .txt, .dat, .xls or .jpg (even .bat or .zip) files, it's getting opened in the same browser (files like .doc, .xls or .zip are opening in unreadable format). Even if, I right click on the link and click on 'Save Target As...', the file is getting saved as .html format.
    I am attaching the jsp code:
    <%@ page import = "java.io.File"%>
    <h3><u>Right-click on the link and select 'Save Target As...' to download</u></h3>
    <%
         String directory = "C:/My Drive/my_context/my testings/file upload 2/files/";
         File file = new File(directory);
         File[] content = file.listFiles();
         for (int i=0; i<content.length; i++)
    %>
              <a href="./files/<%=content.getName()%>"><%=content[i].getName()%></a>
              <br>
    <%
    %>
    <br><br>
    BACK
    But I don't think that there is anything to do with the code. Can anybody help me on this.
    Thanks in Advance,
    Ujjal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi All,
    I have written a jsp code that will list all the present in a particular folder. Those are displayed as links and on click, I want to download the file (pop-up message with the option to open or save it)...
    But this is working properly for files like .exe, .pdf, .so etc. But when I am trying to download a .txt, .dat, .xls or .jpg (even .bat or .zip) files, it's getting opened in the same browser (files like .doc, .xls or .zip are opening in unreadable format). Even if, I right click on the link and click on 'Save Target As...', the file is getting saved as .html format.
    I am attaching the jsp code:
    <%@ page import = "java.io.File"%>
    <h3><u>Right-click on the link and select 'Save Target As...' to download</u></h3>
    <%
         String directory = "C:/My Drive/my_context/my testings/file upload 2/files/";
         File file = new File(directory);
         File[] content = file.listFiles();
         for (int i=0; i<content.length; i++)
    %>
              <a href="./files/<%=content.getName()%>"><%=content[i].getName()%></a>
              <br>
    <%
    %>
    <br><br>
    BACK
    But I don't think that there is anything to do with the code. Can anybody help me on this.
    Thanks in Advance,
    Ujjal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to download a smartform output as excel file WITH EXACT LAYOUT.

    Hi,
         I have searched the forum but could not found any satisfactory answer. I have a smartform with a table, some texts and a logo. I have to write a code which will save the smartform output as excel file in the system keeping the layout of the smartform output EXACT.
    i.e., the excel file will contain the output with EXACTLY THE SAME layout as would have been for a pdf file (if the smartform output is converted to a pdf file) and the client can then edit the fields of the table in the excel file.  How can I achieve this? Please give a suggestion.. Thanks in advance.

    Hi Anirban,
    Your Requirement is to download a smartform to  microsoft  Excel .
    Well unfortunately we can only download data into excel which is in a tabular format i.e stored in internal tables we have function modules to do the same even u can do that using OLE2.
    If u try to download a smartform to Excel only format supported will be ASCII, if u will continue with that the smartforms text's will get downloaded to excel but whole data would be downloaded in a single Cell.
    Code to do the same is -
    >>>>
    CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
      EXPORTING
      i_language = v_language
      i_application = 'SAPDEFAULT'
      IMPORTING
      e_devtype = v_e_devtype.
       CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME                 = w_form
    *   VARIANT                  = ' '
    *   DIRECT_CALL              = ' '
       IMPORTING
         FM_NAME                  =  w_fmname
       EXCEPTIONS
         NO_FORM                  = 1
         NO_FUNCTION_MODULE       = 2
         OTHERS                   = 3
      IF sy-subrc <> 0.
        MESSAGE E002(zcpm) WITH 'Smartform call fails'.
      ENDIF.
    wa_outopt-tdprinter = v_e_devtype.
    wa_ctrlop-no_dialog = 'X'.
    wa_ctrlop-getotf    = 'X'.
      CALL FUNCTION w_fmname "'/1BCDWB/SF00000025'
        EXPORTING
    *   ARCHIVE_INDEX              =
    *   ARCHIVE_INDEX_TAB          =
    *   ARCHIVE_PARAMETERS         =
        CONTROL_PARAMETERS         = WA_CTRLOP
    *   MAIL_APPL_OBJ              =
    *   MAIL_RECIPIENT             =
    *   MAIL_SENDER                =
        OUTPUT_OPTIONS             = WA_OUTOPT
    *    USER_SETTINGS              = ' '
        IMPORTING
    *   DOCUMENT_OUTPUT_INFO       =
        JOB_OUTPUT_INFO            = T_OTFDATA
    *   JOB_OUTPUT_OPTIONS         =
    *    document_output_info       = st_document_output_info
    *    job_output_info            = st_job_output_info
    *    job_output_options         = st_job_output_options
        TABLES
          T_FINAL                    = T_FINAL
          T_ZSDT_WAGONS              = T_ZSDT_WAGONS_1
          T_QTY                      = T_QTY
          T_QTY1                     = T_QTY1
          T_CON1                     = T_CON1
          T_CON2                     = T_CON2
          "T_ZTMM_OUTWB_TXN           = T_ZTMM_OUTWB_TXN
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    T_OTF[] = T_OTFDATA-OTFDATA[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
              format = 'ASCII'
              max_linewidth = 132
    * ARCHIVE_INDEX = ' '
    IMPORTING
              bin_filesize = w_bin_filesize
    TABLES
              otf   = t_otf
              lines = t_pdf_tab
    EXCEPTIONS
              err_max_linewidth = 1
              err_format = 2
           err_conv_not_possible = 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 tabix_m = 1.
    *CALL METHOD cl_gui_frontend_services=>file_save_dialog
    *CHANGING
    *filename = w_FILE_NAME
    *path     = w_FILE_PATH
    *fullpath = w_FULL_PATH
    ** USER_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.
    CALL function 'TMP_GUI_BROWSE_FOR_FOLDER'
    EXPORTING
    WINDOW_TITLE = 'Select A File Folder'
    INITIAL_FOLDER = 'C:\'
    IMPORTING
    SELECTED_FOLDER = W_PATH.
    endif.
    CONDENSE W_PATH.
    concatenate W_PATH '\' wa_final-vbeln '.XLS' into w_FULL_PATH.
    ****************************************************************************Saving the PDF file on to Application server************************
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
       BIN_FILESIZE                     = w_bin_filesize
       FILENAME                         = w_FULL_PATH
       FILETYPE                         = 'BIN'
    *   APPEND                          = ' '
    *   WRITE_FIELD_SEPARATOR           = ' '
    *   HEADER                          = '00'
    *   TRUNC_TRAILING_BLANKS           = ' '
    *   WRITE_LF                        = 'X'
    *   COL_SELECT                      = ' '
    *   COL_SELECT_MASK                 = ' '
    *   DAT_MODE                        = ' '
    *   CONFIRM_OVERWRITE               = ' '
    *   NO_AUTH_CHECK                   = ' '
    *   CODEPAGE                        = ' '
    *   IGNORE_CERR                     = ABAP_TRUE
    *   REPLACEMENT                     = '#'
    *   WRITE_BOM                       = ' '
    *   TRUNC_TRAILING_BLANKS_EOL       = 'X'
    *   WK1_N_FORMAT                    = ' '
    *   WK1_N_SIZE                      = ' '
    *   WK1_T_FORMAT                    = ' '
    *   WK1_T_SIZE                      = ' '
    IMPORTING
       FILELENGTH                      = w_filesize
      TABLES
        DATA_TAB                        = t_pdf_tab
    *   FIELDNAMES                      =
    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
    As u said ,u want to download a smartform to Excel it could be done but only if u r using a internal table and exactly printing line by line values in the smartform, But if u are performing calculation in between, using multiple internal table Work areas, structures, etc i.e if whole smartform is developed with many distributed windows , unfortunately it wont be possible to download a smartform to excel in such cases, because the whole output comes from multiple internal tables, calculations, etc all the data is not printed in a tabular manner so in such a case it would be just impossible to download the smartform  to excel.
    But we definitely have a workaround which could be done to download the data into excel.
    you can develop a ALV report with a header and footer u can define the header and footer of the alv according to the smartform and the middle portion would contain the tabular kind of data which u must be using as Smartform table to print the same.
    So if u have a similar kind of smartform with some header data, tabular data, and some footer data, then u can use ALV to do the same thing , advantage with ALV would be that u can easily download the same into excel.
    Other alternative is that u can Convert and download the smartform to PDF  and copy the same to an Excel wooksheet.
    These are all the possibilities with which u can do the same.
    Regards,
    Akash Rana

  • How to download the output of two reports in WebTemplate into excel sheet?

    How to download the output of webtemplate which consists of two reports in one  Web Template into same Excel sheet?

    hi sunil,
    here is the HTML code for 'export to excel'
    <!-- Display Export Excel--->
    <td class="SAPBEXNavLine"> <SAP_BW_TEXT program="SAPLRRSV" key="T72">" src="Mime/BEx/Icons/S_X_XLS.gif" border=0 ></td>
    you can also use BEx download scheduler to download the precalculated webtemplate report to excel sheet.
    Check the link below.
    https://websmp104.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=011000358700000401962004E
    i think this will help u
    regards,
    sindhu.

  • How to download the values to excel from spool sap abap

    Dear All,
    I am facing  a problem in downloading the Zreport to excel file ( where it consists of 95 fields) ,
    1.if am running the report in foreground and downlaod to excel file , the all 95 fields are upadting in excel file .
    2.if i am schecduling the programe in background and saving inspool, then form spool , i am download to excel file , at that time some of the fields are overllapning ,
    for this i want to download t o excel file without overlapping fields,
    can any one suggest , how to do same procedue.
    regards,
    manoranjan

    Hi,
    whenever you click on Excel download option select spreadsheet instead of unconverted
    There is a possibility of download the spool file as txt-file. .
    Use Tranx SP01 - select the spool entry -->"spool request --> forward as text . You will find the file in your SAP work directory as <sid><spool#>.
    or use fm RSPO_DOWNLOAD_SPOOLJOB.
      Download in Background in Excel Format
    How to download the data in excel format directly while executing in background mode? 
    If you will execute it in bacground with ws_download or download, it will be aoutomatically cancel. so what is the procedure to do this.  How is can directly read the spool from program?
    Download from background is possible, if you could setup the environment
    1. create a custom table first
        Table  : Y001
        Displayed fields:   4 of   4  Fixed columns:
           MANDT BNAME       Y_SITE    Y_PATH
           010      <userid>     <site>      cd <novell_path>
    2. rewrite ws_download to z_download (light modification required, see attachment)
    3. ask your basis team to make a copy of command FTP and CHMOD to ZFTP and ZCHMOD resp., make the setting according to your environment.
    Moderator message - Please respect the 5,000 character maximum when posting. Post only the relevant portions of code
    Hope this will will helps you,
    Thanks and Regards,
    Manjunath M
    Edited by: manjunath4sap on Dec 23, 2010 6:20 PM
    Edited by: Rob Burbank on Dec 23, 2010 9:02 PM

  • How to Download ALV Output LOGO to Excel ?

    Hi
    I have Used the LOGO in ALV Output. Iam getting the LOGO through REUSE_ALV_GRID_DISPLAY. If i download the Data to Excel file, the LOGO is not coming. How to solve this problem.
    Thanks & Regards,
    N.L.

    Hi,
    I had a sample code wich will insert LOGO from PRESENTATION server into excel / word.
    TYPE-POOLS ole2.
    DATA:
    o_word           TYPE ole2_object,
      excel           TYPE ole2_object,
      o_documents     TYPE ole2_object,
      o_actdoc        TYPE ole2_object,
      o_inlineshapes  TYPE ole2_object,
      o_logo          TYPE ole2_object,
      WORKBOOK        TYPE ole2_object.
    *CREATE OBJECT o_word 'Word.Application'.
    CREATE OBJECT EXCEL 'Excel.Application'.
    *FREE OBJECT EXCEL.
    *SET PROPERTY OF o_word 'Visible' = '1'.
    SET PROPERTY OF excel 'Visible' = '1'.
    *GET PROPERTY OF o_word 'Documents' = o_documents.
    GET PROPERTY OF excel 'Documents' = o_documents.
    CALL METHOD OF o_documents 'Add'   = o_actdoc.
    CALL METHOD OF EXCEL 'WORKBOOKS' = WORKBOOK.
    GET PROPERTY OF o_actdoc 'InlineShapes' = o_inlineshapes.
    CALL METHOD OF o_inlineshapes 'AddPicture' = o_logo
      EXPORTING
      #1 = 'C:\Temp\OTHERS\Scrap\COMPANY_LOGO.BMP'
      #2 = 0
      #3 = 1.
    WRITE: / 'Test'.
    Let us see if some one will come out with good idea/Example.
    Thanks.

  • How to run the report and show the output in excel file

    salam
    how to run the report and show the output in excel file,
    how to run the report and print the o/p via printer
    how to run the report and send the o/p via mail
    thank u all

    Hi,
    There are Parameters DESTTYPE, DESFORMAT and DESNAME. You can set these parameters to get as you want.
    1) Output in Excel File
         ADD_PARAMETER(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'FILE');
         ADD_PARAMETER(PL_ID, 'DESFORMAT', TEXT_PARAMETER, 'DELIMITED');
         ADD_PARAMETER(PL_ID, 'DESNAME', TEXT_PARAMETER, '<file_name>.XLS');2) output to printer
         ADD_PARAMETER(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'PRINTER');
         ADD_PARAMETER(PL_ID, 'DESNAME', TEXT_PARAMETER, '<printer_name>');3) Email - Have to configure SMTP and all. ( i didn't checked it)
         ADD_PARAMETER(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'MAIL');
         ADD_PARAMETER(PL_ID, 'DESNAME', TEXT_PARAMETER, '<email_id>');Regards,
    Manu.
    If this answer is helpful or correct, please mark it. Thanks.

  • Download the output into Excel...(List- export- spreadsheet)

    Dear friends,
    I want to download the output into Excel...
    I am using all SAP standards and using the ALV Block list
    Ex: List->export->local file.. is anable from here i can download to excell .....but the same there is anothere option : List->export->spreadsheet...( this one inactive.)
    I want to activate the List->export->spreadsheet option.
    how to do this???
    Thanks,
    Sridhar.

    Hi
       Use the Function Module:
    EXCEL_OLE_STANDARD_DAT
    For your purpose.
    But by default you can get the option to download into several formats including your desired one.
    Regards,
    Sreeram

  • How to save Android contacts as Excel file on Mac computer?

    I want to manage and edit my contacts on my cell phone, my friend suggested me save them as Excel format! So now i am trying this way, but i can't find the right method to do this! Do you know how to save Android contacts as Excel file on Mac computer?

    If you want to save Android Phone contacts to Excel format, you can have a try the following method:
    Step 1. Connect Your Android Phone to Computer
    After downloading and installing the Coolmuster Android Assistant software on your computer, launch it and you will get the program interface prompts you to connect your phone to the computer. Just use a USB cable to connect your phone to the computer and the program will detect the connected phone automatically. If it is the first time to run this software, you may encounter the following picture and be required to enable USB debugging on your phone at first. If your device can be detected by the program, you can directly skip to the next step.
    Step 2: Go to the Contacts windows
    All your phone data are categorized on the top menu. To transfer Android phone's contacts, you can go to click the "Contacts" icon to enter the Contacts window. Navigate to the left panel and click on the "All Contacts" option, then, all the contacts in your phone will show in list on the right window. Mark the contacts you want to backup on your computer and click the button of "Backup".
    Step 3. Start to export contacts to computer at once
    Once you click on the "Backup" button, there will be a "Path" dialog appears, asking you to choose an output location where you want to save the exported contacts. Specify an output folder and then click the "Ok" button. Then, all your phone contacts will be exported to the output location immediately, with all the email address, company's name, home address, and more contacts info perfectly kept in the output CSV or XLS file.

Maybe you are looking for

  • Class not found in webapp

              All the struts classes and lib are in the webapp. All ejbs are in another package.           All war and jar are then package into one ear file. I have 2 similar struts actions           inheriting from the same base class ListBaseAction. S

  • Tax code is not picked up while doing ERS with T. Code. MRRL

    Hi Experts,       I have got one Scheduling Agreement of certain material and based on goods receipt quantity user is performing ERS with T. Code MRRL. but when we are seeing different invoice documents generated by ERS with T. Code MIR4 for the same

  • How do I change what a new tab opens up to?

    When I open a new tab it opens to AVG search. I would like to change that. How do I do that?

  • Itunes ringtones and text tones not working??

    I downloaded a ring tone and a text tone, from the itunes store,and it was working great for about three weeks.  I lost charge on my phone yesterday and soon as I powered back up the default ringtones have seemed to take over even though my tones are

  • Vist home ultimate + audigy 2 ZS platinum

    Hello All ,my audigy keeps disapearing. I start my pc and it is no longer in device manager:System:ABIT AN8 SLI FatalityVista Home Ultimate2 gig? Crucial Ballistix?I am/was running the Audigy as my system sound and the motherboards ?realtek AC 97 for