Function module to download into excel sheet in crm

Hi,
        Needed the Function module to download the data from internal table into the excel sheet in the CRM
<b></b>

use
FM :- GUI_DOWNLOAD
Example Code.
lv_file_name = 'c:abcd.xls'
*----Load Detail Report Data to Excel File
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = lv_file_name
        filetype                = 'DAT'
        write_field_separator   = 'X'
        codepage                = '4103'
      TABLES
        data_tab                = lt_det_report
      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.
  ENDIF.
  IF sy-subrc <> 0.
*   202 : Error Occurred while writing data to the file.
    MESSAGE e202(zusm_gen) .
    EXIT.
  ELSE.
    WRITE :/ text-042 , lv_file_name.
  ENDIF.
:- lt_det_report---> is table for storing data .
                     it can be any type
<b>Please Reward Points & Mark Helpful Answers</b>
To mark Helpful Answers ;click radio Button next to the post.
RadioButtons
<b>o</b> Helpful Answer
<b>o</b> Very helpful Answer
<b>o</b> Problem Solved.
Click any of the above button next to the post; as per the anwers
<b>To close the thread; Click Probelm solved Radio Button next to the post , which u feel is best possible answers</b>

Similar Messages

  • Function module to download to excel sheet

    what is the function module to download the report into excel  sheet??..
    Thanks
    Sri

    hi,
    use the alv list or alv grid  for the report output  then that functionality will be provided by default....
    In general Gui_download is used and the final internal table which is used for displaying the output of the report is passed to the FM.
    Regards,
    Rohan.

  • Function module to download to Excel worksheet.

    Hi All,
            Need a function module to download internal table data to exact worksheet number in the excel sheet, that too it sholud be appended from some row number.
    The regular function modules are helping just to create an excel sheet and fill data, But not to append to exact work sheet, like work sheet no.5 or 6 of excel on presentation.
    Thanks in Advance,
    Regards,
    Yogesh

    Download a report to excel with format (border, color cell, etc) 
    Try this program...it may help you to change the font ..etc.
    Code:
    REPORT ZSIRI NO STANDARD PAGE HEADING.
    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

  • Download into excel sheet

    Hi All,
    In a ALV report, i would like to donwload the final internal table into an excel sheet.
    The requirement is that the data should be filled from 8th row of excel sheet.
    I am using GUI_DOWNLOAD and it makes the data to dump from first line of excel sheet itself.
    How to incorprate the logic for these requirements?
    Your help will be sincerely appreciated.
    Thanks in Advance,
    Pavan
    Edited by: Pavan Sanganal on Dec 16, 2008 10:51 AM

    Hello Pavan,
    I think you have written a separate sub-routine for this. Use another internal table IT_XLS which has a similar structure as the int. table for ALV display (IT_ALV, say).
    Now try this piece of code:
    DO 8 TIMES.
      APPEND WA_XLS TO IT_XLS. "Populate 8 blank rows in the table
    ENDDO.
    LOOP AT IT_ALV INTO WA_ALV.
      WA_XLS = WA_ALV.
      APPEND WA_XLS TO IT_XLS.
      CLEAR WA_XLS.
    ENDLOOP.
    Use GUI_DOWNLOAD to download IT_XLS. Can you please tell what do you want to populate in these 8 blank rows?
    BR,
    Suhas

  • Oracle function to extract data into excel sheet

    I have extracted data from a couple of tables onto a view. Basically I have got about 15 coloums in that view but i need to extract the data in the view into an Excel sheet.
    I just want to know if their is a function in oracle whereby i can export the data in the view onto an excel sheet, because this statements is going to be scripted and run every morning for the data to be processed.
    Oracle version: oracle 9i
    OS : Windows 2003

    There are at least three options.
    One is to use UTL_FILE or spool to write the results out as a comma separated file. Excel can then read the .CSV without a hitch. Only use spool you want to overwrite the file (on create a new one) each day.
    The second approach would still use UTL_FILE but use Tom Kyte's OWA_SYLK utility to write an Excel-readable file.
    The third approach would be to reverse the direction. Define your database as a DNS datasource and embed your query in the Excel spreadsheet. This obviates the need for the user to pfaff around with CSV files but does require a bit more work on the OS side.
    Which approach you choose rather depends upon your precise needs.
    Cheers, APC

  • Oracle function to extract data into excel sheet within a script

    I have extracted data from a couple of tables onto a view. Basically I have got about 15 coloums in that view but i need to extract the data in the view into an Excel sheet.
    I just want to know if their is a function in oracle whereby i can export the data in the view onto an excel sheet, because this statements is going to be scripted and run every morning for the data to be processed.
    Oracle version: oracle 9i
    OS : Windows 2003

    If this is a one-off then IDEs such as TOAD typically
    let you export the results of a query in an
    appropriate format for Excel.Note:
    because this statements is going to be scripted and run
    every morning for the data to be processedSo that won't be feasible in this case, but it was a good point to make.

  • Wht are the function modules for download upload excel files in bdc.

    hi all,
    this question seems to be silly but i had open office excel files i am getting problems to upload or down loading.  can you tell which function modules can upload or down load open office excel files.
    another dought this is not need full but i need to get some of graphics which are in se78  .
    how can we dowload them from sap.
    thanq,
    rajesh.k

    Hi,
      use  :   CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
       REPORT  YKC_XL_UPLOAD.
    TYPE-POOLS TRUXS.
    TABLES : ZMARA.
    * Selection screen
    PARAMETER P_FILE TYPE RLGRAP-FILENAME DEFAULT
    'C:\Kris\TEST_UPLOAD.xls'.
    TYPES:  BEGIN OF T_TAB,
            MATNR   LIKE ZMARA-MATNR,
            ERSDA  LIKE ZMARA-ERSDA,
            ERNAM  LIKE ZMARA-ERNAM,
            END OF T_TAB.
    DATA :  T_UPLOAD  TYPE STANDARD TABLE OF T_TAB WITH HEADER LINE ,
            WA_UPLOAD TYPE T_TAB,
            IT_RAW TYPE TRUXS_T_TEXT_DATA.  "work table internal table
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SYST-CPROG
          DYNPRO_NUMBER = SYST-DYNNR
          FIELD_NAME    = 'P_FILE '
        IMPORTING
          FILE_NAME     = P_FILE.
    START-OF-SELECTION.
    * Uploading the data in the file into internal table
      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
      EXPORTING
    *   I_FIELD_SEPERATOR =
    *   I_LINE_HEADER  = 'X'
        I_TAB_RAW_DATA = IT_RAW
        I_FILENAME     = P_FILE
      TABLES
        I_TAB_CONVERTED_DATA = T_UPLOAD[]
      EXCEPTIONS
        CONVERSION_FAILED = 1
        OTHERS            = 2.
      IF SY-SUBRC NE  0.
        MESSAGE ID SY-MSGID
                TYPE SY-MSGTY
                NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    END-OF-SELECTION.
    * Uploading the data into the database table
      LOOP AT T_UPLOAD INTO T_UPLOAD.
        ZMARA-MATNR = T_UPLOAD-MATNR.
        ZMARA-ERSDA = T_UPLOAD-ERSDA.
        ZMARA-ERNAM = T_UPLOAD-ERNAM.
        INSERT  ZMARA.
    Endloop.
    Tks,
    Krishna

  • Exporting data into excel sheet from CRM

    Hi All,
    I am facing problem while extracting data from CRM - Service Process Monitor.
    I tried to extract data(records) from executed service process monitor through
    System -> List ->Save->Local file->Spreadsheet
    I am not getting actual records list in excel sheet
    For example: Actual record - 244, But after extracting to excel sheet its showing only- 199
    why its not extracting remaining 45 records/ transactions.
    is there any setting or is there any other process of extracting ?
    How to count total records without extracting to excek sheet ?
    Please help me..
    Regards
    Praveen Khot

    Hi
    check the link below
    https://www.sdn.sap.com/irj/sdn/crm-elearning
    Reward points if helpful
    Dinaker vikas

  • Function module to download to Excel ?

    Anybody know the name of a FM to call excel and download a file from SAP ?

    check the below program....
    Try this....
    *& Report ZETA_EXCEL_DOWNLOAD_CLIPBOARD *
    report zeta_excel_download_clipboard .
    include ole2incl.
    data: w_cell1 type ole2_object,
    w_cell2 type ole2_object.
    *--- Ole data Declarations
    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
    gs_interior type ole2_object, " Pattern
    worksheet type ole2_object,
    h_cell type ole2_object,
    h_cell1 type ole2_object,
    range type ole2_object,
    h_sheet2 type ole2_object,
    h_sheet3 type ole2_object,
    gs_font type ole2_object,
    flg_stop(1) type c.
    Internal table Declaration
    data: begin of t_excel occurs 0,
    vkorg(20) type c, "Sales Org
    vbtyp(20) type c, "Document Category
    auart(20) type c, "Document Type
    ernam(20) type c, "Created By
    vbeln(20) type c, "Document Number
    posnr(20) type c, "Item Number
    erdat(20) type c, "Created Date
    vdatu(20) type c, "Header Requested Delivery Date
    reqdat(20) type c, "Request date
    condat(20) type c, "Confirm date
    lifsk(20) type c, "Header Block
    txt30(30) type c, "Order User Status Description
    lifsp(20) type c, "Line Block
    dispo(20) type c, "MRP Controller
    dsnam(20) type c, "MRP Controller Description
    vmsta(20) type c, "Material Sales Status
    kunnr(20) type c, "Sold To
    cname(35) type c, "Sold To Name
    regio(20) type c, "State
    cufd(10) type c, "CUD
    bstnk(20) type c, "PO#
    bsark(20) type c, "Ordering Method
    matnr(20) type c, "Material
    maktx(35) type c, "Material Description
    t200(20) type c, "T200
    vtext(20) type c, "T200 Description
    matkl(20) type c, "Material Group
    zzbomind(7) type c, "BOM Indicator
    ostat(20) type c, "Order Status
    cmgst(20) type c, "CRD
    inco1(20) type c, "Incoterms
    oqty(20) type c, "Order Quantity
    pqty(20) type c, "Open Quantity
    unit(20) type c, "UOM
    onet(20) type c, "Order Value
    pnet(20) type c, "Open Value
    curr(20) type c, "Currency key
    so_bezei like tvkbt-bezei,"Sales Office
    sg_bezei like tvgrt-bezei,"Sales Group
    bname(20) type c, "Ordering Party
    contact(20) type c, "Contact Name
    telf1(20) type c, "Contact telf1
    reqqty(20) type c, "Item Request qty
    reqval(20) type c, "Item Request value
    conqty(20) type c, "Item Confirm qty
    conval(20) type c, "Item Confirm value
    zzrev(02) type c, "Revenue recognition acceptance
    bezei(20) type c, "Revenue recognition text
    vgbel(20) type c, "Reference Order for RETURNS
    0008text(255) type c, "Internal Order Comment Text
    end of t_excel.
    data: t_excel_bckord like t_excel occurs 0 with header line,
    t_excel_bcklog like t_excel occurs 0 with header line,
    t_excel_blkord like t_excel occurs 0 with header line.
    types: data1(1500) type c,
    ty type table of data1.
    data: it type ty with header line,
    it_2 type ty with header line,
    it_3 type ty with header line,
    rec type sy-tfill,
    deli(1) type c,
    l_amt(18) type c.
    data: begin of hex,
    tab type x,
    end of hex.
    field-symbols: <fs> .
    constants cns_09(2) type n value 09.
    assign deli to <fs> type 'X'.
    hex-tab = cns_09.
    <fs> = hex-tab.
    data gv_sheet_name(20) type c .
    M A C R O Declaration
    define ole_check_error.
    if &1 ne 0.
    message e001(zz) with &1.
    exit.
    endif.
    end-of-definition.
    t_excel_bckord-vkorg = 'ABC'.
    t_excel_bckord-vbtyp = 'DEF'.
    t_excel_bckord-auart = 'GHI'.
    t_excel_bckord-ernam = 'JKL'.
    t_excel_bckord-vbeln = 'MNO'.
    t_excel_bckord-0008text = 'XYZ'.
    append t_excel_bckord.
    t_excel_bckord-vkorg = 'ABC1'.
    t_excel_bckord-vbtyp = 'DEF1'.
    t_excel_bckord-auart = 'GHI1'.
    t_excel_bckord-ernam = 'JKL1'.
    t_excel_bckord-vbeln = 'MNO1'.
    t_excel_bckord-0008text = 'XYZ1'.
    append t_excel_bckord.
    t_excel_bckord-vkorg = 'ABC2'.
    t_excel_bckord-vbtyp = 'DEF2'.
    t_excel_bckord-auart = 'GHI2'.
    t_excel_bckord-ernam = 'JKL2'.
    t_excel_bckord-vbeln = 'MNO2'.
    t_excel_bckord-0008text = 'XYZ2'.
    append t_excel_bckord.
    t_excel_bcklog-vkorg = 'ABC'.
    t_excel_bcklog-vbtyp = 'DEF'.
    t_excel_bcklog-auart = 'GHI'.
    t_excel_bcklog-ernam = 'JKL'.
    t_excel_bcklog-vbeln = 'MNO'.
    t_excel_bcklog-0008text = 'XYZ'.
    append t_excel_bcklog.
    t_excel_bcklog-vkorg = 'ABC1'.
    t_excel_bcklog-vbtyp = 'DEF1'.
    t_excel_bcklog-auart = 'GHI1'.
    t_excel_bcklog-ernam = 'JKL1'.
    t_excel_bcklog-vbeln = 'MNO1'.
    t_excel_bcklog-0008text = 'XYZ1'.
    append t_excel_bcklog.
    t_excel_bcklog-vkorg = 'ABC2'.
    t_excel_bcklog-vbtyp = 'DEF2'.
    t_excel_bcklog-auart = 'GHI2'.
    t_excel_bcklog-ernam = 'JKL2'.
    t_excel_bcklog-vbeln = 'MNO2'.
    t_excel_bcklog-0008text = 'XYZ2'.
    append t_excel_bcklog.
    t_excel_bcklog-vkorg = 'ABC3'.
    t_excel_bcklog-vbtyp = 'DEF3'..
    t_excel_bcklog-auart = 'GHI3'.
    t_excel_bcklog-ernam = 'JKL3'.
    t_excel_bcklog-vbeln = 'MNO3'.
    t_excel_bcklog-0008text = 'XYZ3'.
    append t_excel_bcklog.
    t_excel_blkord-vkorg = 'ABC'.
    t_excel_blkord-vbtyp = 'DEF'.
    t_excel_blkord-auart = 'GHI'.
    t_excel_blkord-ernam = 'JKL'.
    t_excel_blkord-vbeln = 'MNO'.
    t_excel_blkord-0008text = 'XYZ'.
    append t_excel_blkord.
    t_excel_blkord-vkorg = 'ABC1'.
    t_excel_blkord-vbtyp = 'DEF1'.
    t_excel_blkord-auart = 'GHI1'.
    t_excel_blkord-ernam = 'JKL1'.
    t_excel_blkord-vbeln = 'MNO1'.
    t_excel_blkord-0008text = 'XYZ1'.
    append t_excel_blkord.
    t_excel_blkord-vkorg = 'ABC2'.
    t_excel_blkord-vbtyp = 'DEF2'.
    t_excel_blkord-auart = 'GHI2'.
    t_excel_blkord-ernam = 'JKL2'.
    t_excel_blkord-vbeln = 'MNO2'.
    t_excel_blkord-0008text = 'XYZ2'.
    append t_excel_blkord.
    t_excel_blkord-vkorg = 'ABC3'.
    t_excel_blkord-vbtyp = 'DEF3'..
    t_excel_blkord-auart = 'GHI3'.
    t_excel_blkord-ernam = 'JKL3'.
    t_excel_blkord-vbeln = 'MNO3'.
    t_excel_blkord-0008text = 'XYZ3'.
    append t_excel_blkord.
    t_excel_blkord-vkorg = 'ABC4'.
    t_excel_blkord-vbtyp = 'DEF4'..
    t_excel_blkord-auart = 'GHI4'.
    t_excel_blkord-ernam = 'JKL4'.
    t_excel_blkord-vbeln = 'MNO4'.
    t_excel_blkord-0008text = 'XYZ4'.
    append t_excel_blkord.
    loop at t_excel_bckord.
    concatenate
    t_excel_bckord-vkorg
    t_excel_bckord-vbtyp
    t_excel_bckord-auart
    t_excel_bckord-ernam
    t_excel_bckord-vbeln
    t_excel_bckord-posnr
    t_excel_bckord-erdat
    t_excel_bckord-vdatu
    t_excel_bckord-reqdat
    t_excel_bckord-condat
    t_excel_bckord-lifsk
    t_excel_bckord-txt30
    t_excel_bckord-lifsp
    t_excel_bckord-dispo
    t_excel_bckord-dsnam
    t_excel_bckord-vmsta
    t_excel_bckord-kunnr
    t_excel_bckord-cname
    t_excel_bckord-regio
    t_excel_bckord-cufd
    t_excel_bckord-bstnk
    t_excel_bckord-bsark
    t_excel_bckord-matnr
    t_excel_bckord-maktx
    t_excel_bckord-t200
    t_excel_bckord-vtext
    t_excel_bckord-matkl
    t_excel_bckord-zzbomind
    t_excel_bckord-ostat
    t_excel_bckord-cmgst
    t_excel_bckord-inco1
    t_excel_bckord-oqty
    t_excel_bckord-pqty
    t_excel_bckord-unit
    t_excel_bckord-onet
    t_excel_bckord-pnet
    t_excel_bckord-curr
    t_excel_bckord-so_bezei
    t_excel_bckord-sg_bezei
    t_excel_bckord-bname
    t_excel_bckord-contact
    t_excel_bckord-telf1
    t_excel_bckord-reqqty
    t_excel_bckord-reqval
    t_excel_bckord-conqty
    t_excel_bckord-conval
    t_excel_bckord-zzrev
    t_excel_bckord-bezei
    t_excel_bckord-vgbel
    t_excel_bckord-0008text
    into it
    separated by deli.
    append it.
    clear it.
    endloop.
    loop at t_excel_bcklog.
    concatenate
    t_excel_bcklog-vkorg
    t_excel_bcklog-vbtyp
    t_excel_bcklog-auart
    t_excel_bcklog-ernam
    t_excel_bcklog-vbeln
    t_excel_bcklog-posnr
    t_excel_bcklog-erdat
    t_excel_bcklog-vdatu
    t_excel_bcklog-reqdat
    t_excel_bcklog-condat
    t_excel_bcklog-lifsk
    t_excel_bcklog-txt30
    t_excel_bcklog-lifsp
    t_excel_bcklog-dispo
    t_excel_bcklog-dsnam
    t_excel_bcklog-vmsta
    t_excel_bcklog-kunnr
    t_excel_bcklog-cname
    t_excel_bcklog-regio
    t_excel_bcklog-cufd
    t_excel_bcklog-bstnk
    t_excel_bcklog-bsark
    t_excel_bcklog-matnr
    t_excel_bcklog-maktx
    t_excel_bcklog-t200
    t_excel_bcklog-vtext
    t_excel_bcklog-matkl
    t_excel_bcklog-zzbomind
    t_excel_bcklog-ostat
    t_excel_bcklog-cmgst
    t_excel_bcklog-inco1
    t_excel_bcklog-oqty
    t_excel_bcklog-pqty
    t_excel_bcklog-unit
    t_excel_bcklog-onet
    t_excel_bcklog-pnet
    t_excel_bcklog-curr
    t_excel_bcklog-so_bezei
    t_excel_bcklog-sg_bezei
    t_excel_bcklog-bname
    t_excel_bcklog-contact
    t_excel_bcklog-telf1
    t_excel_bcklog-reqqty
    t_excel_bcklog-reqval
    t_excel_bcklog-conqty
    t_excel_bcklog-conval
    t_excel_bcklog-zzrev
    t_excel_bcklog-bezei
    t_excel_bcklog-vgbel
    t_excel_bcklog-0008text
    into it_2
    separated by deli.
    append it_2.
    clear it_2.
    endloop.
    loop at t_excel_blkord.
    concatenate
    t_excel_blkord-vkorg
    t_excel_blkord-vbtyp
    t_excel_blkord-auart
    t_excel_blkord-ernam
    t_excel_blkord-vbeln
    t_excel_blkord-posnr
    t_excel_blkord-erdat
    t_excel_blkord-vdatu
    t_excel_blkord-reqdat
    t_excel_blkord-condat
    t_excel_blkord-lifsk
    t_excel_blkord-txt30
    t_excel_blkord-lifsp
    t_excel_blkord-dispo
    t_excel_blkord-dsnam
    t_excel_blkord-vmsta
    t_excel_blkord-kunnr
    t_excel_blkord-cname
    t_excel_blkord-regio
    t_excel_blkord-cufd
    t_excel_blkord-bstnk
    t_excel_blkord-bsark
    t_excel_blkord-matnr
    t_excel_blkord-maktx
    t_excel_blkord-t200
    t_excel_blkord-vtext
    t_excel_blkord-matkl
    t_excel_blkord-zzbomind
    t_excel_blkord-ostat
    t_excel_blkord-cmgst
    t_excel_blkord-inco1
    t_excel_blkord-oqty
    t_excel_blkord-pqty
    t_excel_blkord-unit
    t_excel_blkord-onet
    t_excel_blkord-pnet
    t_excel_blkord-curr
    t_excel_blkord-so_bezei
    t_excel_blkord-sg_bezei
    t_excel_blkord-bname
    t_excel_blkord-contact
    t_excel_blkord-telf1
    t_excel_blkord-reqqty
    t_excel_blkord-reqval
    t_excel_blkord-conqty
    t_excel_blkord-conval
    t_excel_blkord-zzrev
    t_excel_blkord-bezei
    t_excel_blkord-vgbel
    t_excel_blkord-0008text
    into it_3
    separated by deli.
    append it_3.
    clear it_3.
    endloop.
    if h_excel-header = space or h_excel-handle = -1.
    start Excel
    create object h_excel 'EXCEL.APPLICATION'.
    endif.
    PERFORM err_hdl.
    *--- get list of workbooks, initially empty
    call method of h_excel 'Workbooks' = h_mapl.
    PERFORM err_hdl.
    set property of h_excel 'Visible' = 1.
    add a new workbook
    call method of h_mapl 'Add' = h_map.
    PERFORM err_hdl.
    *GV_SHEET_NAME = '1st SHEET'.
    gv_sheet_name = 'Back Orders'.
    get property of h_excel 'ACTIVESHEET' = worksheet.
    set property of worksheet 'Name' = gv_sheet_name .
    *--Formatting the area of additional data 1 and doing the BOLD
    call method of h_excel 'Cells' = w_cell1
    exporting
    #1 = 1
    #2 = 1.
    call method of h_excel 'Cells' = w_cell2
    exporting
    #1 = 1
    #2 = 50.
    call method of h_excel 'Range' = h_cell
    exporting
    #1 = w_cell1
    #2 = w_cell2.
    *CALL METHOD OF gs_cells 'Select' .
    get property of h_cell 'Font' = gs_font .
    set property of gs_font 'Bold' = 1 .
    data l_rc type i.
    call method cl_gui_frontend_services=>clipboard_export
    importing
    data = it[]
    changing
    rc = l_rc
    exceptions
    cntl_error = 1
    error_no_gui = 2
    not_supported_by_gui = 3
    others = 4.
    call method of h_excel 'Cells' = w_cell1
    exporting
    #1 = 1
    #2 = 1.
    call method of h_excel 'Cells' = w_cell2
    exporting
    #1 = 1
    #2 = 1.
    PERFORM err_hdl.
    call method of h_excel 'Range' = range
    exporting
    #1 = w_cell1
    #2 = w_cell2.
    call method of range 'Select'.
    PERFORM err_hdl.
    call method of worksheet 'Paste'.
    PERFORM err_hdl.
    CALL METHOD OF h_excel 'QUIT'.
    *GV_SHEET_NAME = '2ND SHEET'.
    gv_sheet_name = 'Backlog'.
    get property of h_excel 'Sheets' = h_sheet2 .
    call method of h_sheet2 'Add' = h_map.
    set property of h_map 'Name' = gv_sheet_name .
    get property of h_excel 'ACTIVESHEET' = worksheet.
    *--Formatting the area of additional data 1 and doing the BOLD
    call method of h_excel 'Cells' = w_cell1
    exporting
    #1 = 1
    #2 = 1.
    call method of h_excel 'Cells' = w_cell2
    exporting
    #1 = 1
    #2 = 50.
    call method of h_excel 'Range' = h_cell
    exporting
    #1 = w_cell1
    #2 = w_cell2.
    get property of h_cell 'Font' = gs_font .
    set property of gs_font 'Bold' = 1 .
    call method cl_gui_frontend_services=>clipboard_export
    importing
    data = it_2[]
    changing
    rc = l_rc
    exceptions
    cntl_error = 1
    error_no_gui = 2
    not_supported_by_gui = 3
    others = 4.
    call method of h_excel 'Cells' = w_cell1
    exporting
    #1 = 1
    #2 = 1.
    call method of h_excel 'Cells' = w_cell2
    exporting
    #1 = 1
    #2 = 1.
    PERFORM err_hdl.
    call method of h_excel 'Range' = range
    exporting
    #1 = w_cell1
    #2 = w_cell2.
    call method of range 'Select'.
    PERFORM err_hdl.
    call method of worksheet 'Paste'.
    *GV_SHEET_NAME = '3rd SHEET'.
    gv_sheet_name = 'Blocked Orders'.
    get property of h_excel 'Sheets' = h_sheet3 .
    call method of h_sheet3 'Add' = h_map.
    set property of h_map 'Name' = gv_sheet_name .
    get property of h_excel 'ACTIVESHEET' = worksheet.
    *--Formatting the area of additional data 1 and doing the BOLD
    call method of h_excel 'Cells' = w_cell1
    exporting
    #1 = 1
    #2 = 1.
    call method of h_excel 'Cells' = w_cell2
    exporting
    #1 = 1
    #2 = 50.
    call method of h_excel 'Range' = h_cell
    exporting
    #1 = w_cell1
    #2 = w_cell2.
    get property of h_cell 'Font' = gs_font .
    set property of gs_font 'Bold' = 1 .
    call method cl_gui_frontend_services=>clipboard_export
    importing
    data = it_3[]
    changing
    rc = l_rc
    exceptions
    cntl_error = 1
    error_no_gui = 2
    not_supported_by_gui = 3
    others = 4.
    call method of h_excel 'Cells' = w_cell1
    exporting
    #1 = 1
    #2 = 1.
    call method of h_excel 'Cells' = w_cell2
    exporting
    #1 = 1
    #2 = 1.
    PERFORM err_hdl.
    call method of h_excel 'Range' = range
    exporting
    #1 = w_cell1
    #2 = w_cell2.
    call method of range 'Select'.
    PERFORM err_hdl.
    call method of worksheet 'Paste'.
    *--- disconnect from Excel
    free object h_zl.
    free object h_mapl.
    free object h_map.
    free object h_excel.

  • Reg: Download alv grid data with top of page into excel sheet

    Hi All,
    I have a selection screen with radio button for download .
    If that radio button was selected then the data will download into excel sheet (like if we execute normal ALV grid display from there we can download top-of-page and body as it is).
    AOO : 2009P               
    Fiscal year : 2009               
    Posting period : 00               
    Local Currency : USD               
    CO Area Currency :               
    Accounting standard:               
    Sector : 23               
    BB code     Period Value LC     Periodic Quantity
    AHDKGKAJ   200                         0

    Did not get your question

  • Problem in downloading to excel sheet

    hi,
    i have a file in the application server which needs to be downloaded into excel sheet and send it via attachment to outlook id's..
    file is getting downloaded into excel sheet ( Via custom function module) and the attachment is being sent to the mail box, but the problem is everything appears in the first column..how to set the delimiters in excel sheet, i mean each field should appear in a separate coloumn...
    format of the file in the application server
    data: begin of dt_string occurs 0,
          data(150) type c,
          end of dt_string.
    ex: dt_string+0(4) = 'name'.
        dt_string+4(5) =  'place'. .....
        append dt_string
         clear dt_string. 
    same way, each record is inserted into the dt_string and the table was transferred to the app server.
    thanks

    Hi Mahesh,
    Assuming that you are using 'GUI_DOWNLOAD'.
    Add the thing in bold <b>WRITE_FIELD_SEPARATOR</b>.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                    =
        filename                        =
    *   FILETYPE                        = 'ASC'
    *   APPEND                          = ' '
    <b>   WRITE_FIELD_SEPARATOR           = '#'    "Tab Delimiter between fields</b>
    Regards,
    AS

  • Function module to download data into excel file

    Hi Friends,
    Please tell me the function module name which popsup a popup box to specify a filename and the location and when clicking on the OK button, the file should be downloaded to the specified location.
    I need it ASAP.
    Thanks,
    Jaffer Ali.S

    Hi Shamshudeen,
    You have to use two funtion modules to acheive this.
    1. To get the file path from user.
    2. To download the excel sheet in prescribed path.
    For 1 use following code
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fpath .
        CALL FUNCTION 'F4_FILENAME'
         EXPORTING
           program_name        = syst-cprog
           dynpro_number       = syst-dynnr
      FIELD_NAME          = ' '
         IMPORTING
           file_name           = p_fpath  .
    The file path will be stored in p_fpath.
    Now use GUI_DOWNLOAD function module and pass the file name p_fpath to it along with filetype as .xls
    Hope this helps you.
    Thanks,
    Arun

  • Error in XXL_FULL_API function module for download report to excel

    Hi all,
    I am using XXL_FULL_API function module for download report to excel, In this FM we have to fill a table called sema        = t_gxxlt_s. in this table we have a fields called
    i_sema-col_no  = 19.
      i_sema-col_src = 19.
      i_sema-col_typ = 'STR'.
      i_sema-col_ops = 'DFT'
    here in 'col_typ' if we put STR in excel it will come as a text but i wnat the time field what i have to pass ?
    and for filed 'col_ops' also ??
    Thaks,
    Sridhar

    Hi sridhar joshi,
    Please check this program
    REPORT Excel.
    TABLES:
      sflight.
    * header data................................
    DATA :
      header1 LIKE gxxlt_p-text VALUE 'Suresh',
      header2 LIKE gxxlt_p-text VALUE 'Excel sheet'.
    * Internal table for holding the SFLIGHT data
    DATA BEGIN OF t_sflight OCCURS 0.
            INCLUDE STRUCTURE sflight.
    DATA END   OF t_sflight.
    * Internal table for holding the horizontal key.
    DATA BEGIN OF  t_hkey OCCURS 0.
            INCLUDE STRUCTURE gxxlt_h.
    DATA END   OF t_hkey .
    * Internal table for holding the vertical key.
    DATA BEGIN OF t_vkey OCCURS 0.
            INCLUDE STRUCTURE gxxlt_v.
    DATA END   OF t_vkey .
    * Internal table for holding the online text....
    DATA BEGIN OF t_online OCCURS 0.
            INCLUDE STRUCTURE gxxlt_o.
    DATA END   OF t_online.
    * Internal table to hold print text.............
    DATA BEGIN OF t_print OCCURS 0.
            INCLUDE STRUCTURE gxxlt_p.
    DATA END   OF t_print.
    * Internal table to hold SEMA data..............
    DATA BEGIN OF t_sema OCCURS 0.
            INCLUDE STRUCTURE gxxlt_s.
    DATA END   OF t_sema.
    * Retreiving data from sflight.
    SELECT * FROM sflight
             INTO TABLE t_sflight.
    * Text which will be displayed online is declared here....
    t_online-line_no    = '1'.
    t_online-info_name  = 'Created by'.
    t_online-info_value = 'KODANDARAMI REDDY'.
    APPEND t_online.
    * Text which will be printed out..........................
    t_print-hf     = 'H'.
    t_print-lcr    = 'L'.
    t_print-line_no = '1'.
    t_print-text   = 'This is the header'.
    APPEND t_print.
    t_print-hf     = 'F'.
    t_print-lcr    = 'C'.
    t_print-line_no = '1'.
    t_print-text   = 'This is the footer'.
    APPEND t_print.
    * Defining the vertical key columns.......
    t_vkey-col_no   = '1'.
    t_vkey-col_name = 'MANDT'.
    APPEND t_vkey.
    t_vkey-col_no   = '2'.
    t_vkey-col_name = 'CARRID'.
    APPEND t_vkey.
    t_vkey-col_no   = '3'.
    t_vkey-col_name = 'CONNID'.
    APPEND t_vkey.
    t_vkey-col_no   = '4'.
    t_vkey-col_name = 'FLDATE'.
    APPEND t_vkey.
    * Header text for the data columns................
    t_hkey-row_no = '1'.
    t_hkey-col_no = 1.
    t_hkey-col_name = 'PRICE'.
    APPEND t_hkey.
    t_hkey-col_no = 2.
    t_hkey-col_name = 'CURRENCY'.
    APPEND t_hkey.
    t_hkey-col_no = 3.
    t_hkey-col_name = 'PLANETYPE'.
    APPEND t_hkey.
    t_hkey-col_no = 4.
    t_hkey-col_name = 'SEATSMAX'.
    APPEND t_hkey.
    t_hkey-col_no = 5.
    t_hkey-col_name = 'SEATSOCC'.
    APPEND t_hkey.
    t_hkey-col_no = 6.
    t_hkey-col_name = 'PAYMENTSUM'.
    APPEND t_hkey.
    * populating the SEMA data..........................
    t_sema-col_no  = 1.
    t_sema-col_typ = 'STR'.
    t_sema-col_ops = 'DFT'.
    APPEND t_sema.
    t_sema-col_no = 2.
    APPEND t_sema.
    t_sema-col_no = 3.
    APPEND t_sema.
    t_sema-col_no = 4.
    APPEND t_sema.
    t_sema-col_no = 5.
    APPEND t_sema.
    t_sema-col_no = 6.
    APPEND t_sema.
    t_sema-col_no = 7.
    APPEND t_sema.
    t_sema-col_no = 8.
    APPEND t_sema.
    t_sema-col_no = 9.
    APPEND t_sema.
    t_sema-col_no = 10.
    t_sema-col_typ = 'NUM'.
    t_sema-col_ops = 'ADD'.
    APPEND t_sema.
    CALL FUNCTION 'XXL_FULL_API'
      EXPORTING
    *   DATA_ENDING_AT          = 54
    *   DATA_STARTING_AT        = 5
       filename                = 'TESTFILE'
       header_1                = header1
       header_2                = header2
       no_dialog               = 'X'
       no_start                = ' '
        n_att_cols              = 6
        n_hrz_keys              = 1
        n_vrt_keys              = 4
       sema_type               = 'X'
    *   SO_TITLE                = ' '
      TABLES
        data                    = t_sflight
        hkey                    = t_hkey
        online_text             = t_online
        print_text              = t_print
        sema                    = t_sema
        vkey                    = t_vkey
    EXCEPTIONS
       cancelled_by_user       = 1
       data_too_big            = 2
       dim_mismatch_data       = 3
       dim_mismatch_sema       = 4
       dim_mismatch_vkey       = 5
       error_in_hkey           = 6
       error_in_sema           = 7
       file_open_error         = 8
       file_write_error        = 9
       inv_data_range          = 10
       inv_winsys              = 11
       inv_xxl                 = 12
       OTHERS                  = 13
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    please refer this link
    http://www.thespot4sap.com/Articles/Download_to_excel.asp
    Best regards,
    raam

  • Download the ALV Report output into excel sheet or notepad

    Hi,
    how to downlaod the alv report out into excel sheet or notepad in a proper manner. program contain large number records....
    Thanks in advance!!!!
    Regards,
    kranthi.

    Hi
    Download a report to excel with format (border, color cell, etc) 
    Try this program...it may help you to change the font ..etc.
    Code:
    REPORT ZSIRI NO STANDARD PAGE HEADING.
    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

  • Download Sales Contract data into Excel sheet

    Hi,
    I need to download the Sales Contract Data into excel sheet is there a Function module that i can use?? Else how do i go about it. Kindly help.
    Thanks,
    Riya.

    use the function module FUNCTION 'GUI_DOWNLOAD'
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE =
    filename = 'C:\REPORT.XLS'
    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 = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = IT_PR
    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.
    ENDIF.

Maybe you are looking for

  • Complaint: Animated GIF, Photoshop CS4

    I am a freelance print designer. Needless to say that I have upgraded to the Design Standard Edition of the Creative Suite 4. Still, some customers ask me to do their web banners, too. Fact 1: There is an animation palette in Photoshop CS4 Standard.

  • Web.xml mapping not working

    I have a servlet located at com.conversion.web called leftNavReader.java I'm trying to access this servlet on my localhost with the following URL: http://localhost:8080/Conversion/start but I keep getting this error: HTTP Status 404 - /Conversion/sta

  • Open PO with vendor number

    Hello Expert :    I need to find a  open PO list. I have vendor numbers so from this vendor number how can i get the list of Open PO's link to the available vendors ? what table or logic I can use to get the open PO Note : Please search forum before

  • Phone resets itself to January 1980

    For the past five days or so, my iPhone 5 (os 7.0.4) will arbitrarily reset itself to January 5, 1980; this happens only at home.  The phone could be charging, or not charging.  It's completely arbitrary. Upon a hard shutdown (home key/power off) and

  • How do u edit a pdf document?

    Needing help to edit my resume which was saved as text edit document but converted to pdf!! I cant edit PDF any suggestions?