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

Similar Messages

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

  • 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

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

  • Problem in alv report output

    Hi friends,
    i have created alv report .no problem of getting output . but i m getting question mark in the standard menu. it is displaying 10 question mark (sub menu has print preview etc), edit ,question marks(ABC Analysis) ,question marks (abap list viewer etc ), settings ,system , help.
    i don't want these question marks. how to candle this.i haven't moved to test or production , but iwant  to know  in development  why it is coming..
    if any one knows please let me know.
    thanks and regards,
    kani.

    The Problem is with some GUI inconsistency.
    to overcome there are 2 solutions.
    1. You need to run a program Which i don't remember exactly.
    2. Using the Status event.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
        i_callback_program = sy-repid
        it_fieldcat        = it_fieldcat
    I_CALLBACK_PF_STATUS_SET = 'STATUS'  "important
        it_sort            = it_sort
      TABLES
        t_outtab           = it_data
      EXCEPTIONS
        program_error      = 1.
    form status using extab tyoe slis_t_extab.
    "This status you can set using the program SAPLKKBL
    " go to se41 transaction, enter the program name SAPLKKBL
    "status as STANDARD , and click the Button Copy status
    "Now in the popup for Option to enter your program name and
    "press ok, then save and activate the status
    "now come here and activate the code and test now..
    set pf-status 'STANDARD' excluding extab.
    endform.

  • Problem in ALV report

    Hi Friends,
    I have the following 2 problems in ALV report
    1) Logo is not getting displayed in the report.
    2) When i click on the Purchase order number in the report  the interactive report is not working,i am not able to see report of First interactive level.
    can you help it out friends.
    Thanks and regards
    Dinesh
    REPORT  YSDBALV1
    tables: ekko , ekpo .
    type-pools: slis .
    Table for Display Header
    data:i_header type slis_t_listheader with header line.
    *Fieldcat Declaration
    data:fieldcatalog type slis_T_fieldcat_alv  WITH HEADER LINE.
    *Table of Events
    data:i_event type slis_t_event with header line .
    For Layout
    data:i_layout type slis_layout_alv .
    data: text(30) .
    *Internal Table Declaration
    data: begin of it_final occurs 0 ,
          ebeln like ekko-ebeln ,           "Purchasing Document No.
          bedat like ekko-bedat ,           "Purchasing Document Date
          matnr like ekpo-matnr ,           "Material No.
          netwr like ekpo-netwr ,         "Net Order Value in PO Currancy
          meins like ekpo-meins ,           "UOM
          chk(1) ,
          light(1) ,
          change like ekpo-menge ,
          end of it_final .
    **select option Declaration
    selection-screen begin of block block.
    select-options: s_ebeln for ekko-ebeln  .
    selection-screen end of block block .
    selection-screen begin of block block1 .
    parameters:grid radiobutton group r .
    parameters:list radiobutton group r .
    selection-screen end of block block1 .
    at selection screen
    at selection-screen .
    select single * from ekko where ebeln in s_ebeln .
    if sy-subrc <> 0 .
       message e000(8I) WITH 'No Data Exists' .
    endif .
    start-of-selection .
    if grid = 'X' .
    perform get_data .
    perform event using i_event[] .
    perform field using fieldcatalog[] .
    perform layout using i_layout .
    perform grid_display .
    endif .
    *&      Form  get_data
          text
    -->  p1        text
    <--  p2        text
    form get_data .
    *DATA Retrieval from tables
    SELECT EKKO~EBELN
           EKKO~BEDAT
           EKPO~EBELP
           EKPO~MATNR
           EKPO~NETWR
           EKPO~MEINS
           EKPO~MENGE
           EKPO~BPRME
           INTO CORRESPONDING FIELDS OF  table IT_FINAL
           FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
           WHERE EKKO~EBELN IN S_EBELN.
           APPEND IT_FINAL.
    endform.                    " get_data
    *Getting the Event for Top of Page display.
    *&      Form  event
          text
         -->P_I_event[]  text
    form event  using    p_i_event type slis_t_event.
      clear p_i_event .
      refresh p_i_event .
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = p_i_event
    EXCEPTIONS
       LIST_TYPE_WRONG       = 1
       OTHERS                = 2
    read table p_i_event with key name = slis_ev_top_of_page into i_event.
          if sy-subrc = 0.
                 move 'TOP_OF_PAGE_PO' to i_event-form.
                 modify p_i_event from i_event index sy-tabix transporting form.
          endif.
          clear i_event.
    endform.                    " event
    *Display Top-of –Page Details and Logo
    form top_of_page_po .
           clear i_header .
           refresh i_header .
           write sy-datum to text.
           i_header-typ = 'H'.
           i_header-info = 'PURCHASE OREDER DETAILS'.
           append i_header.
          *Logo Display
          CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
                 EXPORTING
                     it_list_commentary       = i_header[]
                     I_LOGO                   = 'ENJOYSAPLOGO'.
    endform .
    *Field Catalog Append
    *&      Form  field
          text
         -->P_fieldCATALOG[]  text
    form field using  p_fieldcatalog type slis_t_fieldcat_alv.
         clear fieldcatalog.
          fieldcatalog-fieldname   = 'EBELN'.
          fieldcatalog-seltext_m   = 'Purchase Order No'.
          fieldcatalog-col_pos     = 1.
          append fieldcatalog .
          clear fieldcatalog.
          fieldcatalog-fieldname   = 'BEDAT'.
          fieldcatalog-seltext_m   = 'PO Date'.
          fieldcatalog-col_pos     = 2.
          append fieldcatalog .
          clear fieldcatalog.
          fieldcatalog-fieldname   = 'MATNR'.
          fieldcatalog-seltext_m   = 'Material No'.
          fieldcatalog-col_pos     = 4.
          fieldcatalog-outputlen   = 20.
          append fieldcatalog .
          clear fieldcatalog.
          fieldcatalog-fieldname   = 'NETWR'.
          fieldcatalog-seltext_m   = 'Net Value '.
          fieldcatalog-col_pos     = 5.
          fieldcatalog-outputlen   = 20.
          fieldcatalog-do_sum = 'X'.
          append fieldcatalog .
          clear fieldcatalog.
          fieldcatalog-fieldname   = 'MEINS'.
          fieldcatalog-seltext_m   = 'Units'.
          fieldcatalog-col_pos     = 6.
          fieldcatalog-outputlen   = 4.
          append fieldcatalog .
          clear fieldcatalog.
    endform.                    " field
    *&      Form  layout
          text
    form layout  using    p_i_layout TYPE SLIS_LAYOUT_ALV .
    i_layout-zebra  = 'X'.
        i_layout-lights_fieldname = 'LIGHT'.
        i_layout-lights_tabname = 'IT_FINAL'.
        i_layout-box_fieldname = 'CHK'.
        i_layout-box_tabname  = 'IT_FINAL'.
        i_layout-edit = ' '.
    endform.
    *To display Buttons in the MENU BAR if needed
    FORM SET_PO_PF_STATUS USING  P_I_EXTAB TYPE
                     SLIS_T_EXTAB.
                     SET PF-STATUS 'MENUPO'.
      ENDFORM.
    *Event for Interactive display of ALV report
    form USER_COMMAND  using r_ucomm like sy-ucomm
                             rs_selfield type slis_selfield .
      if r_ucomm = '&IC1'.
      READ TABLE IT_FINAL  index   rs_selfield-tabindex.
      write:/ IT_FINAL-ebeln.
      endif.
    endform .
    *Parameters of FM  REUSE_ALV_GRID_DISPLAY
    *&      Form  grid_display
          text
    -->  p1        text
    <--  p2        text
    form grid_display .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM                = SY-REPID
       I_CALLBACK_PF_STATUS_SET          = 'SET_PO_PF_STATUS'
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
        IS_LAYOUT                         = I_LAYOUT
        IT_FIELDCAT                       = FIELDCATALOG[]
        IT_EVENTS                         = I_EVENT[]
      TABLES
        t_outtab                          = IT_FINAL.
    endform.                    " grid_display

    *& Report  YSDBALV1
    REPORT  YSDBALV1.
    tables: ekko , ekpo .
    type-pools: slis .
    Table for Display Header
    data:i_header type slis_t_listheader with header line.
    *Fieldcat Declaration
    data:fieldcatalog type slis_T_fieldcat_alv WITH HEADER LINE.
    *Table of Events
    data:i_event type slis_t_event with header line ,
         wa_event type line of slis_t_event.
    For Layout
    data:i_layout type slis_layout_alv .
    data: text(30) .
    *Internal Table Declaration
    data: begin of it_final occurs 0 ,
    ebeln like ekko-ebeln , "Purchasing Document No.
    bedat like ekko-bedat , "Purchasing Document Date
    matnr like ekpo-matnr , "Material No.
    netwr like ekpo-netwr , "Net Order Value in PO Currancy
    meins like ekpo-meins , "UOM
    chk(1) ,
    light(1) ,
    change like ekpo-menge ,
    end of it_final .
    **select option Declaration
    selection-screen begin of block block.
    select-options: s_ebeln for ekko-ebeln .
    selection-screen end of block block .
    selection-screen begin of block block1 .
    parameters:grid radiobutton group r .
    parameters:list radiobutton group r .
    selection-screen end of block block1 .
    at selection screen
    at selection-screen .
    select single * from ekko where ebeln in s_ebeln .
    if sy-subrc <> 0 .
    message e000(8I) WITH 'No Data Exists' .
    endif .
    start-of-selection .
    if grid = 'X' .
    perform get_data .
    perform event using i_event[] .
    perform field using fieldcatalog[] .
    perform layout using i_layout .
    perform grid_display .
    endif .
    *& Form get_data
    text
    --> p1 text
    <-- p2 text
    form get_data .
    *DATA Retrieval from tables
    SELECT EKKO~EBELN
    EKKO~BEDAT
    EKPO~EBELP
    EKPO~MATNR
    EKPO~NETWR
    EKPO~MEINS
    EKPO~MENGE
    EKPO~BPRME
    INTO CORRESPONDING FIELDS OF table IT_FINAL
    FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
    WHERE EKKO~EBELN IN S_EBELN.
    APPEND IT_FINAL.
    endform. " get_data
    *Getting the Event for Top of Page display.
    *& Form event
    text
    -->P_I_event[] text
    form event using p_i_event type slis_t_event.
    clear p_i_event .
    refresh p_i_event .
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = p_i_event.
    EXCEPTIONS
    LIST_TYPE_WRONG = 1
    OTHERS = 2.
    read table p_i_event with key name = slis_ev_top_of_page into wa_event.
    if sy-subrc = 0.
    move 'TOP_OF_PAGE_PO' to i_event-form.
    modify p_i_event from i_event index sy-tabix transporting form.
    endif.
    clear i_event.
    endform. " event
    *Display Top-of –Page Details and Logo
    form top_of_page_po .
    clear i_header .
    refresh i_header .
    write sy-datum to text.
    i_header-typ = 'H'.
    i_header-info = 'PURCHASE OREDER DETAILS'.
    append i_header.
    *Logo Display
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = i_header[]
    I_LOGO = 'ENJOYSAP_LOGO'.
    endform .
    *Field Catalog Append
    *& Form field
    text
    -->P_fieldCATALOG[] text
    form field using p_fieldcatalog type slis_t_fieldcat_alv.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'EBELN'.
    fieldcatalog-seltext_m = 'Purchase Order No'.
    fieldcatalog-col_pos = 1.
    append fieldcatalog .
    clear fieldcatalog.
    fieldcatalog-fieldname = 'BEDAT'.
    fieldcatalog-seltext_m = 'PO Date'.
    fieldcatalog-col_pos = 2.
    append fieldcatalog .
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MATNR'.
    fieldcatalog-seltext_m = 'Material No'.
    fieldcatalog-col_pos = 4.
    fieldcatalog-outputlen = 20.
    append fieldcatalog .
    clear fieldcatalog.
    fieldcatalog-fieldname = 'NETWR'.
    fieldcatalog-seltext_m = 'Net Value '.
    fieldcatalog-col_pos = 5.
    fieldcatalog-outputlen = 20.
    fieldcatalog-do_sum = 'X'.
    append fieldcatalog .
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MEINS'.
    fieldcatalog-seltext_m = 'Units'.
    fieldcatalog-col_pos = 6.
    fieldcatalog-outputlen = 4.
    append fieldcatalog .
    clear fieldcatalog.
    endform. " field
    *& Form layout
    text
    form layout using p_i_layout TYPE SLIS_LAYOUT_ALV .
    i_layout-zebra = 'X'.
    i_layout-lights_fieldname = 'LIGHT'.
    i_layout-lights_tabname = 'IT_FINAL'.
    i_layout-box_fieldname = 'CHK'.
    i_layout-box_tabname = 'IT_FINAL'.
    i_layout-edit = ' '.
    endform.
    *To display Buttons in the MENU BAR if needed
    FORM SET_PO_PF_STATUS USING P_I_EXTAB TYPE
    SLIS_T_EXTAB.
    SET PF-STATUS 'MENUPO'.
    ENDFORM.
    *Event for Interactive display of ALV report
    form USER_COMMAND using r_ucomm like sy-ucomm
    rs_selfield type slis_selfield .
    if r_ucomm = '&IC1'.
    READ TABLE IT_FINAL index rs_selfield-tabindex.
    set parameter id 'VL1' field it_final-ebeln.
    call transaction 'ME23N'.
    endif.
    endform .
    *Parameters of FM REUSE_ALV_GRID_DISPLAY
    *& Form grid_display
    text
    --> p1 text
    <-- p2 text
    form grid_display .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_PF_STATUS_SET = 'SET_PO_PF_STATUS'
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    IS_LAYOUT = I_LAYOUT
    IT_FIELDCAT = FIELDCATALOG[]
    IT_EVENTS = I_EVENT[]
    TABLES
    t_outtab = IT_FINAL.
    endform. " grid_display
    Regards,
    Rusidar S.

  • OOP ALV report custom control performance problem

    HI
    how to write OOP ALV report without custom control.. Actually with custom control which taking long time... and time out happens for huge selection of data..
    Regards
    Roops.

    timeout is not an alv problem. If you try to display a "huge" amount of data, any display technology will fail. Even sap programs fail, their wise solution is to ask user to restrict data to be displayed. Or reduce database selection time, or display amount. Or propose the user to download data as a spool, or output to a file on server.
    Otherwise, read some advices about how to handle timeout in [Note 25528 - Parameter rdisp/max_wprun_time|http://service.sap.com/sap/support/notes/25528].
    About your question, if you still want to try, look at [example code with alv class cl_salv_table for simple display|http://help.sap.com/saphelp_nw2004s/helpdata/en/f9/1ab54099de3726e10000000a1550b0/frameset.htm]

  • ALV Report performance & export problem

    Hi,
    We have developed an complex ALV report which accesses the data from FI Tables like BKPF, BSEG, BSAK etc.,   There are almost 100 lac records in BSEG and every day around 20000 records are getting added to that.  Eventhough I have used specific search criteria, system is taking lot of time.  Due to this I forced to run the report in background.  In background also it is taking around 4 - 6 hours.
    1) How can I improve the performance of the report.  Especially to access data from huge database table like BSEG with lot of conditions.  Any best practices
    2) I want to have an option (at selection screen) to get the report directly saved in a Excel file at desired path. 
    Please help me.
    Thanks in advance,
    Mallik

    Hi Mallik,
         Already i faced this problem before. At that time i follow some precuations:
    1) Check the estimation cost for that report with the basis people.
    2) The selection fields mentionedin the select statement and fields order in the internal; table should match with order of Data base fields order.
    3) Define type statements and then refer internal table to that types.
    4) Define secondary indexes in the where condition properly.
    5) Add BINARY SEARCH to read table statement.
    6) if possible attach package size n to the select statement.
    7) Avoid nested loops and nested selects.
    8) After populating the final internal table free all the internal tables.
    9) check how much time taking for each select statemnt through SY05.
    Hope this helps you. reply for queries.
    Regards,
    Kumar.

  • Importing problems in alv report (stored versions)

    HI ALL, i have;
    DATA gt_results TYPE sp_data_type OCCURS 0 WITH HEADER LINE .
    FORM X .
    EXPORT gt_results TO DATABASE sp_ver_dat ID INDXKEY.
    ENDFORM .
    FORM Y .
    IMPORT gt_results  FROM DATABASE sp_ver_dat ID INDXKEY.
    ENDFORM .
    I coded this for storing alv datas as a version . Suppose i executed "form x" in 2008. After 1 year later, i would like to see this 2008 record. But my internal table type (sp_data_type) was changed (This change is obligatory). In example new 2 fields were added and 1 field was deleted. In spite of this, i have an error when i am attempting to run "form y"  because clustered data in database does not fit gt_results anymore. 
    How can i run such old stored versions of this alv report? How should i design this subroutines so there will be no problems even if internal table type frequently change in future..?
    I am expecitng your suggestions..
    Thanks..

    I think this is good solution for the versions which we will be created .  Unfortunately there is no way to save (excute) old versions in which structure of internal table  has changed  many times. We have to handle them manually..
    It means, we can save future but not past.. 
    ISN'T IT?
    Thanks all

  • Problems in ALV Report

    Hi all,
    I have a Problem with the ALV report felated to FI Data. Where in the Selection screen I have two fields Commitment Item, Fund Center and Fiscal Year. When i am executing the report it is printing correctly.
    The Problem is that when i give a commitment which is not related to the Fund Center It is displaying all the records.
    That is nothing but it is displaying all the data where the data of the selection screen is not in the internal table.
    instead i should display a message that the Commitment item is not related to Fund Center. and the ALV Should not print any values. How do i achieve this?
    Please help me in solving the problem. Rewards will be awarded.
    Message was edited by:
            sravan varanasi

    Hi,
    Here is a small ex.
    SELECT mtart mtbez FROM t134t
      INTO CORRESPONDING FIELDS OF TABLE it_t134t
      WHERE mtart IN so_mtart AND spras = 'EN'.
      IF sy-subrc = 0.
        *********PERFORM display   
      ELSE.
        MESSAGE ID 'Selection error' TYPE 'E' NUMBER '0040'.
      ENDIF.
    Hope useful.
    Regards
    Harish.

  • Problem with Page Break In ALV Report

    Hi
    I have got a problem in my ALV report. I have a checkbox in the user input screen where users decide whether they want a page break or not in the print preview (or print) page. Now i also have the option to have layout name in the input screen. so If i leave the layout box empty the check or not check of page break works fine. but if use a save layout name in the layout box the add check box doesn't work anymore. If i have a layout name in the layout box it doesn't matter whether i have checked for page break or not it does the same thing.(in one report it always puts the page breaked)
    Any ideas where to look for the error?
    here is the code for the page break. Opt5 is the check box.
      perform build_sort tables pt_sort changing ls_sort.
      ls_sort-fieldname = 'PERNR'.
      ls_sort-subtot    = 'X'.
    IF OPT5 = 'X'.
       ls_sort-GROUP = '*'.
      ENDIF.
      append ls_sort to pt_sort.
      ls_sort-subtot    = ' '.
      ls_sort-GROUP = ''.

    Never mind it was acting like the page break was not working because the layout was saved with the page break on/OFF.

  • Problem in Print Out of ALV report

    Dear All..
    I am trying to take print out of an ALV report. there are 36 columns in my report. when i try to take print out, warning appears which says system cannot print the last 277 columns of report.
    i have tried using different formats for printer like :
    Format                  Description
    X_PAPER                 ABAP/4 list: Default list formatting
    X_SPOOLERR          ABAP list: Spooler problem report
    ZX_65_284               65 Rows and 285 Columns
    X_65_255                ABAP/4 list: At least 65 rows with a maximum number of c
    X_65_200                ABAP list: at least 65 lines with 200 columns (not for a
    X_58_170                ABAP/4 list: At least 58 rows by 170 columns
    X_65_132                ABAP list: At least 65 rows by 132 columns
    X_90_120                ABAP list: At least 90 rows by 120 columns
    X_44_120                ABAP/4 list: At least 44 rows by 120 columns
    X_65_80                 ABAP/4 list: At least 65 rows by 80 columns
    but every time the same message appears even on A3 size paper..
    i am using REUSE_ALV_GRID_DISPLAY to display ALV.
    Please help to to take out prints(can be in condensed mode) so that all columns appear on the print out..

    HI sujeet,
    Thanks for ur response. i had already checked the printer settings.. i think there is no problem with this. Can u Please suggest something else. thanks
    Hiii jyojit..
    Thanks for reply. I had already checked the said check box in spool admin. but the problem still exists. Please suggest something to get rid of the problem.

Maybe you are looking for

  • High quality only looks good when in full screen

    I have a "15 MacBookPro using AE CC 2014.2.. So I typed some text within AE and dragged in a high resolution photo to make a simple video. My composition size was 1920x1080.  But the photo and text always look weird, sorta pixelated, unless they are

  • My itunes wont work because it says it was installed by a newer version

    My iTunes just won't load. All it says is that it cannot work because it was installed by a newer version.

  • Week number and days in week number

    Hi, All we have to update the material master with weekly forcast sales,  so can any one tell me which <b>function i have to use to get week numbers in a month ( i have to get all the week numbers in the given month) and once i get the week numbers h

  • Setting Google Maps as default Map program

    I am using Torch 9810 Ssw V7.0.0 build 2404 on ATT.  I have installed Google Maps and it seems to be working fine.  Of course the Torch also came with ATT Maps and Blackberry Maps.  How to I set up Google Maps as the default map program so that when

  • Business Intelligence Application

    Hi Guru, sorry i am quite new to Business Intelligence.. and i have go through some ebook on Business Intelligence found on SDN.. wonder could anyone tell me more on how to use those tools i know about <b>Visual Composer, Bex Query Designer, Bex Repo