Application Development and Automation 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: 
Read only

React on click first radio button

MKusters
Explorer
0 Likes
3,103

Hi all,

I have a report with several radio buttons which are disabled dynamically based on the number of records in a internal table. The first radio button is always enabled (default). Now I want to click on the first radio button and execute a action (f.e. show popup). But when I click on the radio button nothing happens. When I have two or more radiobuttons (in the same group) and I click on the second then the action is fired. Now when I click on the first the action is also fired.

Is there a possibility to fire a event when the first radio button is already selected (at first run) and you click on it (without switching)?

REPORT zstb_bijzondere_bepalingen.

DEFINE radio_but1.
  PARAMETERS:&1 RADIOBUTTON GROUP gr1 USER-COMMAND click DEFAULT 'X'.
END-OF-DEFINITION.
DEFINE radio_but2.
  PARAMETERS:&1 RADIOBUTTON GROUP gr1.
END-OF-DEFINITION.
radio_but1:new.
radio_but2:r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15.
radio_but2:r16,r17,r18,r19,r20,r21,r22,r23,r24,r25,r26,r27,r28,r29,r30.

DATA: rad TYPE char3.
DATA: sy_index TYPE char2.

INITIALIZATION.
 count = 30.

AT SELECTION-SCREEN OUTPUT.

  sy-tfill = count. "THIS IS THE NUMBER OF RADIO BUTTONS THAT WILL BE CREATED
  sy_index = 1.
  LOOP AT SCREEN.
      CONCATENATE 'R' sy_index INTO rad.
      IF screen-name = rad.
        IF sy_index GT count.
          screen-active = '0'.
          MODIFY SCREEN.
          sy_index = sy_index + 1.
          CONTINUE.
        ENDIF.
        sy_index = sy_index + 1.
      ENDIF.
  ENDLOOP.

AT SELECTION-SCREEN ON RADIOBUTTON GROUP gr1.
*AT SELECTION-SCREEN.
  IF sy-ucomm = 'CLICK'.
    CASE 'X'.
      WHEN new.
        CALL FUNCTION 'POPUP_TO_CONFIRM'
          EXPORTING
            text_question = 'do you want to continue 2'.
      WHEN OTHERS.
        CALL FUNCTION 'POPUP_TO_CONFIRM'
          EXPORTING
            text_question = 'do you want to continue'.
    ENDCASE.
  ENDIF.

Hi all,

I have a report with several radio buttons which are disabled dynamically based on the number of records in a internal table. The first radio button is always enabled (default). Now I want to click on the first radio button and execute a action (f.e. show popup). But when I click on the radio button nothing happens. When I have two or more radiobuttons (in the same group) and I click on the second then the action is fired. Now when I click on the first the action is also fired.

Is there a possibility to fire a event when the first radio button is already selected (at first run) and you click on it (without switching)?

REPORT zstb_bijzondere_bepalingen.

DEFINE radio_but1.
  PARAMETERS:&1 RADIOBUTTON GROUP gr1 USER-COMMAND click DEFAULT 'X'.
END-OF-DEFINITION.
DEFINE radio_but2.
  PARAMETERS:&1 RADIOBUTTON GROUP gr1.
END-OF-DEFINITION.
radio_but1:new.
radio_but2:r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15.
radio_but2:r16,r17,r18,r19,r20,r21,r22,r23,r24,r25,r26,r27,r28,r29,r30.

DATA: rad TYPE char3.
DATA: sy_index TYPE char2.

INITIALIZATION.
 count = 30.

AT SELECTION-SCREEN OUTPUT.

  sy-tfill = count. "THIS IS THE NUMBER OF RADIO BUTTONS THAT WILL BE CREATED
  sy_index = 1.
  LOOP AT SCREEN.
      CONCATENATE 'R' sy_index INTO rad.
      IF screen-name = rad.
        IF sy_index GT count.
          screen-active = '0'.
          MODIFY SCREEN.
          sy_index = sy_index + 1.
          CONTINUE.
        ENDIF.
        sy_index = sy_index + 1.
      ENDIF.
  ENDLOOP.

AT SELECTION-SCREEN ON RADIOBUTTON GROUP gr1.
*AT SELECTION-SCREEN.
  IF sy-ucomm = 'CLICK'.
    CASE 'X'.
      WHEN new.
        CALL FUNCTION 'POPUP_TO_CONFIRM'
          EXPORTING
            text_question = 'do you want to continue 2'.
      WHEN OTHERS.
        CALL FUNCTION 'POPUP_TO_CONFIRM'
          EXPORTING
            text_question = 'do you want to continue'.
    ENDCASE.
  ENDIF.

7 REPLIES 7
Read only

FredericGirod
Active Contributor
0 Likes
2,674

Maybe you could replace your radiobutton by parameters and simulate the radiobutton functionality. And with parameters you could set all to blank.

Read only

0 Likes
2,674

I don't really get your suggested solution. Do you have a example?

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,674

Please use the debugger!

Read only

MKusters
Explorer
0 Likes
2,674

That's the problem! It is not triggered on any place.

Read only

michael_piesche
Active Contributor
0 Likes
2,674

You could do one of two things pretty easy:

  1. Declare a further dummy radio-button dmy, that does nothing, but is selected by default
    Any change from dmy to another new or rx button will trigger the event
    (After the first switch from dmy to new or rx, you could also hide dmy again)
  2. Implement the radio-button functionality yourself with using checkboxes instead.
    Declare ALL your radio-buttons as checkbox and have initially none of them checked by default:
    PARAMETERS: &1 TYPE char1 AS CHECKBOX USER-COMMAND click.
    Have a shadow table that stores the current values of checked vs. unchecked (e.g. TYPE TABLE OF CHAR1 or also by macro: DATA: &1 TYPE char1, whereas &1 is eg d1, d2, etc.)
    AT SELECTION-SCREEN, compare the current values to the new values, if there is a change (more than one selected) deselect the one that was selected before.
Read only

michael_piesche
Active Contributor
0 Likes
2,674

michael.kusters2, please follow up on your open question.

  • comment answers or your question if there are still open issues.
  • otherwise mark an answer as accepted if it helped you solve your problem
  • or post an answer of yourself and accept it if you found another useful solution yourself
  • or redirect your question to another question that is related and was useful to solve your problem
  • in the end, close your question