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: 

Radio button in selection

Former Member
0 Kudos

Hi ,

I was using the popup_alv_selec to display some records and selecting one record.But here there is a check box,so multiple selection available.

I need only one selection.If i try to select more than one it must not allow.

or

i need to display the radio buttons instead of check box.

Can anybody help me with the code.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Please Refer following code,

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-100.

PARAMETER: rad1 TYPE c RADIOBUTTON GROUP grp1 USER-COMMAND b1.

PARAMETER: rad2 TYPE c RADIOBUTTON GROUP grp1.

SELECTION-SCREEN END OF BLOCK b1.

if rad1 eq 'X'.

write 😕 'radio button 1 is clicked'.

elseif rad2 eq 'X'

write 😕 'radio button 2 is clicked'.

endif.

thanks &regards,

Shreemohan

9 REPLIES 9

Former Member
0 Kudos

Hi,

Please Refer following code,

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-100.

PARAMETER: rad1 TYPE c RADIOBUTTON GROUP grp1 USER-COMMAND b1.

PARAMETER: rad2 TYPE c RADIOBUTTON GROUP grp1.

SELECTION-SCREEN END OF BLOCK b1.

if rad1 eq 'X'.

write 😕 'radio button 1 is clicked'.

elseif rad2 eq 'X'

write 😕 'radio button 2 is clicked'.

endif.

thanks &regards,

Shreemohan

kesavadas_thekkillath
Active Contributor
0 Kudos

hi,

check this link and search for the code samples u want

link:[Code Gallery|https://wiki.sdn.sap.com/wiki/display/Snippets/Home?showChildren=true#children]

Edited by: Keshu Thekkillam on Aug 4, 2009 11:55 AM

Former Member
0 Kudos

HI ,

use the below mentioned codes:

SELECTION-SCREEN BEGIN OF BLOCK a WITH frame title text-001.

PARAMETERS: rb_psv RADIOBUTTON GROUP rbg1 USER-COMMAND abc

DEFAULT 'X',

rb_asv RADIOBUTTON GROUP rbg1,

po_psv LIKE ibipparms-path modif id AAA,

po_asv LIKE ibipparms-path modif id BBB.

SELECTION-SCREEN END OF BLOCK a.

Regards,

Tutun

Former Member
0 Kudos

hi,

Can u please elobrate the problem so that it is more understandable.

Thanks

Suraj

0 Kudos

req is to create option buttons in ALV ....

Former Member
0 Kudos

Hi,

REPORT ZRAIDOBUTTON.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 2(10) text-003 FOR FIELD rd1 .

PARAMETERS : rd1 RADIOBUTTON GROUP rgb USER-COMMAND usd .

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 2(10) text-002 FOR FIELD rd2 .

PARAMETERS : rd2 RADIOBUTTON GROUP rgb DEFAULT 'X'.

SELECTION-SCREEN END OF LINE.

To make second button as default use below code:-

REPORT ZRADIOBUTTON.

PARAMETERS : rd1 RADIOBUTTON GROUP rgb USER-COMMAND usd ,

rd2 RADIOBUTTON GROUP rgb DEFAULT 'X'.

Former Member
0 Kudos

Hi,

Usage of Radio buttons in ALV Report output.

Steps involved.

1. Add an extra field for Radiobutton of type char with length 4.

2. Populate the values for Radiobuttons

To display Selected Radiobutton then need to use icon_radiobutton

if empty radiobutton then use icon_wd_radio_button_empty . Modify the internal table with the value.

3. Fieldcatalog Population

For the Radiobutton field mark the ICON = 'X' and HOTSPOT = 'X'.

4. Handling of the Radiobuttons in the Runtime can be done using the USER_COMMAND event.

[Complete coding|https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-RadioButtonsinALVGRIDREPORT]

Also refer Following link,

thanks &regards,

Shreemohan

Former Member
0 Kudos

venkat_o
Active Contributor
0 Kudos

Hi Ramya, Try this way to get radio buttons on ALV output.

 REPORT ztest_notepad.
 DATA: BEGIN OF it_t100 OCCURS 0,
         radbut   TYPE char4,
         arbgb    LIKE t100-arbgb,
         msgnr    LIKE t100-msgnr,
         text     LIKE t100-text,
       END OF it_t100.
 INCLUDE <icon>.
 DATA:program TYPE sy-repid VALUE sy-repid.
 TYPE-POOLS slis.
 DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
      wa_fieldcat LIKE LINE OF it_fieldcat.
 DEFINE fieldcatalog.
   wa_fieldcat-fieldname = &1.
   wa_fieldcat-tabname   = 'IT_T100'.
   wa_fieldcat-icon      = &2.
   wa_fieldcat-hotspot   = &3.
   wa_fieldcat-seltext_m = &4.
   append wa_fieldcat to it_fieldcat.
   clear  wa_fieldcat.
 END-OF-DEFINITION.

 START-OF-SELECTION.
   SELECT * FROM t100 INTO TABLE it_t100 UP TO 100 ROWS.
   LOOP AT it_t100.
     IF sy-tabix = 1.
       it_t100-radbut = icon_radiobutton.
     ELSE.
       it_t100-radbut = icon_wd_radio_button_empty.
     ENDIF.
     MODIFY it_t100 INDEX sy-tabix TRANSPORTING radbut.
   ENDLOOP.
   fieldcatalog: 'RADBUT' 'X' 'X' 'CHECKBOX',
                 'ARBGB'    ''  ''  'ARBGB'   ,
                 'MSGNR'    ''  ''  'MSGNR'   ,
                 'TEXT'     ''  ''  'TEXT'    .
   CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
     EXPORTING
       i_callback_program      = program
       i_callback_user_command = 'USER_COMMAND'
       it_fieldcat             = it_fieldcat
     TABLES
       t_outtab                = it_t100.
*&---------------------------------------------------------------------*
*&      Form  user_command
*&---------------------------------------------------------------------*
 FORM user_command USING ucomm TYPE sy-ucomm selfield TYPE slis_selfield.
   IF ucomm = '&IC1'.
     READ TABLE it_t100 INDEX selfield-tabindex.
     CASE selfield-fieldname.
       WHEN 'RADBUT'.
         IF it_t100-radbut NE icon_radiobutton.
           READ TABLE it_t100 WITH KEY radbut = icon_radiobutton.
           IF sy-subrc EQ 0.
             it_t100-radbut = icon_wd_radio_button_empty.
             MODIFY it_t100 INDEX sy-tabix.
             it_t100-radbut = icon_radiobutton.
             MODIFY it_t100 INDEX selfield-tabindex TRANSPORTING radbut.
           ENDIF.
         ENDIF.
     ENDCASE.
     selfield-refresh = 'X'.
   ENDIF.
 ENDFORM.                    "user_command
Thanks Venkat.O