Skip to Content
author's profile photo Former Member
Former Member

Radio Button on a ALV

Hello Everyone,

My question is. Whether is it possible to place a radio button on an ALV output screen.If yes what is the relevant code.

I have tried placing a check box on the output screen it worked.

Regards,

Ranjith N

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2008 at 04:58 AM

    Check this link,

    https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-RadioButtonsinALVGRIDREPORT

    Regards,

    Midhun Abraham

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2008 at 05:13 AM

    Hi Abraham,

    I will revert to you after checking the same.

    Thanks and regards,

    Ranjith N

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2008 at 09:12 AM

    Hi Midhun,

    Thank you for the same, this link has solved my problem.

    But i tried same example by calling the function

    REUSE_ALV_LIST_DISPLAY but instead of getting a radio button, it was displaying " ### ".

    What could be the reason for not displaying radio button with the

    " REUSE_ALV_LIST_DISPLAY function ".

    Regards,

    Ranjith Nambiar.

    Add a comment
    10|10000 characters needed characters exceeded

    • It is working fine for me. here is the code with list display function check it once.

      REPORT  ztest_alv_radio.
      TYPE-POOLS: slis.
      type-pools: icon.
      DATA: it_fcat TYPE slis_t_fieldcat_alv ,
            wa_fcat LIKE LINE OF it_fcat.
      DATA: BEGIN OF it_alv_flight OCCURS 0,
             carrid TYPE sflight-carrid,
             connid TYPE sflight-connid,
             radio1(4),                            "Radio button
             radio2(4),
            END OF it_alv_flight.
      SELECT carrid connid FROM sflight
      INTO TABLE it_alv_flight
      UP TO 20 ROWS.
      LOOP AT it_alv_flight.
        it_alv_flight-radio1 = icon_wd_radio_button_empty.  "Empty Radio Buttons
        it_alv_flight-radio2 =  icon_wd_radio_button_empty..
        MODIFY it_alv_flight.
      ENDLOOP.
      wa_fcat-fieldname = 'RADIO1'.
      wa_fcat-tabname = 'IT_ALV_FLIGHT'.
      wa_fcat-seltext_l = 'RADIO1'.
      wa_fcat-outputlen = 6.
      wa_fcat-icon = 'X'.                     "Icons
      wa_fcat-hotspot = 'X'.               "Interactive Handling
      APPEND wa_fcat TO it_fcat.
      wa_fcat-fieldname = 'RADIO2'.
      wa_fcat-tabname = 'IT_ALV_FLIGHT'.
      wa_fcat-seltext_l = 'RADIO2'.
      wa_fcat-icon = 'X'.
      wa_fcat-outputlen = 6.
      APPEND wa_fcat TO it_fcat.
      CLEAR wa_fcat.
      wa_fcat-fieldname = 'CARRID'.
      wa_fcat-tabname = 'IT_ALV_FLIGHT'.
      wa_fcat-seltext_l = 'Carrid'.
      wa_fcat-outputlen = 7.
      APPEND wa_fcat TO it_fcat.
      wa_fcat-fieldname = 'CONNID'.
      wa_fcat-tabname = 'IT_ALV_FLIGHT'.
      wa_fcat-seltext_l = 'Carrid'.
      wa_fcat-outputlen = 7.
      APPEND wa_fcat TO it_fcat.
      
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program      = sy-repid
          i_callback_user_command = 'USER_COMMAND'
          it_fieldcat             = it_fcat
        TABLES
          t_outtab                = it_alv_flight
        EXCEPTIONS
          program_error           = 1.
      
      FORM user_command USING ucomm TYPE sy-ucomm
      selfield TYPE slis_selfield.
        CASE ucomm.
          WHEN '&IC1'.
            READ TABLE it_alv_flight INDEX selfield-tabindex.
            CASE selfield-fieldname.
              WHEN 'RADIO1'.
                IF it_alv_flight-radio1 = icon_radiobutton.
                  it_alv_flight-radio1 = icon_wd_radio_button_empty.
                  MODIFY it_alv_flight  INDEX selfield-tabindex
                                            TRANSPORTING radio1.
                ELSE.
                  it_alv_flight-radio1 = icon_radiobutton..
                  MODIFY it_alv_flight INDEX selfield-tabindex
                                            TRANSPORTING radio1.
                ENDIF.
              WHEN 'RADIO2'.
                IF it_alv_flight-radio2 = icon_radiobutton.
                  it_alv_flight-radio2 = icon_wd_radio_button_empty.
                  MODIFY it_alv_flight  INDEX selfield-tabindex
                  TRANSPORTING radio2.
                ELSE.
                  it_alv_flight-radio2 = icon_radiobutton..
                  MODIFY it_alv_flight  INDEX selfield-tabindex
                  TRANSPORTING radio2.
                ENDIF.
            ENDCASE.
        ENDCASE.
        selfield-refresh = 'X'.
      ENDFORM.                    "USER_COMMAND

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2008 at 12:48 PM

    Hi Vijay,

    This time your code worked.Thanks for the same.

    Regards,

    Ranjith Nambiar.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.