Alv Report downloading problem

Dear Experts,
                     I'm using one pushbutton for downloading the alv report,  into desktop
1).  but in that file i need header information details also,
2).  then my report contains 26 field but it is downloading upto some fields only,
3).  then when my report contains null values for some columns that columns are not displaying in that file.
share some sample codes,
Thanks and Regards,
Thirukumaran. R

Hi,
1. For header fields, you need to enable one of the field, so that it will recognige the first row as header.
2. You should not consider only the field displayed at output, you should take all the values available in the internal table.
3. First take the record type as STRING. Now CONCATENATE all the fields available in the internal table to this RECORD and append it to some internal table. Now pass this internal table to the GUI_DOWNLOAD function module.
May be you can refer to the below code.
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                  = p_file
      filetype                  = 'ASC'
      append                    = ' '
      write_field_separator     = ' '
      write_lf                  = 'X'
      confirm_overwrite         = 'X'
      ignore_cerr               = 'X'
      replacement               = '#'
      trunc_trailing_blanks_eol = 'X'
      write_lf_after_last_line  = 'X'
      show_transfer_status      = 'X'
    TABLES
      data_tab                  = lt_output_file
    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.
Note: May be you need to modify few parameters.....
Regards,
Santhosh.

Similar Messages

  • Alv report download

    hai to all,
    I am trying to download the alv report to excel file by using the push button which is availabe in APPLICATION TOOL BAR.
    But i not able to perform the same , i am getting empty excel file. What will be the problem, please tell me where iam missing.
    regards
    vijay.j

    hi ,
       do this way..
      go to system->List->save->local file  here select SPread sheet and give file name..
    Regards
    Ashok P

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

  • Urgent: regarding ALV  report display problem

    hi,
    There are 3 problems:-
    1.) I had made a ALV report in which i have to display 'POSTING DATE' (iseg-budat) when we execute the report i.e. it should be displayed as  PERIOD :- _______  to _______ on alv report ..
    2.)the 2nd problem is dat when i use the '  wa_fieldcat-no_zero = 'X'.  It eliminates all the leading zeros which are present which is okay when i it displays material no.. but the problem is dat it also deletes the other fields where the values are to be zeros.
    i had used this FM:-
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
       INPUT = ITS1-MATNR
       IMPORTING
       OUTPUT = ITS1-MATNR.
    so that only matnr field are to be 0's.
    3.) I want to delete the rows which use to contain the values 0's as there are no calculations are performing as these are displayed .
    ANYbody having solution of this problem ,plzzzz provide the soluion of it as it is most urgent to me and dat person will definately rewarded.
    regards,
    ric.s

    hi kiran,
    thanks for ur response. here is d code which i am using it and plzz help me to figure out where i have to make changes:-
    REPORT  ZTEST03.
    TABLES: ISEG,MARA.
    TYPE-POOLS : SLIS.
    INTERNAL TABLE FOR INVENTORY STOCK *****************
    DATA: BEGIN OF ITS1 OCCURS 0,
          MATNR LIKE ISEG-MATNR,
          MEINS LIKE ISEG-MEINS,
          MENGE LIKE ISEG-MENGE,
          WRTZL LIKE ISEG-WRTZL,
          BUCHM LIKE ISEG-BUCHM,
          WRTBM LIKE ISEG-WRTBM,
          WERKS LIKE ISEG-WERKS,
          BUDAT LIKE ISEG-BUDAT,
          MTART LIKE MARA-MTART,
          ITEMDESC LIKE MAKT-MAKTX,
          DIFFQTY LIKE ISEG-BUCHM,
          DIFFVALUE LIKE ISEG-WRTBM,
          END OF ITS1.
    data: t_heading type slis_t_listheader.
    SELECTION-SCREEN BEGIN OF BLOCK PAR1 WITH FRAME TITLE TEXT-001.
    *********PARAMETERS*********
    PARAMETERS : PLANT LIKE ISEG-WERKS OBLIGATORY.
    *********SELECTION SCREEN OPTIONS*********
    SELECT-OPTIONS : R_DATE FOR ISEG-BUDAT,
                     M_TYPE  FOR MARA-MTART,
                     IT_M FOR MARA-MATNR.
    *********DEFINING VARIABLES*********
      SELECTION-SCREEN END OF BLOCK par1.
    TOP-OF-PAGE.
         PERFORM PG_HEADER.
    START-OF-SELECTION.
    SELECT DISTINCT A~MATNR A~MEINS A~MENGE A~WRTZL A~BUCHM A~WRTBM A~WERKS A~BUDAT B~MTART
       FROM ISEG AS A INNER JOIN MARA AS B ON B~MATNR = A~MATNR
         INTO CORRESPONDING FIELDS OF TABLE ITS1 WHERE B~MATNR = A~MATNR  AND B~MEINS = A~MEINS AND A~WERKS = PLANT AND A~BUDAT IN R_DATE AND B~MTART IN M_TYPE AND B~MATNR IN IT_M.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
       INPUT = ITS1-MATNR
       IMPORTING
       OUTPUT = ITS1-MATNR.
      SORT ITS1 BY MATNR.
      DELETE ADJACENT DUPLICATES  FROM  ITS1 WHERE MENGE = 0 AND BUCHM = 0.
    LOOP AT ITS1.
         ITS1-DIFFQTY = ITS1-MENGE - ITS1-BUCHM.
         ITS1-DIFFVALUE = ITS1-WRTZL - ITS1-WRTBM.
         SELECT SINGLE MAKTX FROM MAKT INTO ITS1-ITEMDESC WHERE MATNR = ITS1-MATNR.
         MODIFY ITS1.
    ENDLOOP.
    PERFORM PRN_SMSTOCK_ALV.
    WRITING DATA FROM D TABLES**********
    FORM PG_HEADER.
    WRITE : 'PHYSICAL INVENTORY AUDIT REPORT             PLANT : ', PLANT.
    ENDFORM.
    *&      Form  PRN_SMSTOCK_ALV
          text
    -->  p1        text
    <--  p2        text
    form PRN_SMSTOCK_ALV .
    data: w_title   type lvc_title,
          w_repid   type syrepid,
          w_comm    type slis_formname,
          w_status  type slis_formname,
          x_layout  type slis_layout_alv,
          t_event    type slis_t_event,
          t_fieldcat type slis_t_fieldcat_alv,
          t_sort     type slis_t_sortinfo_alv.
    refresh t_fieldcat.
    refresh t_event.
    refresh t_sort.
    clear x_layout.
    clear w_title.
      perform set_fieldcat2 using:
    1  'MTART'     'MTART'     'MARA'  '15'  space 'MATERIAL TYPE'        space  space  space space space space space space SPACE t_fieldcat 'L' 'C',
    2  'MATNR'     'MATNR'     'MARA'  '13'  space 'MATERIAL NO. '        space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    3  'ITEMDESC'  'MAKTX'     'MAKT'  '25'  space 'MATERIAL DESCRIPTION' space  space  space space space space space space SPACE t_fieldcat 'L' 'C',
    4  'MEINS'     'MEINS'     'MARA'  '5'   space 'UOM'                  space  space  space space space space space space SPACE t_fieldcat 'C' 'C',
    5  'MENGE'     'MENGE'     'ISEG'  '13'  space 'ORG.INV.QTY'          space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    6  'WRTZL'     'WRTZL'     'ISEG'  '13'  space 'ORG.INV.VALUE'        space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    7  'BUCHM'     'BUCHM'     'ISEG'  '13'  space 'PHY.INV.QTY'          space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    8  'WRTBM'     'WRTBM'     'ISEG'  '13'  space 'PHY.INV.VALUE'        space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    9  'DIFFQTY'   'MENGE'     'ISEG'  '13'  space 'DIFF.INV.QTY'         space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    10 'DIFFVALUE' 'WRTZL'     'ISEG'  '13'  space 'DIFF.INV.VALUE'       space  space  space space space space space space SPACE t_fieldcat SPACE 'P'.
    x_layout-zebra = 'X'.
    perform set_top_page_heading using t_heading t_event.
    perform set_events using t_event.
      w_status = ''.
      w_repid = sy-repid.
      w_comm   = 'USER_COMMAND'.
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program       = w_repid
          it_fieldcat              = t_fieldcat
          i_Callback_top_of_page   = 'Top-of-page'
          is_layout                = x_layout
          it_sort                  = t_sort
          i_callback_pf_status_set = w_status
          i_callback_user_command  = w_comm
          i_save                   = 'X'
          it_events                = t_event
          i_grid_title             = w_title
          tables
          t_outtab                 = ITS1
        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.
    FORM set_fieldcat2 USING
          p_colpos p_fieldname p_ref_fieldname p_ref_tabname
          p_outputlen p_noout
          p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
          p_hotspot p_showasicon p_checkbox p_edit
          p_dosum
          t_fieldcat TYPE slis_t_fieldcat_alv
          P_JUST
          P_FTYPE.
      DATA: wa_fieldcat TYPE slis_fieldcat_alv.
      CLEAR wa_fieldcat.
    General settings
      wa_fieldcat-fieldname = p_fieldname.
    wa_fieldcat-no_zero = 'X'.
      wa_fieldcat-col_pos = p_colpos.
      wa_fieldcat-no_out = p_noout.
      wa_fieldcat-hotspot = p_hotspot.
      wa_fieldcat-checkbox = p_checkbox.
      wa_fieldcat-icon = p_showasicon.
      wa_fieldcat-do_sum = p_dosum.
    Set output length.
      IF NOT p_outputlen IS INITIAL.
        wa_fieldcat-outputlen = p_outputlen.
      ENDIF.
    Set text headers.
    IF NOT p_seltext_m IS INITIAL.
        wa_fieldcat-seltext_m = p_seltext_m.
    ENDIF.
    IF NOT p_seltext_l IS INITIAL.
        wa_fieldcat-seltext_l = p_seltext_l.
    ENDIF.
    IF NOT p_seltext_s IS INITIAL.
        wa_fieldcat-seltext_s = p_seltext_s.
    ENDIF.
      IF NOT p_reptext_ddic IS INITIAL.
        wa_fieldcat-reptext_ddic = p_reptext_ddic.
      ENDIF.
    IF NOT p_ddictxt IS INITIAL.
        wa_fieldcat-ddictxt = p_ddictxt.
    ENDIF.
      IF NOT P_JUST IS INITIAL.
        WA_FIELDCAT-JUST = P_JUST.
      ENDIF.
    Set as editable or not.
      IF NOT p_edit IS INITIAL.
        wa_fieldcat-input     = 'X'.
        wa_fieldcat-edit     = 'X'.
      ENDIF.
      APPEND wa_fieldcat TO t_fieldcat.
    ENDFORM.                   "set_fieldcat2
    ======================== Subroutines called by ALV ================
    *&      Form  top_of_page
          Called on top_of_page ALV event.
          Prints the heading.
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
         exporting
              it_list_commentary = t_heading.
    ENDFORM.
    form set_top_page_heading using t_heading type slis_t_listheader
                                    t_events  type slis_t_event.
    data: x_heading type slis_listheader,
          x_event   type line of slis_t_event.
    Report title
      clear t_heading[].
      clear x_heading.
      x_heading-typ = 'H'.
      x_heading-info = 'PHYSICAL INVENTORY AUDIT REPORT'.
      append x_heading to t_heading.
    Plant Name
    clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'PLANT: '.
      x_heading-info = its1-werks.
      append x_heading to t_heading.
    Posting Date
    *clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'POSTING DATE: '.
    x_heading-info = ITS1-BUDAT.
    append x_heading to t_heading.
    Control Date
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'CONTROL No: '.
    x_heading-info = its1-werks.
    append x_heading to t_heading.
    Control date
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'CONTROL DATE: '.
    x_heading-info = its1-werks.
    append x_heading to t_heading.
    User who is running the report
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'User: '.
    x_heading-info = sy-uname.
    append x_heading to t_heading.
    Date of execution
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'Date: '.
      write sy-datum to x_heading-info.
      append x_heading to t_heading.
    Time of execution
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'Time: '.
      write sy-uzeit to x_heading-info.
      append x_heading to t_heading.
    Top of page event
      x_event-name = slis_ev_top_of_page.
      x_event-form = 'TOP_OF_PAGE'.
      append x_event to t_events.
    endform.
    form set_events using t_events type slis_t_event.
    data: x_event   type line of slis_t_event.
    endform.
    plzzz help me out as it is most urgent to me.
    regards,
    ric.s

  • ALV Excel download problem

    Hi,
    I am trying to download ALV report to excel but the columns in the o/p is appearing in two rows.
    THe ALV report has 82 columns in o/p.Is there any restriction on the no of columns that can be downloaded in excel.Please help.
    Thanks,
    Sutapa.

    Hi Sutapa,
    Kindly go through this link below for ALV Excel Download:
    Re: how to view alv grid output in excel format(not downloading to pc)
    Hope it helps
    Regrds
    Mansi

  • Alv report downloading

    Dear Experts,
                         I'm using one push button in alv report, for downloading., the report, when i click on that push button a popup should appear for saving that file.
    Thanks and Regards,
    Thirukumaran. R

    CASE lv_ucomm.
    WHEN '&DLOAD'. "Double Click line Item
      CALL METHOD cl_gui_frontend_services=>directory_browse
       EXPORTING
         window_title         = 'Select path for saving excel file'
         initial_folder       = 'c:\'
       CHANGING
         selected_folder      = filename.
    concatenate filename '\NEFT_Report.txt' INTO filename.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        filename                        = filename"'d:\test2.xls'"
       FILETYPE                        = 'DAT'
      APPEND                          = ' '
       WRITE_FIELD_SEPARATOR           = 'X'
         tables
        data_tab                        = it_final_1.

  • ALV Report Print Problem.

    Hi,
    When I Print any ALV Report then In the First Row BackColor is white,
    but in Second it is Gray,and this alternative for all remaining rows,
    How Can I SET it to White For ALL Rows.
    Thx,
    Hitesh Jain.

    Hi Jain,
    I'm not aware of a way to wrap the test or set break points in an ALV report.  Typically I just try to reduce the number of columns to print and determine if the data is truly needed or just redundant.
    To change the font, you need to change the Format setting.  This setting is in the same popup box I described earlier.  This time under General Properties, double click on Format.  Just play around with the different Format options loaded.  If you need additional formats, you should work with your BASIS team because it depends on the Output Devices that are loaded in your system. 
    Otherwise, you may just need to export the ALV report into Excel to make it "pretty".  In Excel, you could create a macro to automate your formatting steps.  Just a thought.
    Good luck,
    Cindy

  • ALV Report Print problem after 255 character line size

    Hi ABAP Gurus,
    I have created one alv report where i am getting output more then 255 character line size.
    so whenever i tried to print this report it print only line upto first 255 character and truncated after it in printing.
    is there any way i can print this report without truncation ....
    Thanks,
    Jack

    no there is no such way because you acan print at most 99 columns and utmost 255 characters .
    and alternative is take your filed in separate screen and make it appear through hotspot in another filedcatalog.then u will get more space .
    reward if useful
    keep rockin
    vivek

  • ALV report Cursor problem

    Hi All,
             I am working on ALV report. In that I am displying 20 columns. I am taking the first column for selecting row.
    Suppose I have field1, 2 ,3 etc.
    when i click on any field it will display the field description popup. It is working fine.After that in that popup, when i cancel it, the cursor is still on the selected field. I need the cursor to goto first column. Can anybody please help me out in this?
    Thanks,
    Ravi

    Hi,
    Use the following syntax,
    SET CURSOR FIELD <fname>.
    Thanks,
    Bhanu
    Edited by: Bhanu  P on Feb 3, 2008 6:17 AM

  • ALV Report  Format Problem

    Hi Experts
    I am writing an ALV report for the following report below , I am not getting the output in the internal table
    can anyone correct please
    regards
    Piroz
    REPORT Z_ROLE LINE-SIZE  220 LINE-COUNT 75
             NO STANDARD PAGE HEADING.
    TABLES : agr_tcodes,
             agr_users,
             tstct.
    TYPE-POOLS : slis.        
    DATA: repid LIKE sy-repid, "Report ID
    is_layout TYPE slis_layout_alv, "Layout For ALV
    it_fieldcat TYPE slis_t_fieldcat_alv, "ITAB for field
    it_events TYPE slis_t_event, "ITAB for event
    it_sub TYPE slis_layout_alv_spec1, "subtotals
    i_header TYPE slis_t_listheader, "Itab for listheader
    lt_sort TYPE slis_t_sortinfo_alv, "itab for sorting
    wa_sort LIKE LINE OF lt_sort." slis_t_sortinfo_alv.        
    DATA:  BEGIN OF itab OCCURS 0  ,
             agr_tcodes type agr_tcodes-tcode ,        " Transaction code     A
             agr_name   type agr_tcodes-agr_name,      " Role Name            B
           END OF itab .
    DATA:  BEGIN of it_disp Occurs 0 ,
             agr_tcodes type agr_tcodes-tcode ,        " Transaction code     A
             agr_name   type agr_tcodes-agr_name,      " Role Name            B
             agr_uname  type agr_users-uname,          "  Short User Name     B
             ttext      type tstct-ttext,              "  Description Name    C
             sprsl      type tstct-sprsl ,             "  Language            c
           END OF it_disp.
    *DATA: i_data TYPE TABLE OF ty_data, " internal table
    *wa_data TYPE ty_data. " work area
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: p_tcode FOR agr_tcodes-tcode OBLIGATORY, "no-extension no intervals,
                    u_name  for agr_users-uname,
                    r_name for agr_users-uname .
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN END OF BLOCK blk2.
    SELECTION-SCREEN END OF BLOCK blk.
    START-OF-SELECTION.
    PERFORM get_data.
    PERFORM modify_data.
    PERFORM disp_data .
    END-OF-SELECTION.
    *& Form get_data
    text
    --> p1 text
    <-- p2 text
    FORM get_data .
    select agr_tcodestcode agr_tcodesagr_name agr_usersuname  tstctttext tstct~sprsl
    into table it_disp
    from agr_tcodes
    inner join agr_users
    on agr_tcodesagr_name = agr_usersagr_name
    inner join tstct
    on agr_tcodestcode = tstcttcode
    and
    tstct~sprsl eq 'E'.
    ENDFORM. "get_data
    *& Form modify_data
    text
    --> p1 text
    <-- p2 text
    FORM modify_data .
    MOVE-CORRESPONDING itab TO it_disp.
    APPEND it_disp.
    CLEAR it_disp.
    ENDFORM. " modify_data
    *& Form Disp_data
    text
    --> p1 text
    <-- p2 text
    FORM disp_data .
    PERFORM fill_layout_structure.
    PERFORM fill_field_catalog_table.
    PERFORM alv_header USING i_header.
    PERFORM call_alv_function.
    ENDFORM. " Disp_data
    *& Form fill_layout_structure
    text
    --> p1 text
    <-- p2 text
    FORM fill_layout_structure .
    CLEAR is_layout.
    is_layout-colwidth_optimize = 'X'.
    is_layout-zebra = 'X'.
    is_layout-no_input = 'X'.
    is_layout-colwidth_optimize = 'X'.
    is_layout-totals_text = 'Totals'(201).
    is_layout-totals_only = 'X'.
    is_layout-zebra = 'X'.
    is_layout-group_change_edit = 'X'.
    is_layout-header_text = 'Wagners Users Transaction Code'.
    ENDFORM. " fill_layout_structure
    *& Form fill_field_catalog_table
    text
    --> p1 text
    <-- p2 text
    FORM fill_field_catalog_table .
    DATA : gls1(10).
    BREAK-POINT.
    PERFORM fill_field_catalog USING :
    'agr_tcode' 'Trans Code .' '10' 'IT_DISP' space space 'C11' ' ' ' ',
    'agr_name' 'Name' '40' 'IT_FINAL' space space 'C11' ' ' ' ' ,
    'agr_uname' 'Role' '60' 'IT_FINAL' space space 'C11' 'X' ' ',
    'ttext' 'Descript' '80' 'IT_FINAL' space space 'C11' ' ' ' '.
    ENDFORM. " fill_field_catalog_table
    *& Form fill_field_catalog
    text
    FORM fill_field_catalog USING f d l t s z y a b.
    DATA t_fld TYPE slis_fieldcat_alv.
    STATICS pos LIKE sy-index VALUE 0.
    pos = pos + 1. 
    CLEAR t_fld.
    MOVE 1 TO t_fld-row_pos.
    MOVE pos TO t_fld-col_pos.
    MOVE f TO t_fld-fieldname.
    MOVE d TO t_fld-seltext_m.
    MOVE l TO t_fld-outputlen.
    MOVE t TO t_fld-tabname.
    MOVE s TO t_fld-do_sum.
    MOVE z TO t_fld-no_zero.
    MOVE y TO t_fld-emphasize.
    MOVE a TO t_fld-no_out.
    MOVE b TO t_fld-no_sum.
    APPEND t_fld TO it_fieldcat.
    ENDFORM. " fill_field_catalog
    *& Form alv_header
    text
    -->P_I_HEADER text
    FORM alv_header USING p_i_header.
    DATA: wa_line TYPE slis_listheader.
    CLEAR wa_line.
    wa_line-typ = 'H'.
    wa_line-info = 'Wagners Investment'.
    APPEND wa_line TO i_header.
    ENDFORM. " alv_header
    *& Form call_alv_function
    text
    --> p1 text
    <-- p2 text
    FORM call_alv_function .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    IS_LAYOUT = IS_LAYOUT
    IT_FIELDCAT = IT_FIELDCAT
    TABLES
    t_outtab = IT_DISP.
    IF sy-subrc eq 0.
    ENDIF.
    ENDFORM. " call_alv_function

    Hi Venkat
    Thanks a lot for correcting and sending me the format , Now I can manage to change the other reports too.
    I have one more report which is bashing my head like anything , This is basically a fuel calculation report for managment , I want to change this too in ALV FORMAT, I did all my efforts to correct but it is looping inside as i close the report.
    Thanks in Advanced
    REPORT Z_ESLP_ZFCR1 LINE-SIZE  220 LINE-COUNT 75
             NO STANDARD PAGE HEADING.
    TABLES : equi,
    equz,
    imptt,
    imrg,
    eqkt,
    iloa.
    type-pools: slis. "ALV Declarations
    *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.
    TYPES: BEGIN OF ty_data ,
    equnr type equnr, " Euipment no
    eqktx type eqkt-eqktx, " Equipment Text
    eqfnr type iloa-eqfnr, " Equipment Sort field
    idate type imrg-idate, " Measuring Date
    recdu type imrg-recdu, " Unit of measuring ='KM','L','H'
    recdv type imrg-recdv, " Counter reading data
    cancl type imrg-cancl,
    END OF ty_data.
    TYPES: BEGIN OF ty_final,
    equnr type equnr, " Equipment no
    eqktx type eqkt-eqktx, " Equipment Text
    eqfnr type iloa-eqfnr, " Equipment Sort field
    idate type imrg-idate, " Measuring Date
    min_date_km type imrg-idate, " Min Date
    min_km type P DECIMALS 2, " Max Km
    max_date_km type imrg-idate,
    max_km type P DECIMALS 2, " Min km
    t_max_min_km type P DECIMALS 2, " Total min_km-max_km
    min_date_hr type imrg-idate, " Max Date
    min_hr type P DECIMALS 2, " Max hr
    max_date_hr type imrg-idate,
    max_hr type P DECIMALS 2, " Min hr
    t_max_min_hr type P DECIMALS 2, " Total min_hr-max_hr
    min_date_lit type imrg-idate,
    min_lit type P DECIMALS 2, " Min lit
    max_date_lit type imrg-idate,
    max_lit type P DECIMALS 2, " Max lit
    fuel_con type imrg-recdv, " Total_hrs / t_max_min_hr
    fuel_con2 type P DECIMALS 2, " Total_hrs / t_max_min_hr
    km_l type P DECIMALS 2, " t max_min_km / t_max_min_lit
    l_p type P DECIMALS 2 , " t_max_min_lit / t_max_min_hr
    l_p2 type P DECIMALS 2 ,
    END OF ty_final.
    DATA: i_data TYPE TABLE OF ty_data, " internal table
    wa_data TYPE ty_data, " work area
    i_final TYPE TABLE OF ty_final, " internal table
    wa_final TYPE ty_final. " work area
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: p_equnr FOR equi-equnr OBLIGATORY, "no-extension no intervals,
    p_idate FOR imrg-idate. "NO-EXTENSION NO INTERVALS OBLIGATORY,
    "p_recdu FOR imrg-recdu." NO-EXTENSION NO INTERVALS ."default 'M3'" OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN END OF BLOCK blk2.
    SELECTION-SCREEN END OF BLOCK blk.
    TOP-OF-PAGE.
    FORMAT INTENSIFIED ON.
    WRITE:/55(40) ' WAGNERS INVESTMENT LIMITED '.
    WRITE:/50(40) ' VEHICLE FUEL CONSUMPTION REPORT ' CENTERED ,
    2 'Page', sy-pagno.
    FORMAT INTENSIFIED OFF.
    WRITE:/50(40) '----
    ' CENTERED .
    FORMAT INTENSIFIED ON.
    WRITE:/2 sy-datum COLOR 3, sy-uzeit .
    "WRITE:/1 S903-SPMON ."p_yearf.
    ULINE.
    "CENTERED.
    write: /2 'Equipment No :'left-justified,p_equnr-low color 2 , ' to ' , p_equnr-high color 2.
    write: /2 'Date From :', p_idate-low color 2 , ' to ' , p_idate-high color 2.
    END-OF-PAGE.
    START-OF-SELECTION.
    select aequnr deqktx feqfnr eidate erecdu erecdv
    into table i_data
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate and
    e~cancl ne 'X'.
    loop at i_data into wa_data.
    CLEAR: wa_final.
    READ TABLE i_final into wa_final
    with key equnr = wa_data-equnr." BINARY SEARCH.
    if sy-subrc EQ 0.
    PERFORM F_GET_MAX_DATA.
    PERFORM F_GET_MAX_HOURS.
    PERFORM F_GET_MAX_LIT.
    PERFORM prepare_final_rec USING'M'. " Modify Existing Record
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    ElSE.
    PERFORM prepare_final_rec USING'A'. " Append New Record.
    ENDIF.
    ENDLOOP.
    LOOP AT i_final into wa_final.
    on change of wa_final-equnr.
    perform build_fieldcatalog.
    endon.
    uline.
    endloop.
    refresh i_final.
    clear i_final.
    FORM F_GET_MAX_DATA.
    select single MAX( eidate ) Min( eidate ) MAX( erecdv ) MIN( erecdv )
    into corresponding fields of (wa_final-max_date_km,wa_final-min_date_km,wa_final-max_km ,wa_final-min_km)
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate
    and
    e~cancl ne 'X' and
    e~recdu = 'KM'
    AND a~equnr = wa_data-equnr.
    ENDFORM.
    FORM F_GET_MAX_HOURS.
    select single MAX( erecdv ) MIN( erecdv )
    into corresponding fields of (wa_final-max_hr, wa_final-min_hr)
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate
    and
    e~cancl ne 'X' and
    e~recdu = 'H'
    AND a~equnr = wa_data-equnr .
    ENDFORM.
    FORM F_GET_MAX_LIT.
    select SUM( e~recdv )
    into corresponding fields of (wa_final-fuel_con2)
    from equi AS a
    inner join eqkt as b
    on bequnr = aequnr
    inner join imptt as c
    on cmpobj = aobjnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate
    and
    e~cancl ne 'X' and
    e~recdu = 'L'
    AND a~equnr = wa_data-equnr.
    ENDFORM.
    FORM prepare_final_rec USING p_mode TYPE char1.
    wa_final-t_max_min_km = wa_final-max_km - wa_final-min_km .
    wa_final-t_max_min_hr = wa_final-max_hr - wa_final-min_hr.
    if wa_final-t_max_min_km eq 0 .
    wa_final-km_l = ( wa_final-max_km - wa_final-min_km ) / ( wa_final-fuel_con2 ) .
    ELSE.
    wa_final-km_l = 0.
    endif.
    if wa_final-t_max_min_hr eq 0 .
    wa_final-l_p2 = ( wa_final-fuel_con2 ) / ( wa_final-t_max_min_hr ) .
    ELSE.
    wa_final-l_p2 = 0.
    endif.
    IF p_mode = 'A'.
    wa_final-equnr = wa_data-equnr.
    wa_final-eqktx = wa_data-eqktx.
    wa_final-eqfnr = wa_data-eqfnr.
    wa_final-t_max_min_km = wa_final-min_km - wa_final-max_km .
    wa_final-t_max_min_hr = wa_final-max_hr - wa_final-min_hr.
    wa_final-km_l = ( wa_final-max_km - wa_final-min_km ) / ( wa_final-fuel_con2 ).
    wa_final-l_p2 = ( wa_final-fuel_con2 ) / ( wa_final-t_max_min_hr ) .
    APPEND wa_final TO i_final .
    ELSE.
    MODIFY i_final FROM wa_final
    TRANSPORTING
    eqfnr
    max_date_km
    min_date_km
    max_date_lit
    min_date_lit
    max_date_hr
    min_date_hr
    max_km
    min_km
    max_hr
    min_hr
    t_max_min_km
    t_max_min_hr
    fuel_con2
    km_l
    l_p2
    where equnr = wa_data-equnr.
    ENDIF.
    ENDFORM. " PREPARE_FINAL_REC
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    I.e. Field type may be required in-order for
    the 'TOTAL' function to work.
    fieldcatalog-fieldname = 'EQUNR'.
    fieldcatalog-seltext_m = 'Equip no'.
    fieldcatalog-tabname = 'i_final'.
    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 = 'EQKTX'.
    fieldcatalog-seltext_m = 'Description'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 1.
    fieldcatalog-outputlen = 40.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'EQFNR'.
    fieldcatalog-seltext_m = 'Sortfield'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 2.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MIN_DATE_KM'.
    fieldcatalog-seltext_m = 'Min Date'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 3.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MAX_DATE_KM'.
    fieldcatalog-seltext_m = 'Max Date'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 4.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MIN_KM' .
    fieldcatalog-seltext_m = 'Min KM'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 5.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MAX_KM' .
    fieldcatalog-seltext_m = 'Max KM'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 6.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'T_MAX_MIN_KM' .
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-seltext_m = 'Total KM'.
    fieldcatalog-col_pos = 7.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MIN_HR' .
    fieldcatalog-seltext_m = 'Min Hr'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 8.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MAX_HR' .
    fieldcatalog-seltext_m = 'Max Hr'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 9.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'T_MAX_MIN_HR' .
    fieldcatalog-seltext_m = 'Total HR'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 10.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'FUEL_CON2' .
    fieldcatalog-seltext_m = 'Fuel'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 11.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'KM_L' .
    fieldcatalog-seltext_m = 'Km/L'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 12.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'L_P2' .
    fieldcatalog-seltext_m = 'Lit/HR'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 13.
    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_XEVENTS
    i_save = 'X'
    is_variant = z_template
    tables
    t_outtab = i_final
    exceptions
    program_error = 1
    others = 2.
    if sy-subrc eq 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

  • Export option in ALV report downloades first two columns blank

    Hi ,
    Before posting this query I searched the solution in SDN but I did't find the solution.
    My problem is  After displaying report in ALV format ,if I press Export --> Local file --->spreadsheet ;  file will downloaded to excel sheet but first two columns(only heading no data ) will be blank  and next two columns with proper data.
    I checked field catalog defination it seems to be ok,  any other mistake ?
    Please suggest.
    Narayan

    Hi
    It's the option you have in the path System->List->Save->Local file
    I means it's the standard option to export an abap list into a local file, so you should try this path too and check if the resul it's the same
    I think you should choose  Export --->spreadsheet: here before saving the file an excel document will be open
    Max

  • ALV report Download to excel from portal

    Hi,
    We have a standard SAP ALV reprot (CATS_DA) which we have brouht onto the portal. We are not abel to download this report in excel foramt. This is not giving any errors. The option is just not working at all. HAs anybody come across thsi issue?
    regards
    Raj

    Hi Raj,
    are you using DOWNLOAD function?
    I am also having the same problem. It is working fine in LAPTOP and not working in Desktop.
    There may be some system settings or javascript issues.
    I will try that in desktop.
    Thanks and regards,
    gopal

  • Alv report print problems

    Hi all
    I have a problem when i print my alv grid report it first prints the title page then the revelent pages can i remove that title page.
    thanks

    have you checked with your windows administrator??

  • ALV Excel Download problem ( Special Character)

    Hi,
    I am unable to download completely in XLS format from ALV grid. When i tried in couple of ways there is a special character( " ) in one of the filed. Due to the same Excel download has some problem. I tested by removing those and it worked fine, 
    Please suggest me to solve the issue.
    Thanks,
    Bhanu Gattu,

    Data strings with special characters can not be downloaded into XLS format from ALV grid. In my case, I replaced the special character " with space and I could download the data into excel.

  • Z report downloading problem

    One of our user has installed office 2007. Previously user was using 2003.
    While user want to download data for report ZMM60 he gets know data.
    While I am  using 2003 I was able to download and see data in that. User get only blank excelsheet.
    Does anyone face this problem. Also please confirm what will be resolution.

    dont look only for the answered star on a thread, I guess 80 % of all threads will not get this status even they are solved
    Please try the following steps to resolve this Issue. I dont have the link else search on office help on microsoft website.
    Pushyamithra posted:
    1. go to Menu -> Excel Options By opening excel & click on top left icon shaped in squares to show excel options)
    2. Select Trust center --> trust center settings.
    3. Choose Add-ins and enable require Application Add-ins
    4. Choose Active X settings and enable all controls without restrictions and enable safe mode options
    5. Choose Macro settings & enable all Macros and enable trust Access to VBA project object model
    6.choose message bar settings and enable show message bar options
    7.choose external content settings and enable all data connections and enable automatic update for all workbook
    8.click ok & save the settings.
    9. got to Popular uncheck the Enable Live preview Box.
    & reopen excel & test it should work, we had come across this problem & found the solution somewhere on microsoft office 2007 help, do a quick search & you would be able to get the steps as well.
    let me know if it worked for you
    Thanks..
    And Mads answered in response to: Pushyamithra
    This did the trick for me - thanx for the post!!
    as it was not Mads thread, he could not close it. And the  tread owner did not do it.

Maybe you are looking for

  • "Learn" no longer working with Euphonix?

    I've been messing around some more with Euphonix hardware. It seems that since there was 'native support' with Eucontrol 2.5.5 and with LP 9.1.1 there is no ability to assign values to the controls. This means that Command-L no longer appears to work

  • Error while updating webcache

    Hi, When i tried to add a Listening Port (80) through the webcache admin URL.On submit it gives an error stating "Cannot open configuration output file". Any suggestion on that. Thanks in advance. Adarsh

  • File failing with ICM_HTTP_CONNECTION_BROKEN error in SAP PI

    Hi Expert, We have file to proxy senario in our production environment where, while sending the file from PI to ECC syestem via proxy, it fails below with error in call adapter step. Have tried with many options mentioned in scn.sap.com site like 1.

  • Authorization object of a query

    Hi All, How can we check the authorization objects of a particular query? Means... I have one query. I have to find out the authorization objects of this query. Where can we find the authorization objects of this query? How can we find out the author

  • Firefox isn't autofilling saved passwords.

    My logins and passwords have been saved but are not being loaded into their fields. This problem started about a week ago. The passwords went from loading normally, to a blank field but if I down arrowed the login name was present and after choosing