Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

alv - select one line only

Former Member
0 Kudos

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.


1 ACCEPTED SOLUTION

kesavadas_thekkillath
Active Contributor
0 Kudos

my_layout-sel_mode - you may have to assign value to this. I have never done this way

Easy work around is you can display an option button as icon and do it .

You can refer this wiki link:[http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-RadioButtonsinALVGRIDREPORT]

5 REPLIES 5

kesavadas_thekkillath
Active Contributor
0 Kudos

my_layout-sel_mode - you may have to assign value to this. I have never done this way

Easy work around is you can display an option button as icon and do it .

You can refer this wiki link:[http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-RadioButtonsinALVGRIDREPORT]

0 Kudos

i tried this but sel_mode is unknown in 4.6c . i wiil try with the 'radiobutton' idea.

0 Kudos

This link says how to use sel_mode

link:[Properties of the ALV Grid Control |http://help.sap.com/saphelp_nw70/helpdata/EN/ef/a2e9eff88311d2b48d006094192fe3/frameset.htm]

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

Try using my_layout-sel_mode = 'S'.

roberto_vacca2
Active Contributor
0 Kudos

Hi.

You can activate hotspot parameter of CT_FIELDCAT..

Bye,