Reg: ALV output download using excel option

Hi Team,
I  created  a report using ALV Function modules, I want to download in  Excel sheet the  output list. i am trying to download but i am not getting proper values. I am populating around 50 fileds.
is there any settings for these download.
<<removed by moderator>>
Thanks & Regards,
Mahendar patha.

hi mahendra;
use this step-by-step procedure it will help u a lot:
Firstly export  the data to memory using the FM LIST_FROM_MEMORY.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE e000(su) WITH text-001.
ENDIF.
then i converted it into ASCII using LIST_TO_ASCI,
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = t_xlstab
listobject = t_listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE e003(yuksdbfzs).
ENDIF.
This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
cl_abap_char_utilities=>horizontal_tab.
Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
This will create an excel attachment.
Sample code for formatting the data for the attachment in excel format.
u2022     Format the data for excel file download
LOOP AT t_xlstab INTO wa_xlstab .
DESCRIBE TABLE t_xlstab LINES lw_cnt.
CLEAR lw_sytabix.
lw_sytabix = sy-tabix.
u2022     If not new line then replace '|' by tabs
IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
WITH cl_abap_char_utilities=>horizontal_tab.
MODIFY t_xlstab FROM wa_xlstab .
CLEAR wa_xlstab.
wa_xlstab = cl_abap_char_utilities=>newline.
IF lw_cnt NE 0 .
lw_sytabix = lw_sytabix + 1.
u2022     Insert new line for the excel data
INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
lw_cnt = lw_cnt - 1.
ENDIF.
CLEAR wa_xlstab.
ENDIF.
ENDLOOP.
Sample code for creating attachment and sending mail:
FORM send_mail .
u2022     Define the attachment format
lw_doc_type = 'XLS'.
u2022     Create the document which is to be sent
lwa_doc_chng-obj_name = 'List'.
lwa_doc_chng-obj_descr = w_subject. "Subject
lwa_doc_chng-obj_langu = sy-langu.
u2022     Fill the document data and get size of message
LOOP AT t_message.
lt_objtxt = t_message-line.
APPEND lt_objtxt.
ENDLOOP.
DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
IF lw_tab_lines GT 0.
READ TABLE lt_objtxt INDEX lw_tab_lines.
lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
lwa_doc_chng-obj_langu = sy-langu.
lwa_doc_chng-sensitivty = 'F'.
ELSE.
lwa_doc_chng-doc_size = 0.
ENDIF.
u2022     Fill Packing List For the body of e-mail
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = 'RAW'.
APPEND lt_packing_list.
u2022     Create the attachment (the list itself)
DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
u2022     Fill the fields of the packing_list for creating the attachment:
lt_packing_list-transf_bin = 'X'.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = lw_doc_type.
lt_packing_list-obj_name = 'Attach'.
lt_packing_list-obj_descr = w_docdesc.
lt_packing_list-doc_size = lw_tab_lines * 255.
APPEND lt_packing_list.
u2022     Fill the mail recipient list
lt_reclist-rec_type = 'U'.
LOOP AT t_recipient_list.
lt_reclist-receiver = t_recipient_list-address.
APPEND lt_reclist.
ENDLOOP.
u2022     Finally send E-Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = lw_sent_to_all
TABLES
packing_list = lt_packing_list
object_header = lt_objhead
contents_bin = t_xlstab
contents_txt = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Hope it will help you
Regards
Rahul sharma
Edited by: RAHUL SHARMA on Nov 4, 2008 1:22 PM

Similar Messages

  • Alv output- download to excel file

    Hi
    I have ALV report. My requirement is
    For example i have 10 records in my ALV output.
    I want to download first 5 data to excel file.
    so i need to select the data and click the button download in alv screen. I created the download button in ALV screen.
    how to write coding for this

    Hi Kumar K,
    U can do it by feeling another internal table from the final internal table which u displayed...
    suppose u want the record 5 to 12 then
    LOOP AT itab FROM 5 TO 12.
    Append itab to itab2.
    ENDLOOP.
    So now Itab2 contains record 5 to 12...
    Logic:
    Create one Custom Button ... Now For Sy-ucomm of that button... provide popup window with FROM and TO parameters...
    Then using Loop... Endloop... select that much records form internal table to another internal table say itab2...
    Now using GUI_DOWNLOAD or WS_DOWNLOAD or any other FMs and pass the internal table to this FM...
    For more information on LOOP Syntax...
    LOOP AT itab - cond
    Syntax
    ... [FROM idx1] [TO idx2] [WHERE log_exp].
    Extras:
    1. ... FROM idx1
    2. ... TO idx2
    3. ... WHERE log_exp
    Effect
    The table rows to be read in a LOOP-loop can be limited by optional conditions; if no conditions are specified , all rows of the table are read.
    Addition 1
    ... FROM idx1
    Effect
    The specification FROM is only possible with standard tables and sorted tables. This specification only accepts table rows starting from table index idx1. For idx1, a data object of the type i is expected. If the value of idx1 is smaller or equal to 0, then it will be set to 1. If the value is larger than the number of table rows, the loop is not passed through.
    Addition 2
    ... TO idx2
    Effect
    The specification TO is only possible with standard tables and sorted tables. The specification only accepts table rows after table index idx2. For idx2, a data object of the type i is expected. If the value of idx2 is smaller or equal to 0, then the loop will not be passed. If the value is larger than the number of table rows, then the value will be set to the number of rows. If idx2 is smaller than idx1, then the loop is not passed as well.
    Addition 3
    ... WHERE log_exp
    Effect
    WHERE can be specified with all table-types. After WHERE, you can specify any logical expression log_exp in which the first operand of any singular comparison is a component of the internal table. For this reason, all logical expressions are possible except for IS ASSIGNED, IS REQUESTED and IS SUPPLIED. Dynamic specification of a component through bracketed character-type data objects is not possible. Loops at sorted tables must have compatible operands of the logical expression. All rows are read for which the logical expression is true.
    Notes
    The logical expression specified after WHERE is analyzed once at entry into the loop. Possible changes of the second operand during loop processing are not taken into account.
    While with standard tables all rows of the internal table are checked for the logical expression of the WHERE- addition, with sorted tables and hash tables (as of Release 7.0) you can achieve optimized access by checking that at least the beginning part of the table key in sorted tables and the entire table key in hash tables is equal in the logical expression through queries linked with AND. Optimization also takes effect if the logical expression contains other queries linked with AND with arbitrary operators.
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7

  • ALV output download to excel with top of page

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

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

  • Alv output download to excel sheet spliting into three line

    hi,
    i have developed alv report with 62 fields (62 colums).when i download this output into excel sheet each line spliting into three line.each field has 20 char length.i want download each row as single line.
    i am using local file  (ctrl + shift+F9) -> spreadsheet option
    please advice me to solve this issue. i am using fm REUSE_ALV_GRID_DISPLAY.
    In layout i am using
      DATA:   min_linesize like sy-linsz,   " if initial min_linesize = 80
              max_linesize like sy-linsz.   " Default 250
      min_linesize = 100.
      max_linesize = 1000.
      gt_layout-zebra             = 'X'. "space.
      gt_layout-colwidth_optimize = space.
      gt_layout-max_linesize = min_linesize.
      gt_layout-max_linesize = max_linesize.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
           i_bypassing_buffer = ' '
           i_callback_program       = sy-repid
           i_callback_pf_status_set = 'SET-PF-STATUS'
           i_callback_user_command  = 'USER_COMMAND'
           it_fieldcat              = gt_fieldcat[]
           it_events                = gt_events[]
           is_layout                = gt_layout
          is_variant               = v_stru_disvar
          i_default                = 'X'
          i_save                   = 'A'
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
         TABLES
           t_outtab                          = it_final[]
      EXCEPTIONS
        program_error                     = 1
        OTHERS                            = 2
    Edited by: Raja Ram on Aug 4, 2009 12:40 PM

    solved

  • Reg: ALV report download to excel currency columns

    Hi All,
    While downloading the alv report to excel, currency fields with negative sign(less than 0) is downloading without negative sign.
    And field catalog wad declared as 'CURR' field for that particular column, if I declared as 'CHAR', i am getting shortdump.
    Can any one tell me how to get the negative sign.
    Thanks in advance.

    Hi,
    Do you use ALV to excel standard functionality or your own code to excel?
    Please provide more information.
    Thanks,

  • Using download button in ALV to download to excel

    Hi,
    Please provide me the solution on using download button in Hierarchial List ALV to download to excel.I need to download the Header and Item details in a single line (in one line)in the Excel sheet.
    Please suggest the solution and sample code ASAP.
    Thanks and Regards,
    Latha.

    Hi Rames,
    my mail id : [email protected]
    Thanks and Regards,
    Vidyullatha.

  • Reg. ALV output transported into Excel

    Dear All,
                   when i transported my ALV report output to excel file , amount column is suppressed from decimal places .
    i.e. in excel file ,  decimal values of amount column is not shown in some amounts.
    Please provide some inputs
    Thanks & Regards
    shailesh

    Hi ,
    Check this [LINK|ALV List output to Excel file; for  ALV output transported into Excel.
    hope it will help you .
    Regards,
    Saravana.S

  • How to display the fields in ALV Output without using Field catalog?

    How to display the fields in ALV Output without using Field catalog?
    Could you pls tell me the coding?
    Akshitha.

    Hi,
    u mean without building field catalog. is it? I that case, we can use the FM REUSE_ALV_FIELDCATALOG_MERGE.
    data: itab type table of mara.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_structure_name = itab
    CHANGING
    ct_fieldcat = lt_fieldcat[]
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    *Pass that field catalog into the fillowing FM
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_grid_title            = 'REPORTING'
                is_layout              = gt_layout
                it_fieldcat             = lt_fieldcat[]
           tables
                t_outtab                = itab.

  • How to  send ALV output data into Excel sheet format via Mail to the user?

    Hi friends,
    I have a doubt ie,
    How to  send ALV output data into Excel sheet format via Mail to the user?
    regards
    Moosa

    Hi,
    Provide the output internal table to the objbin in the below FM
    Send Message
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                document_data              = i_docdata
                put_in_outbox              = c_x
           TABLES
                packing_list               = i_objpack
                object_header              = i_objhead
                contents_bin               = i_objbin
                contents_txt               = i_objtxt
                receivers                  = i_reclist
    and specify the document type
      i_objpack-doc_type   = 'XLS'.
    and try.
    Regards,
    Nandha

  • Download colored ALV output in to EXCEL sheet

    Hi ,
    I want to download colored ALV output to Excel sheet with color.
    one of the field in ALV is with 4 colors depending on condition.
    i am unable to download the color using download option(that field is comming with out color).
    Please help me by providing the solution.
    Thanks in advance.
    Regards
    sarath

    Hi Srini,
    thanks for the reply.
    i am using standard download function only.
    if i use download->local file->HTML Format only the font is appearing in colors.in case of spread sheet no color comming.
    but my requirement is to download into excel and  background also with color(green...) font in black like that.
    (exactly appearing in the ALV)
    Thanks
    sarath

  • To download alv output to two excel sheets because of large data

    Hi all,
    I want to download alv output to excel sheet,I know how to do,but the no of record is very large and can not be accomodated in one sheet.
    can anyone please tell how to download it into two sheets or some other way.
    I want excel format only.
    Regards,
    sudha

    hi sudha yadav,
    right now i am working on the same issue.
    what right i am doing is that,
    i want to download an internal table it is containing more than 2 lakhs records but excel can accomidate 60000 records, so
    before call gui download i am sending first 60000 records into another internal table with same time, by using append statemen and indexs,
    that new internal table i am downloading
    again i am repeating the same thing by using sy-tabix,
    finally i am creating more than one excel file
    by using oops concepts we can also create in one excel file no of work sheets
    but its lengthy process so i am right now creating no of excel files only
    if it is useful , pls rewards points to this answer

  • Reg: ALV Output to EXCEL

    Hi
    i am working in a alv report and i got the output and when i download in to excel some of the columns getting mismatched..
    I got some solution from theSDN have to do some modification in Excel sheet,But now i am using EXCEL 2007 version can any one gimme some logice how to come out of this issue??
    Thanks and Regards,
    Arun Joseph

    Arun,
    some time when you download output to excel than may be some of the field or sorting critieria may be not reflect in excel so you need to do some adjustment even you are using excel2007.
    Amit.

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

  • Problem in alv output download

    HI All,
    My problem is
    My alv output table contains long text with value as 1000 characters.
    when i am downloading my alv output into excel, it is downloading only 255 characters length.
    is there any ways to download the entire long text into excel.
    Please help me on this...
    Thanks in advance.
    Maruthi Konijeti

    see the following example.
    REPORT z_down_xml LINE-SIZE 132 NO STANDARD PAGE HEADING.
    Databases
    TABLES:
      makt,                                "Mat description
      marc,                                "Material / plant
      t001w,                               "plant name
      bhdgd.                               "Batch heading
    Internal tables
    DATA:
      BEGIN OF gt_marc OCCURS 0,
        werks LIKE marc-werks,
        matnr LIKE marc-matnr,
      END OF gt_marc,
    Table to be downloaded as xml. Each line stores start and end tags
    and the value
      BEGIN OF gt_xml OCCURS 0,
        line(120),
      END OF gt_xml,
      g_maktx(120).
    User-input
    SELECT-OPTIONS:
      s_werks FOR marc-werks,
      s_matnr FOR marc-matnr.
    START-OF-SELECTION.
    Extract all required data
      PERFORM main_processing.
    END-OF-SELECTION.
      SORT gt_marc BY werks matnr.
      LOOP AT gt_marc.
        AT FIRST.                          "First tag must be root
          CLEAR gt_xml.
          gt_xml-line = ''.
        APPEND gt_xml.
        CLEAR gt_xml.
    display data
        FORMAT COLOR 2 ON.
        WRITE :/ gt_marc-matnr, makt-maktx.
        FORMAT COLOR 2 OFF.
      ENDLOOP.
    The last tag must be the root closing tag --*
      gt_xml-line = '</LOCATIONS>'.
      APPEND gt_xml.
      CLEAR gt_xml.
      CALL FUNCTION 'DOWNLOAD'
           EXPORTING
                filename = 'C:PLANT1.XML'
                filetype = 'ASC'
           TABLES
                data_tab = gt_xml.
    TOP-OF-PAGE.
      MOVE sy-title TO bhdgd-line1.
      MOVE sy-repid TO bhdgd-repid.
      MOVE sy-uname TO bhdgd-uname.
      MOVE sy-datum TO bhdgd-datum.
      MOVE '0' TO bhdgd-inifl.
      MOVE '132' TO bhdgd-lines.
      FORMAT INTENSIFIED ON COLOR COL_HEADING.
      PERFORM batch-heading(rsbtchh0).     "report header
    Form READ_PLANT
    FORM read_plant.
    Get plant name
      CLEAR t001w.
      SELECT SINGLE name1
        INTO t001w-name1
        FROM t001w
       WHERE werks EQ gt_marc-werks.
    ENDFORM.                               " READ_PLANT
    Form MAIN_PROCESSING
    FORM main_processing.
    Material and plant basic data
      SELECT werks matnr
        INTO TABLE gt_marc
        FROM marc
       WHERE werks IN s_werks
         AND matnr IN s_matnr.
    ENDFORM.                               " MAIN_PROCESSING
    Form READ_DESCRIPTION
    FORM read_description.
    Material name
      CLEAR g_maktx.
      SELECT SINGLE maktx
        INTO g_maktx
        FROM makt
       WHERE matnr EQ gt_marc-matnr
         AND spras EQ 'E'.
    Replace special character
      DO.
        REPLACE '&' WITH '*ù%;' INTO g_maktx.
        IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
      ENDDO.
      DO.
        REPLACE '*ù%;' WITH '&amp;' INTO g_maktx.
        IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
      ENDDO.
      DO.
        REPLACE '/' WITH '&#47;' INTO g_maktx.
        IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
      ENDDO.
    ENDFORM.                               " READ_DESCRIPTION

  • ALV colouring download to excel sheet

    Hi Experts ,
    I have a requirement in which I have coloured the cells of the ALV display , in order to highlight them.
    I have made use of 'REUSE_ALV_GRID_DISPLAY' FM for displaying ALV.
    When I  download this output to an excel sheet , the colour filled in various cells disappears.
    Can someone let me know that , is it possible to retain this colour of the cell even after ALV download to an excel sheet?
    Thanks in Advance !!!

    Hi retwika
    I had searched on this previously and found out the following code,for download a report to excel with format (border, color cell, etc) 
    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
    Look out the changes
    Revert if any prblem
    Thanks and Regards
    Srikanth.P

Maybe you are looking for

  • Testing Java Concurrent Program on the command line in Windows

    I'm using the suggestions in: http://blogs.oracle.com/xmlpublisher/2007/05/02 to test my Java concurrent program on the command line. Our production environment is running on Unix. I've been able to test it successfully on the Unix environment from t

  • Green screen function in imovie 10.0

    Hello Everybody, in older imovie editions you could unlock advance settings in imovie and then use green screen function for videos. But now in my new imovie 10.0 i don't find advance settings and so i could not use this function for my videos. Could

  • OC4J Configuration issue

    Hi, I tried to put my database in Archivelog mode through EM , at the time of restarting the database it didnt start... instance is starting but database is not opening.... I tried this command but its giving error... ( I am running 10g r2 , on RHEL

  • All day event as memo

    Hi, I use MFE for syncing my calandar. In the past while using the PC suite an all day event was shown on my E65 as a memo. This was fine because one could see the event the whole day. Now with MFE it syncs as an appointment. Is there a possibility t

  • How to Configure Workflow with Standard TCODE

    Hello Gurus,             I am new in Workflow. I have to trigger the workflow on the transaction MM02 on changing Material Plant Status to 41. I have ZECN object. but I am not aware with how this object is trigger on change of Material Status. Please