Excel download from ALV grid, for characters more than 1020

Hi,
When i am trying to download the report which is having character more than 1020, it is coming in two rows. I want all fields in one row. Please give solutions.
I am using below field catalog.
Car Eligibility
  CLEAR lw_fieldcat.
  lw_fieldcat-fieldname = text-001.
  lw_fieldcat-reptext_ddic = text-011.
  lw_fieldcat-tabname = text-021
  APPEND lw_fieldcat TO gt_fieldcat.
I am using below FM.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = sy-repid
      is_layout          = gt_layout
      it_fieldcat        = gt_fieldcat[]
      it_sort            = gt_sort[]
      it_events          = gt_events[]
    TABLES
      t_outtab           = gt_data
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.
Thanks in Advance,
Ravi Kumar

ravi,
its not about how you have used your field catalog or how you called ALV FM. its excel download functionality,
what you need to do is:
set pf-status '<<some value>>' -> you can find where to pass in ALV FM call.
then add a application toolbar button though this pf status.
then at  use_command event, check sy-ucomm and if its the same as your new icons fcode then use the method to download it in excel.

Similar Messages

  • Downloads from ALV GRID-Text conversion to dates in EXCEL

    When downloading table displays of data from ALV-GRID for excel spreadsheet, we end of with files that have a header and various line ifnromation.  IF we manually clear up the display, then we can have the individicual column headers used and force them to text but if we just call the file up as an EXCEL spreadsheet, some part numbers such 12-3465 appear in Excel as Dec-65.
    The following is an example of the record (but it is word wrapped within this display limit).  In actuality, the verbage enclosed with the <b> represent the start of the  lines that have actual display data running out about 90 characters.
    Suggestions on how to make the download immediately correct in Excel direct from SAP ALV-GRID without cleaning out the heading lines and manually forcing the affected columns to TEXT format?
    thanks
    <b>03/02/2007</b>                                                                    Dynamic List Display                                                                                1
    <b>Materials-Inforecord Details Report</b>
    <b>Purchasing Org: ILMO</b>
                        <b>Report Run Date:03/02/2007</b>                    <b>Report Time:14:31:16</b>
         <b>Plnt     Mat Grp     Vendor     Name 1     Material     Material</b> description     Vendor Cat     Mfr     MPN     PC     Item Chg.     OUn      Eq to     BUn     Net price     Per     OPUn     Inforecord     PGr     Mv Avg        per     ValCl
         <b>0042     04     106070     BURROWS COMPANY</b>     184110     Glv Exam Ltx Non Ster     02-5001     TILLOTSON     02-5001               CA     2,000     EA        93.40      1     CA     5300006999     999     93.40     2,000     6438

    there are different options to export to excel which all behave differently, if you go for the menu ->export it differs from the export button from the alv buttonbar.
    try the different export to excel options perhaps there is one that behaves the way you want
    kind regards
    arthur de smidt

  • Excel download from ALV not working inproduction

    Hi all,
    I am using "set_table_for_first_display" for alv display. the excel download from alv is woking fine in development and quality stystem but in production only first 3-4 rows are getting downloaded. Other rows donot appear in excel.
    Any Idea !!!
    Thanks
    Madhu

    Hi Experts,
    I have noticed that same problem is occuring in development system also with same set of data . The ascii file created has some missing rows. I guess its due to some special characters though i am not able to see any special character . Any solution for this.
    Regs
    madhu

  • Download from ALV grid to PDF format

    hai Friends!
       plz tell me how can i download from ALV grid to PDF format..
    send me some sample codes

    check this thread
    ALV Grid to PDF
    and do use the search functionality from next time and post the question only wheb u dont find the answer
    кu03B1ятu03B9к

  • Title above ALV grid is having more than 70 chars.

    Hi friends ,
    I have a requirement in which title above ALV grid is having more than 70 chars.
    But the layout structure of ALV (slis_layout_alv) is having a component called wiindow_title which is having maximum length of 70 chars. How to show the text having more than 70 chars over here ?

    Hello Abhijit,
    Its not possible to display more than 70 characters in ALV Title. May be you can try using Top of page and ALV list commentary write.
    Regards,
    Karthik D

  • Download to excel sheet from ALV Grid report

    Hi,
    I need to download 3 lakhs of data to excel sheet but the constraint is that excel is having max limit of 65000 line items.
    So i need to know the way in which i can create more than one sheet in excel while downloading so that each sheet can hold upto 65000 line items.
    i need to create atleast 6 sheets in excel while downloading from report.
    please help.

    Hi,
    While downloading the data, it will prompt you save the list in file - Uncoverted, Spreadsheet, Rich text format, HTML format, Copy to Clipboard.
    Why don't you try using Uncoverted format and give extension as .txt file.
    So that you can download all 3 lacs of records.
    Even if you use any FM, it will indirectly use excel for downloading and it will have restriction of having 65000 records only.
    Thanks,
    Sriram Ponna.

  • Download to Excel file from ALV Grid

    Hi,
    I'm having a problem in downloading ALV Grid to excel file. The problem are the numbers are not in float format. I want them all in float format. Numbers in thousands are formatted with comma and decimals but numbers less than thousands are not in decimals.
    Ex:
    5 should be 5.00.
    In ALV, this number is being displayed as 5.00 but when downloaded it displayed as 5 only.

    Did you mention the INTTYPE and Decimals in the fieldcatalog for those fields.
    INTTYPE = 'P'.
    DECIMALS_OUT = '3'.
    try this..
    also
    use the Option
    short cut CTRLSHFTF9 option
    Local File->Spreadsheet->  and save it to excel file.

  • Not able to download all the rows to excel sheet from alv grid display

    Hi experts,
    I am not able to download all the rows which are displayed in alv grid display for some material numbers.
    for some materials i am able to download, i used two ways to download 1) from icon(local file) on grid 2) menu list->export.
    i checked in debugging till selecting the spread sheet pop up window, i am able to see all the data in internal table.
    Can you suggest me what will be the problem....
    thanks in advance,

    hi sandeep,
    sorry for didnt specify clearly.
    note: EX: "asaasdada  in this sentence i said  " this symbol is special character not the text.
    building final internal table code
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
        EXPORTING
          capid                 = p_capid
          datuv                 = sy-datum
          ehndl                 = '1'
          mktls                 = 'X'
          mehrs                 = 'X'
          mmory                 = '1'
          mtnrv                 = p_matnr
          stlal                 = '1'
          stpst                 = 0
          svwvo                 = 'X'
          werks                 = p_werks
          vrsvo                 = 'X'
        TABLES
          stb                   = i_stb
        EXCEPTIONS
          alt_not_found         = 1
          call_invalid          = 2
          material_not_found    = 3
          missing_authorization = 4
          no_bom_found          = 5
          no_plant_data         = 6
          no_suitable_bom_found = 7
          conversion_error      = 8
          OTHERS                = 9.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      i_stb1[] = i_stb[].
      IF NOT i_stb1[] IS INITIAL.
        SORT i_stb1 BY idnrk.
        DELETE ADJACENT DUPLICATES FROM i_stb1 COMPARING idnrk.
        SELECT bmatn ematn FROM ampl INTO TABLE i_ampl
          FOR ALL ENTRIES IN i_stb1
          WHERE bmatn = i_stb1-idnrk AND
                datuv LE sy-datum AND                          
                datub GE sy-datum.                              
        SELECT
        matnr
        bwkey
        verpr
        stprs
        bwprh
        FROM mbew
        INTO TABLE i_mbew
        FOR ALL ENTRIES IN i_stb1
        WHERE
            matnr EQ i_stb1-idnrk AND
            bwkey EQ i_stb1-werks.
        IF NOT i_stb1[] IS INITIAL.
          SELECT matnr werks beskz
                 dzeit webaz plifz                              
                 ekgrp                                         
          INTO TABLE i_marc
          FROM marc
          FOR ALL ENTRIES IN i_stb1
          WHERE matnr = i_stb1-idnrk
          AND werks = i_stb1-werks.
          SORT i_marc BY matnr werks.
        ENDIF.
        CLEAR i_ekpo.
        CLEAR i_vend.
        IF NOT i_stb1[] IS INITIAL.
          SELECT ebeln ebelp matnr werks loekz aedat
                 netpr peinh                                   
          INTO TABLE i_ekpo
          FROM ekpo
                FOR ALL ENTRIES IN i_stb1
                WHERE matnr = i_stb1-idnrk
                AND werks = i_stb1-werks.
          SORT i_ekpo BY matnr ASCENDING
                         aedat DESCENDING
                         ebeln DESCENDING
                         ebelp DESCENDING.
          IF NOT i_ekpo IS INITIAL.
            SELECT k~ebeln k~lifnr l~name1
            INTO TABLE i_vend
            FROM ekko AS k INNER JOIN lfa1 AS l
            ON k~lifnr EQ l~lifnr
            FOR ALL ENTRIES IN i_ekpo
            WHERE ebeln = i_ekpo-ebeln.
            SORT i_vend BY ebeln.
          ENDIF.
        ENDIF.
      ENDIF.
      i_ampl1[] = i_ampl[].
      IF NOT i_ampl1[] IS INITIAL.
        SORT i_ampl1 BY ematn.
        DELETE ADJACENT DUPLICATES FROM i_ampl1 COMPARING ematn.
        SELECT matnr mfrpn mfrnr FROM mara INTO TABLE i_mara
          FOR ALL ENTRIES IN i_ampl1
           WHERE matnr = i_ampl1-ematn.
      ENDIF.
      SORT i_ampl BY bmatn.
      IF NOT i_stb[] IS INITIAL.
        SELECT stlty stlnr stlkn stpoz idnrk potx1 potx2
        INTO TABLE i_stpo
        FROM stpo
        FOR ALL ENTRIES IN i_stb
        WHERE stlty = i_stb-stlty
          AND stlnr = i_stb-stlnr
          AND stlkn = i_stb-stlkn
          AND stpoz = i_stb-stpoz
          AND idnrk = i_stb-idnrk.
        SORT i_stpo BY stlty stlnr stlkn stpoz idnrk.
      ENDIF.
      LOOP AT i_stb INTO wa_stb.
        READ TABLE i_marc INTO wa_marc
        WITH KEY     matnr = wa_stb-idnrk
                     werks = wa_stb-werks
                     BINARY SEARCH.
        IF sy-subrc = 0.
          wa_outtab-beskz = wa_marc-beskz.
          wa_outtab-dzeit = wa_marc-dzeit.                      
          wa_outtab-webaz = wa_marc-webaz.                     
          wa_outtab-plifz = wa_marc-plifz.                     
          wa_outtab-ekgrp = wa_marc-ekgrp.                     
        ENDIF.
        READ TABLE i_ekpo INTO wa_ekpo
            WITH KEY matnr = wa_stb-idnrk.
        IF sy-subrc = 0.
          wa_outtab-netpr = wa_ekpo-netpr.                     
          wa_outtab-peinh = wa_ekpo-peinh.                     
          READ TABLE i_vend INTO wa_vend
          WITH KEY ebeln = wa_ekpo-ebeln
                   BINARY SEARCH.
          IF sy-subrc = 0.
            wa_outtab-lifnr = wa_vend-lifnr.
            wa_outtab-name_sup = wa_vend-name1.
          ENDIF.
        ENDIF.
        READ TABLE i_stpo INTO wa_stpo
        WITH KEY stlty = wa_stb-stlty
                 stlnr = wa_stb-stlnr
                 stlkn = wa_stb-stlkn
                 stpoz = wa_stb-stpoz
                 idnrk = wa_stb-idnrk
                 BINARY SEARCH.
        IF sy-subrc = 0.
          wa_outtab-potx1 = wa_stpo-potx1.
          wa_outtab-potx2 = wa_stpo-potx2.
        ENDIF.
        READ TABLE i_mbew INTO wa_mbew
        WITH KEY
        matnr = wa_stb-idnrk
        bwkey = wa_stb-werks.
        IF sy-subrc IS INITIAL.
          MOVE:
          wa_mbew-verpr TO wa_outtab-verpr,
          wa_mbew-stprs TO wa_outtab-stprs,
          wa_mbew-bwprh TO wa_outtab-bwprh.
        ENDIF.
        wa_outtab-matnr = p_matnr.
        wa_outtab-posnr = wa_stb-posnr.
        wa_outtab-stufe = wa_stb-stufe.
        wa_outtab-idnrk = wa_stb-idnrk.
        wa_outtab-ojtxb = wa_stb-ojtxp.
        wa_outtab-menge = wa_stb-menge.
        wa_outtab-meins = wa_stb-meins.
        MOVE: wa_stb-zzitem_draw_no TO wa_outtab-zzitem_draw_no.
        IF wa_stb-upskz = 'X'.
          SELECT * FROM stpu INTO TABLE i_stpu
                   WHERE  stlty = wa_stb-stlty AND
                          stlnr = wa_stb-stlnr AND
                          stlkn = wa_stb-stlkn AND
                          stpoz = wa_stb-stpoz.
        ENDIF.
        LOOP AT i_stpu INTO wa_stpu.
          wa_outtab-upmng = wa_stpu-upmng.
          wa_outtab-ebort = wa_stpu-ebort.
          wa_outtab-uposz = wa_stpu-uposz.
          CONCATENATE v_ebort wa_stpu-ebort      INTO v_ebort
          SEPARATED BY space.
        ENDLOOP.
        MOVE strlen( v_ebort ) TO v_len.
        MOVE: 0 TO x,
          128 TO y.
        DATA : lt_tab TYPE TABLE OF swastrtab.
        DATA : ls_tab LIKE LINE OF lt_tab.
        DATA : lv_ebort TYPE string.
        CLEAR lv_ebort. CLEAR lt_tab.
        MOVE v_ebort TO lv_ebort.
        CALL FUNCTION 'SWA_STRING_SPLIT'
          EXPORTING
            input_string                 = lv_ebort
            max_component_length         = 128
          TABLES
            string_components            = lt_tab
          EXCEPTIONS
            max_component_length_invalid = 1
            OTHERS                       = 2.
        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 lt_tab[] IS NOT INITIAL.
          LOOP AT lt_tab INTO ls_tab.
            CLEAR lv_ebort.
            MOVE: ls_tab-str TO lv_ebort.
            CONDENSE lv_ebort.
            MOVE lv_ebort TO wa_outtab-ebort.
            APPEND wa_outtab TO i_outtab.
            CLEAR:
            wa_outtab-matnr,
            wa_outtab-posnr,
            wa_outtab-zzitem_draw_no,
            wa_outtab-ojtxb,
            wa_outtab-menge,
            wa_outtab-meins,
            wa_outtab-uposz,
            wa_outtab-upmng,
            wa_outtab-verpr,
            wa_outtab-stprs,
            wa_outtab-bwprh,
            wa_outtab-lifnr,
            wa_outtab-name_sup,
            wa_outtab-potx1,
            wa_outtab-potx2,
            wa_outtab-netpr,
            wa_outtab-peinh.
    *        wa_outtab-idnrk.
          ENDLOOP.
        ELSE.
          APPEND wa_outtab TO i_outtab.
        ENDIF.
        CLEAR v_ebort.
        CLEAR: wa_stpu.
        REFRESH: i_stpu.
        LOOP AT i_ampl INTO wa_ampl WHERE bmatn = wa_stb-idnrk.
        READ TABLE i_mara INTO wa_mara WITH TABLE KEY matnr = wa_ampl-ematn.
          IF sy-subrc = 0.
            LOOP AT i_outtab INTO wa_outtab
            WHERE
            idnrk = wa_stb-idnrk AND
            flag NE 'X'.
              wa_outtab-mfrpn = wa_mara-mfrpn.
              wa_outtab-mfrnr = wa_mara-mfrnr.
              SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
              MOVE 'X' TO wa_outtab-flag.
              MODIFY i_outtab FROM wa_outtab
              TRANSPORTING mfrpn mfrnr name1 flag.
              EXIT.
            ENDLOOP.
            IF sy-subrc <> 0.
              CLEAR:
              wa_outtab-matnr,
              wa_outtab-posnr,
              wa_outtab-zzitem_draw_no,
              wa_outtab-ojtxb,
              wa_outtab-ebort,
    *          wa_outtab-idnrk,
              wa_outtab-menge,
              wa_outtab-meins,
              wa_outtab-uposz,
              wa_outtab-upmng,
              wa_outtab-verpr,
              wa_outtab-stprs,
              wa_outtab-bwprh,
              wa_outtab-lifnr,                                 
              wa_outtab-name_sup,                              
              wa_outtab-potx1,                                 
              wa_outtab-potx2,                                 
              wa_outtab-netpr,                                 
              wa_outtab-peinh.                                 
              wa_outtab-mfrpn = wa_mara-mfrpn.
              wa_outtab-mfrnr = wa_mara-mfrnr.
              SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
              APPEND wa_outtab TO i_outtab.
            ENDIF.
          ENDIF.
          REFRESH i_stpu.
          CLEAR i_stpu.
        ENDLOOP.    CLEAR: wa_matnr1, wa_mfrnr, wa_outtab.
      ENDLOOP.
    Edited by: srinivasareddy j on Mar 9, 2011 7:16 AM
    Edited by: srinivasareddy j on Mar 9, 2011 7:20 AM

  • How to enable excel downloading in ALV grid report.

    Hi all,
    How to enable excal downing in ALV grid report?
    Thanks in Advance.
    Siva Sankar.

    hi
    check the following code
    Example of a Simple ALV Grid Report
    REPORT  ZTUFI091                                .
    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic requirement for this demo is to display a number of       *
    *& fields from the EKKO table.                                         *
    *REPORT  zdemo_alvgrid                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you  more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
                  I.e. Field type may be required in-order for
                       the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                            "click(press f2)
    gd_layout-zebra             = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
                it_events               = gt_events
                is_print                = gd_prntparams
                i_save                  = 'X'
               is_variant              = z_template
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    Form  TOP-OF-PAGE                                                 *
    ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
               i_logo             = 'Z_LOGO'.
    endform.
          FORM USER_COMMAND                                          *
          --> R_UCOMM                                                *
          --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
      Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
        Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
        Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
        Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    *&      Form  BUILD_EVENTS
          Build events table
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = gt_events[].
      read table gt_events with key name =  slis_ev_end_of_page
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
        read table gt_events with key name =  slis_ev_end_of_list
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_LIST' to ls_event-form.
        append ls_event to gt_events.
      endif.
    endform.                    " BUILD_EVENTS
    *&      Form  BUILD_PRINT_PARAMS
          Setup print parameters
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  END_OF_LIST
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    hope it will help you
    regards
    sreelatha gullapalli

  • Regarding excel download from ALV report tree

    Hi Experts,
    I have a ALV report tree program. In that i need the functionality to download report output in excel file.
    Can any body suggest how can i achieve download to excel functionality in it.
    Any useful suggestion will be appreciated.
    Thanks in advance,
    Akash

    The data for the tree exist in the NODE table in a different format. So, even you download that table, it will not be downloaded in the TREE format. So, the user will not be able to understand the data unlike the case of a ALV GRID.
    Whether it is a TREE / GRID, ultimately its the data of a internal table, that gets downloaded. But in case a TREE, we don't have the data in a straight forward way . i thnk it is not possible . i am not sure too for this .

  • Issue in Excel download from ALV output

    Dear Experts,
    I have generated an ALV Output using FM "REUSE_ALV_GRID_DISPLAY". When i try to download the ALV Output in Excel spreadsheet, I am not getting the data in Excel sheet. Kindly help me in this regard.
    Thanks in advance,
    Regards,
    Ramesh Manoharan

    hi ramesh,
    Please try below options.
    after getting the ALV disply , Go to Menu  LIST->Export->Spreadsheet.or microsoft excel view (Cntrl + Shift + F7)
    It will give some options to see the data in spread sheet format, hope you can save this to local desktop also.
    or
    please check the extension, it should be .XLS not .XLSX  .some times .XLSX format wont be supported
    regards,
    pradeep
    Edited by: Pradeep Kandgal on Aug 4, 2010 6:54 PM
    Edited by: Pradeep Kandgal on Aug 4, 2010 6:54 PM

  • ALV grid display with more than 1000 columns

    Hi Friends,
    I have to prepare a report output which have 1015 columns.
    User will give 100 weeks of data to retrieve. I have to display the output in day wise.
    100*7 + 315 = 1015 columns.
    I am using ALV grid display for this in 4.6C.
    My Question is, whether I have to declare the output table type with 1015 fields.?
    Is there any other way to do this, without declaring 1015 cloumns.
    Please guide me to solve this.
    Regards,
    Viji.

    I'm thinking when your End-user will press Ctrl + P feeding A4 size to printer
    Thomas:
    Maybe the functional consultant is pulling your leg?
    May be OP is pulling our legs or something further?
    Cheers

  • Excel download from ALV OOPS , columns rearranged

    Hi ,
      When I am downloading the data using the Export button - option Spreadsheet few of the columns are getting re-arranged. I am using OOPS ALV using Custom container.I even specified the column position in the field catalogue.
    Can anyone help me to have the columns in the same order as displayed in SAP.
    Many Thanks
    Supriya

    hi,
    for this problem u need to create a varient layout. here u customize the output.
    while seeing the output u can use this layout.
    hence your output will be similar as u seen in the system.
    try and let me know...
    pradeep.

  • Taking download into excel from ALV Grid - header is printing in two lines

    Hi All,
    I have a scenario where I am taking the download from ALV grid to an excel sheet. Now the header of the ALV (column names) is appearing in two lines in the downloaded excel sheet while items (records of the ALV table) are getting displayed in a single line.
    This download is taken from the standard download to local file (spreadsheet) button provided by SAP for ALVs.
    I am using function module "Reuse_alv_grid_display" for the purpose.
    Can somebody provide an idea how I can avoid the header printing in two lines and keep the length as it is.
    Thanks in Advance,
    Chandan

    Hi..
    1. Pass header name in internal table appned first line.
    2. after that pass u r data .
    3. Use  FM. WS_DOWNLOAD 
    Salil ......
    Edited by: salil chavan on Nov 26, 2008 11:07 AM

  • Downloading from alv to excel file

    hai
       while downloading from alv grid to excel  file
      i am not getting values properly. i have taken 110 fields. i am not getting prper way. can u plz tel me way....

    Hi ....
    I have the similar problem. My coumns are not in any sequence when I download it to excel sheet.
    How do I fix it.
    Neha

Maybe you are looking for