How to use IT_special_groups in ALV Grid ?

Hi Abapers,
Am new to ALv's
am passing almost all parameters to ALV_GRID FM..!
i dont no how to use of options Groups , Filters and I_sel_hide .
event i find an Demo example related to Groups ..
but while displaying the out put i didnt find any Changes ?
could any one give an Example with using GROUPS , Filters and SEL_INFO ?
Pls help me out to resolve this problem ..!
Thanks & Regrds
Rajeshk

Hi,
you can group your ALV columns into various groups using field SP_GROUP in field catalog. You assign name to these groups in the table IT_SPECIAL_GROUPS. User can restrict column selection to one of these groups (using name from the table) on the current layout window. More info can be found in [SAP documentation|http://help.sap.com/saphelp_nw04/helpdata/en/a2/64f7a2ee4f11d2b484006094192fe3/frameset.htm]
Probably as you know you can filter selected records in ALV (icon with funnel). You can use table IT_FILTER to set up this filter.
I am not sure about I_SEL_HIDE but as far as I remember ALV can display selection criteria from report which call ALV FM. So I assume that you can use this table to control displaying of them.
BTW there is a really nice [reference for ALV|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907?overridelayout=true].
Cheers

Similar Messages

  • How to implement 'hypelink' in ALV GRID

    Hi,everybody,please tell me how to implement 'hypelink' in ALV GRID?
    I just try to design a ALV GRID report but I do not kown the way of using 'hypelink'.  I refer to some documents but failsed.     somebody can help me and give a example including entire code.

    1. Create a table where hyperlinks & corresponding handles are stored (TYpe LVC_T_HYPE)
    DATA ls_hype TYPE lvc_s_hype .
    data lt_hype type lvc_t_hype.
    ls_hype-handle = '1' .
    ls_hype-href = 'http://www.company.com/carrids/car1' .
    APPEND ls_hype TO lt_hype .
    2. In your list data table create additional field of type INT4 which will contain the handle of the hyper link (ex. '1' for above hyperlink)
    DATA carrid_handle TYPE int4 .
    3. For the field which shall contain the hyperlink, make an entry in the field catalog indicating the field name which contains handle for the hyperlink. This is done by setting the handle field name in WEB_FIELD.
    ls_fieldcat-fieldname = 'CARRID'
    ls_fieldcat-web_field = 'CARRID_HANDLE'.
    4. While calling set_table_for_first_display, pass the hyperlink table created in step 1 to parameter 'it_hyperlink'
    ~Piyush Patil

  • How to upload logo for alv grid when we are using classes

    Hi am using cl_gui_alv_tree  for displaying alv grid. i want to upload logo in the heade section. as we do in simple alvs using resuse_alv_commentary_write.
    plz update me in this regard.
    regards
    venkat

    Welcome to SDN.
    Check the following threads -
    How To use TOP OF PAGE event in OOPS ALV?
    Logo & TOP_OF_PAGE in OO ALV
    Regards,
    Amit
    Reward all helpful replies.

  • How to use color in alv

    HELLO,
    can u tell me that i want to color column in alv so how to use it ingrid layout.
    thanks.

    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display each row in a different     *
    *& colour                                                              *
    REPORT  zdemo_alvgrid                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
      line_color(4) type c,     "Used to store row color attributes
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    * Set layout field for row attributes(i.e. color)
      gd_layout-info_fieldname =      'LINE_COLOR'.
    *  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                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    data: ld_color(1) type c.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    *Populate field with color attributes
    loop at it_ekko into wa_ekko.
    * Populate color variable with colour properties
    * Char 1 = C (This is a color property)
    * Char 2 = 3 (Color codes: 1 - 7)
    * Char 3 = Intensified on/off ( 1 or 0 )
    * Char 4 = Inverse display on/off ( 1 or 0 )
    *           i.e. wa_ekko-line_color = 'C410'
      ld_color = ld_color + 1.
    * Only 7 colours so need to reset color value
      if ld_color = 8.
        ld_color = 1.
      endif.
      concatenate 'C' ld_color '10' into wa_ekko-line_color.
    *  wa_ekko-line_color = 'C410'.
      modify it_ekko from wa_ekko.
    endloop.
    endform.                    " DATA_RETRIEVAL

  • HOW TO USE OOBJECT ORIENTD ALV INSTED OF REUSE_ALV_GRID_DISPLAY

    Pls help me to implement the object oriented ALV Insted of REUSE_ALV_GRID_DISPLAY.
    Pls find the report below its working fine but we want the OBJECT ORIENTD ALV.
    THNAKS
    TYPE-POOLS: slis.                      " ALV Global types
    tables:pa0001,
           pa0315,
           pa0007,
           disvariant.
         Selection-Screen
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    *SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS: s_pernr FOR pa0001-pernr  OBLIGATORY
    .            " Personnel No
    SELECT-OPTIONS: s_orgeh FOR pa0001-orgeh .           " Organization unit
    SELECT-OPTIONS: s_werks FOR pa0001-werks.            " Personnel Area
    SELECT-OPTIONS: s_plans FOR pa0001-plans.            " Position
    SELECT-OPTIONS: s_ebeln FOR pa0315-ebeln.            " Purchase order
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK b2k2 WITH FRAME TITLE text-002.
    *SELECT-OPTIONS: s_var FOR disvariant-variant.
    PARAMETERS: p_disva1 LIKE disvariant-variant.
    SELECTION-SCREEN END OF BLOCK b2k2.
                     Type Definition                                     *
    TYPES :
    BEGIN OF ty_pa0001_pa0002,
        pernr TYPE pa0001-pernr , " Personnel no.
        endda TYPE pa0001-endda , " end date
        begda TYPE pa0001-begda , " start date
        bukrs TYPE pa0001-bukrs , " company code
        werks TYPE pa0001-werks , " Personnnel area
        persg TYPE pa0001-persg , " Employee group
        persk TYPE pa0001-persk , " Employee subgroup
        btrtl TYPE pa0001-btrtl , " Personnnel subarea
        abkrs TYPE pa0001-abkrs , " Payroll area
        kostl TYPE pa0001-kostl , " cost center
        orgeh TYPE pa0001-orgeh , " Organizational Unit
        plans TYPE pa0001-plans , " Position
        nachn TYPE pa0002-nachn , " Last name
        vorna TYPE pa0002-vorna , " First name
        midnm TYPE pa0002-midnm , " Middle name
      END   OF ty_pa0001_pa0002 ,
    BEGIN OF ty_pa0315,
       pernr TYPE pa0315-pernr , " Personnel no.
       kostl TYPE pa0315-kostl , " Sending cost center
       lstar TYPE pa0315-lstar , " Activity type
       werks TYPE pa0315-werks , " Plant
       lifnr TYPE pa0315-lifnr , " Vendor number
       ebeln TYPE pa0315-ebeln , " Sending pruchase ord
       ebelp TYPE pa0315-ebelp , " Sending PO item
       lstnr TYPE pa0315-lstnr , " Activity number
    END   OF ty_pa0315,
    BEGIN  OF ty_pa0007,
      pernr TYPE pa0007-pernr,
      schkz TYPE pa0007-schkz,
    END  OF ty_pa0007,
    BEGIN OF ty_t527x,
    orgeh TYPE t527x-orgeh,
    orgtx TYPE t527x-orgtx,
    END OF ty_t527x,
    BEGIN OF ty_t528t,
    plans TYPE t528t-plans,
    plstx TYPE t528t-plstx,
    END OF ty_t528t,
    BEGIN OF ty_final,
      pernr   TYPE pa0001-pernr , " Personnel no.
      nachn   TYPE pa0002-nachn , " Last name
      vorna   TYPE pa0002-vorna , " First name
      midnm   TYPE pa0002-midnm , " Middle name
      bukrs   TYPE pa0001-bukrs , " company code
      werks   TYPE pa0001-werks , " Personnnel area
      persg   TYPE pa0001-persg , " Employee group
      persk   TYPE pa0001-persk , " Employee subgroup
      btrtl   TYPE pa0001-btrtl , " Personnnel subarea
      abkrs   TYPE pa0001-abkrs , " Payroll area
    kostl   TYPE pa0001-kostl , " cost center
      orgeh   TYPE pa0001-orgeh , " Organizational Unit
      orgtx   TYPE t527x-orgtx  , " Organizational text
      plans   TYPE pa0001-plans , " Position
      plstx   TYPE t528t-plstx  , " Position text
      schkz   TYPE pa0007-schkz , " Work schedule rule
      kostl   TYPE pa0315-kostl , " Sending cost center
      lstar   TYPE pa0315-lstar , " Activity type
      werks_p TYPE pa0315-werks , " Plant
      lifnr   TYPE pa0315-lifnr , " Vendor number
      ebeln   TYPE pa0315-ebeln , " Sending pruchase ord
      ebelp   TYPE pa0315-ebelp , " Sending PO item
      lstnr   TYPE pa0315-lstnr , " Activity number
      begda   TYPE pa0001-begda , " start date
      endda   TYPE pa0001-endda , " end date
    END  OF ty_final.
                     Data Declaration                                    *
    DATA :
      t_pa0001_pa0002 TYPE STANDARD TABLE OF ty_pa0001_pa0002 ,
      w_pa0001_pa0002 TYPE ty_pa0001_pa0002 ,
      t_pa0315 TYPE STANDARD TABLE OF ty_pa0315 ,
      w_pa0315 TYPE ty_pa0315 ,
      t_pa0007 TYPE STANDARD TABLE OF ty_pa0007 ,
      w_pa0007 TYPE ty_pa0007 ,
      t_t527x TYPE STANDARD TABLE OF ty_t527x ,
      w_t527x TYPE ty_t527x ,
      t_t528t TYPE STANDARD TABLE OF ty_t528t ,
      w_t528t TYPE ty_t528t ,
      t_final TYPE STANDARD TABLE OF ty_final ,
      w_final TYPE ty_final .
    START-OF-SELECTION .
      SELECT a~pernr
             a~endda
             a~begda
             a~bukrs
             a~werks
             a~persg
             a~persk
             a~btrtl
             a~abkrs
             a~kostl
             a~orgeh
             a~plans
             b~nachn
             b~vorna
             b~midnm
             INTO TABLE t_pa0001_pa0002
             FROM pa0001 AS a INNER JOIN pa0002 AS b
             ON apernr = bpernr
             WHERE a~pernr IN s_pernr
             AND   a~werks IN s_werks
             AND   a~orgeh IN s_orgeh
             AND   a~plans IN s_plans.
      SORT t_pa0001_pa0002 BY pernr .
      IF NOT t_pa0001_pa0002[] IS INITIAL .
        SELECT pernr
               kostl
               lstar
               werks
               lifnr
               ebeln
               ebelp
               lstnr
               FROM pa0315
               INTO TABLE t_pa0315
               FOR ALL ENTRIES IN t_pa0001_pa0002
               WHERE pernr = t_pa0001_pa0002-pernr
               AND   kostl = t_pa0001_pa0002-kostl
               AND   ebeln IN s_ebeln.
        SELECT pernr
               schkz
               FROM pa0007
               INTO TABLE t_pa0007
               FOR ALL ENTRIES IN t_pa0001_pa0002
               WHERE pernr = t_pa0001_pa0002-pernr.
        SELECT orgeh
               orgtx
               FROM t527x
               INTO TABLE t_t527x
               FOR ALL ENTRIES IN t_pa0001_pa0002
               WHERE orgeh = t_pa0001_pa0002-orgeh.
        SELECT plans
               plstx
               FROM t528t
               INTO TABLE t_t528t
               FOR ALL ENTRIES IN t_pa0001_pa0002
               WHERE plans = t_pa0001_pa0002-plans.
    ENDIF.
    Merging data of t_pa0001_pa0002,t_pa0315 & t_pa0007 into t_final.
    LOOP AT t_pa0001_pa0002 INTO w_pa0001_pa0002 .
    MOVE-CORRESPONDING w_pa0001_pa0002 TO w_final.
    READ TABLE t_pa0315 INTO w_pa0315 WITH KEY  pernr =
    w_pa0001_pa0002-pernr
    kostl = w_pa0001_pa0002-kostl.
        IF sy-subrc = 0.
          w_final-kostl   = w_pa0315-kostl.
          w_final-lstar   = w_pa0315-lstar.
          w_final-werks_p = w_pa0315-werks.
          w_final-lifnr   = w_pa0315-lifnr.
          w_final-ebeln   = w_pa0315-ebeln.
          w_final-ebelp   = w_pa0315-ebelp.
          w_final-lstnr   = w_pa0315-lstnr.
        ENDIF.
    READ TABLE t_pa0007 INTO w_pa0007 WITH KEY pernr =
    w_pa0001_pa0002-pernr.
      IF sy-subrc = 0.
         w_final-schkz = w_pa0007-schkz.
      ENDIF.
      READ TABLE t_t527x INTO w_t527x WITH KEY orgeh = w_pa0001_pa0002-orgeh
      IF sy-subrc = 0.
         w_final-orgtx = w_t527x-orgtx.
      ENDIF.
        READ TABLE t_t528t INTO w_t528t WITH KEY plans =
    w_pa0001_pa0002-plans.
      IF sy-subrc = 0.
         w_final-plstx = w_t528t-plstx.
      ENDIF.
    APPEND w_final to t_final.
    ENDLOOP.
    PERFORM f_display_data.
    FORM f_display_data.
      DATA:
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv.
    Build the field catalog
    m_fieldcat 'PERNR' 'PA0001'.
    m_fieldcat 'NACHN' 'PA0002'.
    m_fieldcat 'VORNA' 'PA0002'.
    m_fieldcat 'MIDNM' 'PA0002'.
    m_fieldcat 'BUKRS' 'PA0001'.
    m_fieldcat 'WERKS' 'PA0001'.
    m_fieldcat 'PERSG' 'PA0001'.
    m_fieldcat 'PERSK' 'PA0001'.
    m_fieldcat 'BTRTL' 'PA0001'.
    m_fieldcat 'ABKRS' 'PA0001'.
    m_fieldcat 'ORGEH' 'PA0001'.
    m_fieldcat 'ORGTX' 'T527X'.
    m_fieldcat 'PLANS' 'PA0001'.
    m_fieldcat 'PLSTX' 'T528T'.
    m_fieldcat 'SCHKZ' 'PA0007'.
    m_fieldcat 'KOSTL' 'PA0315'.
    m_fieldcat 'LSTAR' 'PA0315'.
    m_fieldcat 'WERKS' 'PA0315'.
    m_fieldcat 'LIFNR' 'PA0315'.
    m_fieldcat 'EBELN' 'PA0315'.
    m_fieldcat 'EBELP' 'PA0315'.
    m_fieldcat 'LSTNR' 'PA0315'.
    m_fieldcat 'BEGDA' 'PA0001'.
    m_fieldcat 'ENDDA' 'PA0001'.
    ls_fieldcat-col_pos = '1'.
    ls_fieldcat-fieldname = 'PERNR'.
    ls_fieldcat-tabname = 't_FINAL'.
    *ls_fieldcat-rollname = 'PERNR'.
    ls_fieldcat-ref_tabname  = 'PA0001'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '2'.
    ls_fieldcat-fieldname = 'NACHN'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0002'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '3'.
    ls_fieldcat-fieldname = 'VORNA'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0002'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '4'.
    ls_fieldcat-fieldname = 'MIDNM'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0002'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '5'.
    ls_fieldcat-fieldname = 'BUKRS'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0001'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '6'.
    ls_fieldcat-fieldname = 'WERKS'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0001'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '7'.
    ls_fieldcat-fieldname = 'PERSG'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0001'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '8'.
    ls_fieldcat-fieldname = 'PERSK'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0001'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '9'.
    ls_fieldcat-fieldname = 'BTRTL'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0001'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '10'.
    ls_fieldcat-fieldname = 'ABKRS'.
    ls_fieldcat-tabname = 'T_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0001'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '11'.
    ls_fieldcat-fieldname = 'ORGEH'.
    ls_fieldcat-tabname = 'T_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0001'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '12'.
    ls_fieldcat-fieldname = 'ORGTX'.
    ls_fieldcat-tabname = 'T_FINAL'.
    ls_fieldcat-ref_tabname = 'T527X'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '13'.
    ls_fieldcat-fieldname = 'PLANS'.
    ls_fieldcat-tabname = 'T_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0001'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '14'.
    ls_fieldcat-fieldname = 'PLSTX'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'T528T'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '15'.
    ls_fieldcat-fieldname = 'SCHKZ'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0007'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '16'.
    ls_fieldcat-fieldname = 'KOSTL'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0315'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '17'.
    ls_fieldcat-fieldname = 'LSTAR'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0315'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '18'.
    ls_fieldcat-fieldname = 'WERKS'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0315'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '19'.
    ls_fieldcat-fieldname = 'LIFNR'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0315'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '20'.
    ls_fieldcat-fieldname = 'EBELN'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0315'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '21'.
    ls_fieldcat-fieldname = 'EBELP'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0315'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '22'.
    ls_fieldcat-fieldname = 'LSTNR'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0315'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '23'.
    ls_fieldcat-fieldname = 'BEGDA'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0001'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    ls_fieldcat-col_pos = '24'.
    ls_fieldcat-fieldname = 'ENDDA'.
    ls_fieldcat-tabname = 't_FINAL'.
    ls_fieldcat-ref_tabname = 'PA0001'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR: ls_fieldcat.
    *DATA: v_repid TYPE sy-repid.
         v_repid = sy-repid.
    *Display the list
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = sy-cprog
         i_callback_program      = v_repid
         i_callback_user_command = 'USER_COMMAND'
          it_fieldcat             = lt_fieldcat
        TABLES
          t_outtab                = t_final.
    ENDFORM.                               " F_DISPLAY_DATA

    Hi,
    <b>Sample programs on ALV Grid</b>
    report zbnstest.
    * TABLES AND DATA DECLARATION.
    *TABLES: mara,makt.",marc.
    data syrepid like sy-repid.
    data sydatum(10). " LIKE sy-datum.
    data sypagno(3) type n.
    * WHEN USING MORE THAN ONE TABLE IN ALV WE NEEED TO DECLARE THE TYPE
    * GROUP (TYPE-POOLS--------->SLIS)
    type-pools : slis.
    * INTERNAL TABLE DECLARATION.
    * INTERNAL TABLE TO HOLD THE VALUES FROM THE MARA TABLE
    data: begin of t_mara occurs 0,
    matnr like mara-matnr,
    meins like mara-meins,
    mtart like mara-mtart,
    matkl like mara-matkl,
    end of t_mara.
    * INTERNAL TABLE TO HOLD THE CONTENTS FROM THE EKKO TABLE
    data : begin of t_marc occurs 0,
    matnr like mara-matnr,
    werks like marc-werks,
    minbe like marc-minbe.
    data: end of t_marc.
    * INTERNAL TABLE TO HOLD THE VALUES FROM MAKT TABLE.
    data : begin of t_makt occurs 0,
    matnr like mara-matnr,
    maktx like makt-maktx,
    spras like makt-spras,
    end of t_makt.
    * INTERNAL TABLE WHICH ACTUALLY MERGES ALL THE OTHER INTERNAL TABLES.
    data: begin of itab1 occurs 0,
    matnr like mara-matnr,
    meins like mara-meins,
    maktx like makt-maktx,
    spras like makt-spras,
    werks like marc-werks,
    minbe like marc-minbe,
    end of itab1.
    * THE FOLLOWING DECLARATION IS USED FOR DEFINING THE FIELDCAT
    * AND THE LAYOUT FOR THE ALV.
    * HERE AS slis_t_fieldcat_alv IS A INTERNAL TABLE WITHOUT A HEADER LINE
    * WE EXPLICITELY DEFINE AN INTERNAL TABLE OF THE SAME STRUCTURE AS THAT
    * OF slis_t_fieldcat_alv BUT WITH A HEADER LINE IN THE DEFINITION.
    * THIS IS DONE TO MAKE THE CODE SIMPLER.
    * OTHERWISE WE MAY HAVE TO DEFINE THE STRUCTURE AS IN THE NORMAL SAP
    * PROGRAMS.
    * IN THE FIELDCATALOG TABLE WE ACTUALLY PASS THE FIELDS FROM ONE OR
    * MORE TABLES AND CREATE A STRUCTURE
    * IN THE LAYOUT STRUCTURE WE BASICALLY DEFINE THE FORMATTING OPTIONS
    * LIKE DISPLAY IN THE ZEBRA PATTERN ,THE HOTSPOT OPTIONS ETC.
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
    fieldlayout type slis_layout_alv.
    * DECLARING THE EVENTTABLE INTERNL TABLE FOR USING EVENTS LIKE
    * TOP-OF-PAGE ETC.
    data : eventstab type slis_t_event with header line.
    * DECLARING AN INTERNAL TABLE TO HOLD THE DATA FOR THE TOP-OF-PAGE
    data : heading type slis_t_listheader with header line.
    data : heading1 type slis_t_listheader with header line.
    data : heading2 type slis_t_listheader with header line.
    data : heading3 type slis_t_listheader with header line.
    data : heading4 type slis_t_listheader with header line.
    data : heading5 type slis_t_listheader with header line.
    data : heading6 type slis_t_listheader with header line.
    data : heading7 type slis_t_listheader with header line.
    data : heading8 type slis_t_listheader with header line.
    * STRUCTURE TO PASS THE COLOR ATTRIBUTES FOR DISPLAY.
    data : colorstruct type slis_coltypes.
    * INITIALIZATION. *
    initialization.
    syrepid = sy-repid.
    sypagno = sy-pagno.
    clear fieldcatalog.
    * START-OF-SELECTION. *
    start-of-selection.
    * SUBROUTINE TO POPULATE THE COLORSTRUCT
    perform fill_colorstruct using colorstruct.
    * SUBROUTINE TO POPULATE THE FIELDS OF THE FIELD CATALOGUE
    perform populate_fieldcatalog.
    * SUBROUTINE TO SELECT DATA FROM VARIOUS TABLES AND POPULATE IT IN THE
    * INTERNAL TABLE.
    perform selectdata_and_sort.
    * SUBROUTINE TO POPULATE THE LAYOUT STRUCTURE.
    perform populate_layout using fieldlayout.
    * SUBROUTINE TO CALL THE FUNCTION MERGE TO ENSURE PROPER DISPLAY.
    perform merge_fieldcatalog.
    * SUBROUTINE TO POPULATE THE EVENTSTAB.
    perform fill_eventstab tables eventstab.
    * SUBROUTINE TO POPULATE THE HEADING TABLES.
    perform fill_headingtable tables heading using 'HEADING'.
    perform fill_headingtable tables heading1 using 'HEADING1'.
    perform fill_headingtable tables heading2 using 'HEADING2'.
    perform fill_headingtable tables heading3 using 'HEADING3'.
    perform fill_headingtable tables heading4 using 'HEADING4'.
    perform fill_headingtable tables heading5 using 'HEADING5'.
    perform fill_headingtable tables heading6 using 'HEADING6'.
    perform fill_headingtable tables heading7 using 'HEADING7'.
    perform fill_headingtable tables heading8 using 'HEADING8'.
    * SUBROUTINE TO DISPLAY THE LIST.
    perform display_alv_list.
    * FORMS
    * IN THIS SUBROUTINE WE POPULATE THE FIELDCATALOG TABLE WITH THE NAMES
    * OF THE TABLE,FIELDNAME,WHETHER IT IS KEY FIELD OR NOT,HEADING AND
    * COLUMN JUSTIFICATION.
    form populate_fieldcatalog.
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MATNR' 'X' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MEINS' ' '.
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MAKTX' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MTART' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MATKL' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'SPRAS' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'WERKS' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MINBE' ' ' .
    endform. " POPULATE_FIELDCATALOG
    * FORM FILL_FIELDS_OF_FIELDCATALOG *
    * --> FIELDCATALOG *
    * --> P_TABNAME *
    * --> P_FIELDNAME *
    * --> P_KEY *
    * --> P_KEY *
    form fill_fields_of_fieldcatalog tables fieldcatalog
    structure fieldcatalog
    using p_tabname
    p_fieldname
    p_key.
    * p_no_out.
    fieldcatalog-tabname = p_tabname.
    fieldcatalog-fieldname = p_fieldname.
    fieldcatalog-key = p_key.
    fieldcatalog-emphasize = '1234'.
    *fieldcatalog-no_out = p_no_out.
    append fieldcatalog.
    endform. " FILL_FIELDSOFFIELDCATALOG
    * FORM POPULATE_LAYOUT *
    * --> FIELDLAYOUT *
    form populate_layout using fieldlayout type slis_layout_alv.
    fieldlayout-f2code = '&ETA' .
    fieldlayout-zebra = 'X'.
    * FOR THE WINDOW TITLE.
    fieldlayout-window_titlebar = 'ALV with Events'.
    fieldlayout-colwidth_optimize = 'X'.
    fieldlayout-no_vline = ' '.
    *fieldlayout-no_input = 'X'.
    fieldlayout-confirmation_prompt = ''.
    fieldlayout-key_hotspot = 'X'.
    * This removes the column headings if the flag is set to 'X'
    fieldlayout-no_colhead = ' '.
    *fieldlayout-hotspot_fieldname = 'MAKTX'.
    fieldlayout-detail_popup = 'X'.
    * fieldlayout-coltab_fieldname = 'X'.
    endform. " POPULATE_LAYOUT
    * FORM SELECTDATA_AND_SORT *
    form selectdata_and_sort.
    select matnr meins mtart matkl from mara
    into corresponding fields of t_mara
    up to 500 rows .
    select matnr maktx spras from makt
    into corresponding fields of t_makt
    where matnr = t_mara-matnr and
    spras = sy-langu.
    select matnr werks minbe from marc
    into corresponding fields of t_marc
    where matnr = t_mara-matnr.
    append t_marc.
    endselect.
    append t_makt.
    endselect.
    append t_mara.
    endselect.
    perform populate_itab1.
    sort itab1 by matnr.
    endform. " SELECTDATA_AND_SORT
    * FORM MERGE_FIELDCATALOG *
    form merge_fieldcatalog.
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    exporting
    i_program_name = syrepid
    i_internal_tabname = 'ITAB1'
    * i_structure_name = 'COLORSTRUCT'
    * I_CLIENT_NEVER_DISPLAY = 'X'
    i_inclname = syrepid
    changing
    ct_fieldcat = fieldcatalog[]
    exceptions
    inconsistent_interface = 1
    program_error = 2
    others = 3.
    endform. " MERGE_FIELDCATALOG
    * IN THIS FUNCTION THE MINIMUM PARAMETERS THAT WE NEED TO PASS IS AS
    * FOLLOWS:-
    * i_callback_program --> CALLING PROGRAM NAME
    * i_structure_name --> STRUCTURE NAME.
    * is_layout --> LAYOUT NAME.
    * it_fieldcat ---> BODY OF THE FIELD CATALOGUE INTERNAL TABLE
    form display_alv_list.
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    * I_INTERFACE_CHECK = ' '
    i_callback_program = syrepid
    * I_CALLBACK_PF_STATUS_SET = ' '
    * I_CALLBACK_USER_COMMAND = ' '
    i_structure_name = 'ITAB1'
    is_layout = fieldlayout
    it_fieldcat = fieldcatalog[]
    * IT_EXCLUDING =
    * IT_SPECIAL_GROUPS =
    * IT_SORT =
    * IT_FILTER =
    * IS_SEL_HIDE =
    * I_DEFAULT = 'X'
    * THE FOLLOWING PARAMETER IS SET AS 'A' INORDER TO DISPLAY THE STANDARD
    * TOOL BAR
    i_save = 'A'
    * IS_VARIANT = ' '
    it_events = eventstab[]
    * IT_EVENT_EXIT =
    * IS_PRINT =
    * I_SCREEN_START_COLUMN = 0
    * I_SCREEN_START_LINE = 0
    * I_SCREEN_END_COLUMN = 0
    * I_SCREEN_END_LINE = 0
    * IMPORTING
    * E_EXIT_CAUSED_BY_CALLER =
    * ES_EXIT_CAUSED_BY_USER =
    tables
    t_outtab = itab1
    exceptions
    program_error = 1
    others = 2.
    endform. " DISPLAY_ALV_LIST
    *& Form POPULATE_ITAB1
    * text
    * --> p1 text
    * <-- p2 text
    form populate_itab1.
    loop at t_mara.
    loop at t_makt where matnr = t_mara-matnr.
    loop at t_marc where matnr = t_mara-matnr.
    move-corresponding t_mara to itab1.
    move-corresponding t_makt to itab1.
    move-corresponding t_marc to itab1.
    append itab1.
    endloop.
    endloop.
    endloop.
    endform. " POPULATE_ITAB1
    *& Form FILL_EVENTSTAB
    * text
    * -->P_EVENTSTAB text *
    form fill_eventstab tables p_eventstab structure eventstab.
    * WHEN THE FOLLOWING FUNCTION IS CALLED THE SYSTEM POPULATES THE
    * INTERNAL TABLE EVENTSTAB WITH A LIST OF EVENTS NAME.
    * AS SHOWN BELOW WHEN USING I_LIST_TYPE = 0 THE FUNCTION RETURNS 14
    * EVENTS NAME.
    call function 'REUSE_ALV_EVENTS_GET'
    exporting
    i_list_type = 0
    importing
    et_events = p_eventstab[]
    exceptions
    list_type_wrong = 1
    others = 2.
    * BY CALLING THE ABOVE FUNCTION WE FIRST POPULATE THE EVENTSTAB WITH
    * THE PREDEFINED EVENTS AND THEN WE MOVE THE FORM NAME AS SHOWN BELOW.
    * WE ASSIGN A FORM NAME TO THE EVENT AS REQUIRED BY THE USER.
    * FORM NAME CAN BE ANYTHING.THE PERFORM STATEMENT FOR THIS FORM
    * IS DYNAMICALY CALLED.
    read table p_eventstab with key name = slis_ev_top_of_page.
    if sy-subrc = 0 .
    move 'TOP_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_top_of_coverpage.
    if sy-subrc = 0 .
    move 'TOP_OF_COVERPAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_coverpage .
    if sy-subrc = 0 .
    move 'END_OF_COVERPAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_foreign_top_of_page.
    if sy-subrc = 0 .
    move 'FOREIGN_TOP_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_foreign_end_of_page.
    if sy-subrc = 0 .
    move 'FOREIGN_END_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_list_modify.
    if sy-subrc = 0 .
    move 'LIST_MODIFY' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_top_of_list.
    if sy-subrc = 0 .
    move 'TOP_OF_LIST' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_page.
    if sy-subrc = 0 .
    move 'END_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_list .
    if sy-subrc = 0 .
    move 'END_OF_LIST' to p_eventstab-form.
    append p_eventstab.
    endif.
    endform. " FILL_EVENTSTAB
    *& Form FILL_HEADINGTABLE
    * text
    * -->P_HEADING text *
    form fill_headingtable tables p_heading structure heading
    using tablename.
    case tablename.
    when 'HEADING'.
    p_heading-typ = 'H'.
    concatenate
    ' REPORT NAME:-' syrepid
    ' ABB Industry Pte Ltd' into p_heading-info.
    append p_heading.
    write sy-datum using edit mask '__/__/____' to sydatum.
    concatenate
    ' DATE:-' sydatum ' USER: ' sy-uname 'PAGE NO:' sypagno
    into p_heading-info.
    append p_heading.
    when 'HEADING1'.
    p_heading-typ = 'H'.
    p_heading-info = 'TOP-OF-COVER-PAGE'.
    append p_heading.
    when 'HEADING2'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-COVER-PAGE'.
    append p_heading.
    when 'HEADING3'.
    p_heading-typ = 'H'.
    p_heading-info = 'FOREIGN-TOP-OF-PAGE'.
    append p_heading.
    when 'HEADING4'.
    p_heading-typ = 'H'.
    p_heading-info = 'FOREIGN-END-OF-PAGE'.
    append p_heading.
    * WHEN 'HEADING5'.
    * P_HEADING-TYP = 'H'.
    * P_HEADING-INFO = 'LIST-MODIFY'.
    * APPEND P_HEADING.
    when 'HEADING6'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-PAGE'.
    append p_heading.
    when 'HEADING7'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-LIST'.
    append p_heading.
    when 'HEADING8'.
    p_heading-typ = 'H'.
    p_heading-info = 'TOP-OF-LIST'.
    append p_heading.
    endcase.
    endform. " FILL_HEADINGTABLE
    * FORM TOP_OF_PAGE *
    form top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading[]
    exceptions
    others = 1.
    endform.
    *& Form FILL_COLORSTRUCT
    * text
    * -->P_COLORSTRUCT text *
    form fill_colorstruct using p_colorstruct type slis_coltypes .
    p_colorstruct-heacolfir-col = 6.
    p_colorstruct-heacolfir-int = 1.
    p_colorstruct-heacolfir-inv = 1.
    endform. " FILL_COLORSTRUCT
    * FORM TOP_OF_COVERPAGE *
    form top_of_coverpage.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading1[]
    exceptions
    others = 1.
    endform.
    * FORM END_OF_COVERPAGE *
    form end_of_coverpage.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading2[]
    exceptions
    others = 1.
    endform.
    * FORM FOREIGN_TOP_OF_PAGE *
    form foreign_top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading3[]
    exceptions
    others = 1.
    endform.
    * FORM FOREIGN_END_OF_PAGE *
    form foreign_end_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading4[]
    exceptions
    others = 1.
    endform.
    * FORM LIST_MODIFY *
    *FORM LIST_MODIFY.
    * CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    * EXPORTING
    * IT_LIST_COMMENTARY = HEADING5[]
    * EXCEPTIONS
    * OTHERS = 1.
    *ENDFORM.
    * FORM END_OF_PAGE *
    form end_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading6[]
    exceptions
    others = 1.
    endform.
    * FORM END_OF_LIST *
    form end_of_list.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading7[]
    exceptions
    others = 1.
    endform.
    * FORM TOP_OF_LIST *
    form top_of_list.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading8[]
    exceptions
    others = 1.
    endform.
    *--- End of Program
    Regards
    Sudheer

  • How to supress dialog while ALV Grid output is send to Spool

    Hi,
    I need to get the ALV grid output in spool.But when i am executing my program using ALV grid function module with print parameter passed,first its giving a popup with default printer and number of copies and when i press ok for the popup ,spool request is created.But i dont want this popup to come while executing my program.It should create the spool request directly. How to solve this issue.
    Regards
    Shibin

    Hi Shibin,
    Try the below parameter in IS_PRINT Structure:
    is_print-print = 'N'.
    This will Supress the Dialog and create a Spool with no Immeadiate Output.
    Hope This Helps you..
    Thanks & Regards,
    Suresh Karri

  • How can i validate on ALV grid for the user

    Dear Freinds,
                     I have developed one custom report using ALV Grid program , as per the requirement i have to enter on the
    data and when i press the value save the program sumits the data into my custom table . Till here every thing is fine
    but one particular field i have declared as Char1 in my internal table , on the ALV output it is allowing me to enter
    more than one character   eg : it is allowing me to enter as Hyderabad .........even though i have declared as char 1 in the internal table ....however it is saving in the database table as H only that is correct.......but it is giving confusion to user
    i want to validate that user shouldnt allow to enter more than one character in the alv output of the input field .
    Please could any one let me know how can i validate.
    regard
    divya

    Hi,
    check  that field length in the final internal table .
    might be that filed lenth in final internal table declartion is more than 1 char.
    regards,
    Rama reddy
    Edited by: ram reddy on Jul 15, 2009 7:57 AM

  • How to give space in ALV grid display

    Hi,
    I have developed one report using alv grid.
    Iam getting details like this.
    ABCD  |12345|34567|
    |35363|74567|
    but i want like this
    ABCD   <b>here i want space</b>
    |12345|34567|
    |35363|74567|
    how to give space?
    points guaranteed
    cheers
    kaki

    Hi experts,
    Iam trying to get the output like in this report
    BALVHD01
    for example: ID & No iam getting in the same line.I want to group the numbers for the particular ID.
    In my code ID is 'STEXT'
    and  NO is 'QMNUM'.
    this is my code.
    REPORT  YET_DISPLAYCOST
                MESSAGE-ID  ZM
                NO STANDARD PAGE HEADING
                LINE-SIZE 200.
    TYPE-POOLS: SLIS.
    TABLES: QPCT,
            QPGT,
            QMEL,
            QMMA,
            IHPA,
            JEST,
            HRP1000.
    DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          ITAB_EXTAB   TYPE SLIS_T_EXTAB.
    DATA :
      I_FIELDCAT         TYPE SLIS_T_FIELDCAT_ALV,
      S_FIELDCAT         TYPE SLIS_FIELDCAT_ALV  ,
      G_USER_COMMAND     TYPE SLIS_FORMNAME VALUE 'USER_COMMAND' ,
      G_TOP_OF_PAGE      TYPE SLIS_FORMNAME VALUE 'T_TOP_OF_PAGE',
      I_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER WITH HEADER LINE,
      I_EVENTS           TYPE SLIS_T_EVENT WITH HEADER LINE,
      S_EVENT            TYPE SLIS_ALV_EVENT ,
      S_LAYOUT           TYPE SLIS_LAYOUT_ALV,
      IT_SORT            TYPE SLIS_T_SORTINFO_ALV.
    *to remove sort buttons on the tool bar
    DATA : EX TYPE SLIS_T_EXTAB.
    DATA : EXWA TYPE SLIS_EXTAB.
    DATA: LS_LINE TYPE SLIS_LISTHEADER.
    DATA: I_FCALV TYPE SLIS_FIELDCAT_ALV OCCURS 0 WITH HEADER LINE.
    DATA:F_TDOBJECT LIKE THEAD-TDOBJECT,
         F_TDNAME   LIKE THEAD-TDNAME,
         F_TDID     LIKE THEAD-TDID,
         ITAB_LINES LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA:BEGIN OF ITAB OCCURS 10,
          QMNUM LIKE QMEL-QMNUM,
            DESC(72),
         END OF ITAB.
    DATA: BEGIN OF T_HDR OCCURS 0,
           QMNUM LIKE QMEL-QMNUM,
          PARNR LIKE IHPA-PARNR,
          OBJID LIKE HRP1000-OBJID,
           STEXT LIKE HRP1000-STEXT,
          END OF T_HDR.
    DATA: BEGIN OF T_DET OCCURS 10,
           SNO TYPE I,
           QMNUM LIKE QMEL-QMNUM,
           QMTXT LIKE QMEL-QMTXT,
           QMGRP LIKE QMEL-QMGRP,
           QMCOD LIKE QMEL-QMCOD,
           PARNR LIKE IHPA-PARNR,
           OBJNR LIKE QMEL-OBJNR,
           STEXT LIKE HRP1000-STEXT,
           DESC(72),
           COST(20),
          END OF T_DET.
    DATA: T_FINAL LIKE T_DET OCCURS 0 WITH HEADER LINE.
    DATA: SNO(3).
    DATA: CHK2(4).
    DATA: V_REPID TYPE SY-REPID.
    SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS:S_QMNUM FOR QMEL-QMNUM,
                      S_QMART FOR QMEL-QMART,
                      S_QMDAT FOR  QMEL-QMDAT.
    SELECTION-SCREEN END OF BLOCK A1.
    START-OF-SELECTION.
      PERFORM GET_DATA.
      PERFORM DISPLAY_ALV.
    END-OF-SELECTION.
    *&      FORM  GET_DATA
          TEXT
    FORM GET_DATA.
      DATA: G_STEXT LIKE T_DET-STEXT.
    *TO GET DETAILS
      SELECT QMNUM REFNUM QMDAT QMTXT OBJNR QMGRP QMCOD FROM QMEL
        INTO CORRESPONDING FIELDS OF TABLE T_DET
                                  WHERE QMNUM IN S_QMNUM AND
                                        QMART IN S_QMART AND
                                        QMDAT IN S_QMDAT.
      LOOP AT T_DET.
        SELECT SINGLE * FROM IHPA WHERE OBJNR = T_DET-OBJNR and
                                        PARVW = 'AB'.
        IF SY-SUBRC = 0.
          T_DET-PARNR = IHPA-PARNR.
          MODIFY T_DET.
          CLEAR T_DET.
        ENDIF.
      ENDLOOP.
      LOOP AT T_DET.
        DELETE T_DET WHERE PARNR EQ ''.
        SELECT SINGLE * FROM JEST WHERE OBJNR = T_DET-OBJNR AND
                                        STAT  = 'I0072' AND
                                        INACT NE 'X'.
        IF SY-SUBRC NE 0.
          DELETE T_DET INDEX SY-TABIX.
        ENDIF.
      ENDLOOP.
      LOOP AT T_DET.
        SELECT SINGLE * FROM HRP1000 WHERE OBJID = T_DET-PARNR.
        IF SY-SUBRC = 0.
          T_DET-STEXT = HRP1000-STEXT.
          MODIFY T_DET.
          CLEAR T_DET.
        ENDIF.
      ENDLOOP.
      LOOP AT T_DET.
        CHK2 = T_DET-QMNUM+0(4).
        IF CHK2 NE '0002'.
          DELETE T_DET INDEX SY-TABIX.
        ENDIF.
      ENDLOOP.
    *--FOR HEADER
      LOOP AT T_DET.
        SELECT SINGLE * FROM HRP1000 WHERE OBJID = T_DET-PARNR AND
                                           STEXT NE ''.
        T_HDR-QMNUM = T_DET-QMNUM.
        T_HDR-STEXT = HRP1000-STEXT.
        APPEND T_HDR.
        CLEAR T_HDR.
      ENDLOOP.
      LOOP AT T_DET.
        F_TDID     = 'LTQM'.
        F_TDNAME   = T_DET-QMNUM.
        F_TDOBJECT = 'QMEL'.
        CALL FUNCTION 'READ_TEXT'
          EXPORTING
            CLIENT                  = SY-MANDT
            ID                      = F_TDID
            LANGUAGE                = SY-LANGU
            NAME                    = F_TDNAME
            OBJECT                  = F_TDOBJECT
          TABLES
            LINES                   = ITAB_LINES
          EXCEPTIONS
            ID                      = 1
            LANGUAGE                = 2
            NAME                    = 3
            NOT_FOUND               = 4
            OBJECT                  = 5
            REFERENCE_CHECK         = 6
            WRONG_ACCESS_TO_ARCHIVE = 7
            OTHERS                  = 8.
        DESCRIBE TABLE ITAB_LINES LINES SY-TFILL.
        IF SY-TFILL > 0.
          LOOP AT ITAB_LINES.
            ITAB-QMNUM = T_DET-QMNUM.
            ITAB-DESC = ITAB_LINES-TDLINE.
            APPEND ITAB.
            CLEAR ITAB.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
      SORT T_DET.
      LOOP AT T_DET.
        SNO = SNO + 1.
        T_FINAL-SNO = SNO.
        T_FINAL-QMNUM = T_DET-QMNUM.
        T_FINAL-QMTXT =  T_DET-QMTXT.
        T_FINAL-COST = T_DET-COST.
       IF G_STEXT NE T_DET-STEXT.
         G_STEXT = T_DET-STEXT.
        T_FINAL-STEXT = T_DET-STEXT.
       ENDIF.
        LOOP AT ITAB WHERE QMNUM = T_DET-QMNUM.
          T_FINAL-DESC = ITAB-DESC.
          APPEND T_FINAL.
          CLEAR T_FINAL.
          IF T_FINAL-SNO = '0'.
            T_FINAL-SNO = ''.
          ENDIF.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    "GET_DATA
    *&      FORM  DISPLAY_ALV
          TEXT
    FORM DISPLAY_ALV.
    V_REPID = SY-REPID.
      PERFORM FIELD_CATLOG.
      PERFORM EVENT.
      PERFORM LAYOUT.
      PERFORM SORT_T_FINAL.
      PERFORM TOP-OF-PAGE.
    PERFORM REMOVE_SORT.
      CALL FUNCTION <b>'REUSE_ALV_GRID_DISPLAY'</b>
        EXPORTING
          I_CALLBACK_PROGRAM = SY-CPROG     
          IS_LAYOUT          = S_LAYOUT
          IT_FIELDCAT        = I_FIELDCAT[]
          I_SAVE             = 'A'
          IT_SORT            = IT_SORT
          IT_EVENTS          = I_EVENTS[]
          IT_EXCLUDING       = EX
        TABLES
          T_OUTTAB           = T_FINAL
        EXCEPTIONS
          PROGRAM_ERROR      = 1
          OTHERS             = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "DISPLAY_ALV
    *&      Form  FIELD_CATLOG
          text
    FORM FIELD_CATLOG .
      PERFORM FILL_FCAT USING:
                1 1  'STEXT'    'ATTRIBUTED DIV'           18 'T_FINAL' ' '
                1 2  'SNO'      'SR.NO'                    18 'T_FINAL' ' '
                1 3  'QMNUM'    'ET.REF.NO'                30 'T_FINAL' ' '
                1 4  'QMTXT'    'DESCRIPTION'              20 'T_FINAL' ' '
                1 4  'DESC'     'DEFECT'                   20 'T_FINAL' ' '
                1 5  'COST'     'COST'                    15 'T_FINAL'  'S'.
    ENDFORM.                    " FIELD_CATLOG
    *&      Form  FILL_FCAT
          text
         -->LEV        text
         -->POS        text
         -->FLD        text
         -->DES        text
         -->LEN        text
         -->TABLE      text
         -->F          text
    FORM FILL_FCAT  USING    LEV POS FLD DES LEN TABLE F.
      CLEAR I_FCALV.
      I_FCALV-COL_POS   = POS.
      I_FCALV-FIELDNAME = FLD.
      I_FCALV-SELTEXT_L = DES.
      I_FCALV-DDICTXT   = 'L'.
      I_FCALV-OUTPUTLEN = LEN.
      I_FCALV-TABNAME   = TABLE.
      IF F EQ 'S'.
        I_FCALV-DO_SUM    = 'X'.
      ENDIF.
      APPEND I_FCALV TO  I_FIELDCAT.
    ENDFORM.                    "FILL_FCAT
    *&      Form  SORT_T_FINAL
          text
    FORM SORT_T_FINAL.
      DATA: L_SORT LIKE LINE OF IT_SORT.
    REFRESH IT_SORT.
    CLEAR L_SORT.
    L_SORT-SPOS      = '1'.
    L_SORT-FIELDNAME = 'STEXT'.
    L_SORT-TABNAME   = 'T_FINAL'.
    L_SORT-UP        = 'X'.
    APPEND L_SORT TO IT_SORT.
    CLEAR L_SORT.
      L_SORT-SPOS      = '6'.
      L_SORT-FIELDNAME = 'COST'.
      L_SORT-TABNAME   = 'T_FINAL'.
      L_SORT-UP        = 'X'.
      L_SORT-SUBTOT    = 'X'.
      APPEND L_SORT TO IT_SORT.
      CLEAR L_SORT.
    S_LAYOUT-CELL_MERGE = 'X'.
    ENDFORM.                    "SORT_T_FINAL
    *&      Form  EVENT
          text
    FORM EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = I_EVENTS[].
      LOOP AT I_EVENTS.
        IF I_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
          I_EVENTS-FORM = 'T_TOP_OF_PAGE'.
        ENDIF.
        IF I_EVENTS-NAME = SLIS_EV_USER_COMMAND.
          I_EVENTS-FORM = 'USER_COMMAND'.
        ENDIF.
        MODIFY I_EVENTS.
      ENDLOOP.
    ENDFORM.                    " EVENT
    *&      Form  LAYOUT
          text
    FORM LAYOUT .
      S_LAYOUT-DETAIL_POPUP = 'X'.
    <b>  S_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.</b>
    ENDFORM.                    " LAYOUT
    *&      Form  TOP-OF-PAGE
          text
    FORM TOP-OF-PAGE .
      CLEAR LS_LINE.
      LS_LINE-TYP  = 'H'.
      LS_LINE-INFO = 'Error Trouble -by cost'.
      APPEND LS_LINE TO I_LIST_TOP_OF_PAGE.
      CLEAR LS_LINE.
    ENDFORM.                    " TOP-OF-PAGE
    *&      Form  REMOVE_SORT
          text
    FORM REMOVE_SORT.
      EXWA-FCODE = '&ODN'.
      APPEND EXWA TO EX.
      EXWA-FCODE = '&OUP'.
      APPEND EXWA TO EX.
    ENDFORM.                    "REMOVE_SORT
    *&      Form  T_TOP_OF_PAGE
          text
    FORM T_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = I_LIST_TOP_OF_PAGE[].
    ENDFORM.                   " T_TOP_OF_PAGE

  • Print headings using RSBTCHH0 on ALV grids

    Most reports I have developed use the list processing event top-of-page to print headings for the report listing by calling standard SAP subroutine BATCH-HEADING in program RSBTCHH0 when structure BHDGD has been populated. Field BHDGD-LINES contains the line size used for printing the report headings. When we use ABAP objects to print data in the ALV grid we can add the same processing to print page headings to event PRINT_TOP_OF_PAGE. It appears as if the heading data is printed until the position of last column of the grid before the text is wrapped, creating a new line. Is there anyway of controlling the default line-size when doing grid printing.
    Thanks in advance
    Colin

    Hi,
    Refer to this document for all your ALV queries:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an easy reference for alv grid control.pdf
    regards
    Aveek

  • How to set variant for ALV grid from ABAP

    Hello,
    I have a program which displays some data with ALV grid. Then after some operation I would like to set different layout for the grid, but not by choosing it manually but by the program. I thought that it would be enough to use the method SET_VARIANT, so I'm setting DISVARIANT structure properly, using SET_VARIANT method and after that I'm calling REFRESH_TABLE_DISPLAY but layout is not changed. What else should I do? Is that possible?
    Best regards,
    Marcin

    Hi,
    Check this
    * While declaring select-options
    parameters: p_vari        like ltdx-variant.  " Layout
    * then add the following code in
    at selection-screen on value-request for p_vari.
      perform f_variant_f4 using p_vari.
    * Code for f_variant_f4
    form f_variant_f4 using  p_vari.
    * private variables
      data : v_exit    type c.
      clear gs_variantt.
      v_variant_save = 'U'.
      call function 'LVC_VARIANT_F4'
        exporting
          is_variant    = gs_variant
          i_save        = v_variant_save
        importing
          e_exit        = v_exit
          es_variant    = gs_variantt
        exceptions
          not_found     = 1
          program_error = 2
          others        = 3.
      if sy-subrc ne c_0.
        message i999(yscc) with text-064.    " No Layout Available for F4
      endif.
      if v_exit is initial.
        gs_variant-variant = gs_variantt-variant.
        p_vari             = gs_variantt-variant.
      endif.
    endform.                                 " F_variant_f4
    * In PBO
        call method grid1->set_table_for_first_display
          exporting
            is_layout                     = gs_layout
            is_variant                    = gs_variant
            i_save                        = 'A'
            it_toolbar_excluding          = i_exclude[]
          changing
            it_outtab                     = i_output[]
            it_fieldcatalog               = i_fieldcat[]
          exceptions
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            others                        = 4.

  • How to remove repetition  in ALV GRID

    Dear freinds,
    In  ALV grid  iam getting repetitive for a feild Count (where iam giving count of the no of
    records .........i.e if i have four records i  have to give 4 but iam getting for all the 4 records as  4,4,4,4 in the output. Can i remove the repetation and get only once
    the value as 4 ...........Iam using the  data type for count as  INT3.
    CLEAR l_wa_sort.
    l_wa_sort-fieldname = 'COUNT'. "Field name in o/p inttable
    l_wa_sort-spos = '2'.
    l_wa_sort-tabname = 'fp_i_pyrol_final'. "Output Internal table
    l_wa_sort-up = 'X'. "Sort in ascending order
    l_wa_sort-down = ' '. "Sort in descending order
    APPEND l_wa_sort TO l_i_sort.
    However i tried changing the data type to Numc it working but total iam getting as 1 only
    not 4  which is wrong since i have four records.
    please can any one correct me what i can do in this case.
    regards
    syamla

    hi,
    REFRESH the count in the begin of the loop or at end of the loop.

  • How to add radiobuttons in ALV Grid

    Hi,
    I refered the threads in SDN but i am not able to get proper solution for my requirement.
    I am displaying output in ALV Grid format. After displaying the output i mean in the output screen i need few buttons and radio buttons . when user selects the record and clicks the radio button accordingly my logic should work. Anybody can tell me how to add the radiobuttons in the output of the screen. Please find the below output format for the requirement is
    Push button1 Pushbutton2  Radiobutton1 Radio button2
    MY program output in Grid format.
    Anybody can suggest me how to approach.
    Regards,
    Maheedhar

    Check if this link helps..
    http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-RadioButtonsinALVGRIDREPORT

  • How i use java applet data grid i have many record i need show in grid

    hi master
    sir i have many record i want show all record in applet grid how i use grid in applet
    please send me sample code of java class how send many record to grid and applet code how use applet grid
    thanks
    aamir

    Duplicate post:
    how use the jtable in java applete
    Aamir,
    If you use JApplet then you can use JTable. Just do an Internet search for "JTable" and "applet".
    Good Luck,
    Avi.

  • How to enhance mailing function ALV grid

    Hello Experts!
    I'm using the function 'REUSE_ALV_GRID_DISPLAY' to display some data in an ALV-list. Now, I want to send this information to the SAP Business Workplace to a specific distribution list. I've already created the distribution list using the transction SO15, but the thing is that I need to suggest this distribution list when the standard button "Send email" of the ALV is pressed.... Is there any way of suggest the distribution list when the standard email button is pressed? Or is it impossible and it will be necessary to create a Customer button in the toolbar program?
    Thank you so much in advance,
    Regards,
    Rebeca

    Hi Rebeca,
    Please check the below link.
    How to use distribution list and email functionality to notify business users on application errors
    Regards
    Avanida

  • How to Set Checkbox of ALV Grid Dark on Display Mode

        ABAP experts, I want to switch between display mode and edit mode for some columns of ALV Grid. So I set "LVC_S_FCAT-EDIT" "X" for the columns which need to switch mode, and use method "SET_READY_FOR_INPUT" to switch.
        Currently, the function of switch mode has been achieved. But icons of checkbox columns are light but not dark when display mode, although the columns can't be edited. (Please refer to the image below.) I want to make checkbox columns dark as other columns on display mode.
        I tried to use "CL_GUI_ALV_GRID=>MC_STYLE_ENABLED" and "CL_GUI_ALV_GRID=>MC_STYLE_DISABLED", but failed. I also studied sample program "BCALV_EDIT_05" which is related to checkbox in ALV Grid, and compared my program with this program. But I still have not found problems.
        Help me solve this problem, please.
        Part of my codes are as follows.
        Part 1:
    IF iv_is_create_group = abap_true OR iv_is_edit_group = abap_true.
           set_enable( iv_flag = 1 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             CLEAR ls_celltab.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_enabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ELSE.
           set_enable( iv_flag = 0 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_disabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ENDIF.
         CALL METHOD gr_grid->refresh_table_display
    *      EXPORTING
    *        is_stable      =
    *        i_soft_refresh =
           EXCEPTIONS
             finished       = 1
             OTHERS         = 2
         IF sy-subrc <> 0.
    *     Implement suitable error handling here
         ENDIF.
        Part 2:
    METHOD set_enable.
         gr_grid->set_ready_for_input(
             i_ready_for_input = iv_flag
    ENDMETHOD.

    Hi Liu,
        Please go through the below code.
    *& Report  YEDIT_DISPLAY
    REPORT  YEDIT_DISPLAY.
    TABLES : VBAK.
    TYPE-POOLS SLIS.
    TYPES : BEGIN OF TY_VBAK,
              VBELN TYPE VBAK-VBELN,
             END OF TY_VBAK,
             BEGIN OF TY_FINAL,
               BOX TYPE C,
               VBELN TYPE VBAK-VBELN,
             END OF TY_FINAL.
    DATA : IT_VBAK TYPE TABLE OF TY_VBAK,
            WA_VBAK TYPE TY_VBAK,
            IT_FINAL TYPE TABLE OF TY_FINAL,
            WA_FINAL TYPE TY_FINAL,
            IT_FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV,
            WA_FCAT TYPE SLIS_FIELDCAT_ALV.
    START-OF-SELECTION.
       PERFORM FETCH_DATA.
       PERFORM FCAT_DATA.
       PERFORM DISPLAY.
    *&      Form  FETCH_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FETCH_DATA .
       SELECT VBELN INTO TABLE IT_VBAK FROM VBAK UP TO 10 ROWS.
       LOOP AT IT_VBAK INTO WA_VBAK.
         WA_FINAL-VBELN = WA_VBAK-VBELN.
         APPEND WA_FINAL TO IT_FINAL.
         CLEAR : WA_FINAL , WA_VBAK.
       ENDLOOP.
    ENDFORM.                    " FETCH_DATA
    *&      Form  FCAT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FCAT_DATA .
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
       WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FCAT_DATA
    *&      Form  DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY .
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = SY-REPID
    *   I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY
    FORM USER_COMMAND USING UCOMM TYPE SY-UCOMM
                             RTAB TYPE slis_selfield.
       CASE UCOMM.
         WHEN '&IC1'.
           MESSAGE 'SUCESSFUL' TYPE 'S'.
         WHEN '&DATA_SAVE'.
           PERFORM FIL_FCAT.
           PERFORM DISPLAY1.
         WHEN 'BACK'.
           LEAVE TO SCREEN 0.
         WHEN OTHERS.
           LEAVE TO SCREEN 0.
       ENDCASE.
    ENDFORM.
    *&      Form  FIL_FCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FIL_FCAT .
    CLEAR IT_FCAT.
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
    **  WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FIL_FCAT
    *&      Form  DISPLAY1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY1 .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = SY-REPID
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY1
    Here i written code under the SAVE button , if requires you create your own status and apply.
    Regards,
    Krishna

Maybe you are looking for

  • How to retrieve a SQL query (in String format) from a PreparedStatement

    Hello all, I am in the process of unit testing an application accessing a Oracle 9i 9.2 RDBMS server with JDBC. My query is: As I have access to PreparedStatement and CallableStatement Java objets but not to the source queries which help create those

  • Need help on NAT.

    Hello folks,      I still messing about with my GSN3 lab here. My topolgy is like this : (cloud)-----(router)-----(ASA FW)----(SW)------LAN. I can ping out from the router and from the ASA firewall, but I cant figure it out how to make my LAN to ping

  • XML Editor Frame Work

    Hi , PLZ tell me any one regarding XML editor frame work . I saw the one blog in sdn but it is not help full . Points will be revert back. Thanks, Sumanth

  • HT201363 How do I authorize my computer so I can buy songs?

    I forgot my answers to my security questions.  How do I fix this?

  • Lightroom 4.3 and Photoshop CS5

    I have Lightroom 4.3 and Photoshop CS5 and want to remove both programs off the old computer and put them onto the new one is there a simple process please?