Skip to Content
0
Former Member
Nov 02, 2010 at 02:41 PM

alv - select one line only

193 Views

Hi i use the above part of code. the output is an alv and the user can select more than one line which is wrong. Only one line to be selected.

* Data for ALV grid...
  data: w_repid            like sy-repid,
        my_layout          type slis_layout_alv,
        g_save type c value 'X',         "Use all ALV variant types
        it_fieldcatalog    type slis_t_fieldcat_alv,
        wa_fieldcatalog    like line of it_fieldcatalog,
        it_sort            type slis_t_sortinfo_alv,
        wa_sort            like line of it_sort.

  w_repid = sy-repid.

  data: lc_glay type lvc_s_glay.

  my_layout-box_fieldname = 'SEL'.
  lc_glay-edt_cll_cb = 'X'.
  my_layout-colwidth_optimize = 'X'.
  my_layout-cell_merge = 'X'.
  my_layout-zebra = 'X'.
*my_layout-sel_mode = ''.


****
** The follwing function module determine
** what fields are to be shown on screen
** Here you should change only the internal table
** name that is to be output.
** Care to put the name in CAPITAL.
****
  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
 exporting
     i_program_name               = w_repid
     i_internal_tabname           = 'ITAB' " need to be changed
*   I_STRUCTURE_NAME             =
     i_inclname                  = w_repid
    changing
      ct_fieldcat                  = it_fieldcatalog
   exceptions
     inconsistent_interface       = 1
     program_error                = 2
     others                       = 3.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.