When setting up a selection screen with dynamic visibility of the controls I ran into an unexpected runtime error DYNP_TOO_MANY_RADIOBUTTONS_ON. Reduced sample code to the following reproducible example:
REPORT ztest1.
SELECTION-SCREEN BEGIN OF BLOCK category.
PARAMETER:
rb_cata RADIOBUTTON GROUP cat USER-COMMAND selection_changed DEFAULT 'X',
rb_catb RADIOBUTTON GROUP cat.
SELECTION-SCREEN END OF BLOCK category.
SELECTION-SCREEN BEGIN OF BLOCK action.
PARAMETER:
rb_act1 RADIOBUTTON GROUP act USER-COMMAND selection_changed DEFAULT 'X' MODIF ID act,
rb_act2 RADIOBUTTON GROUP act.
SELECTION-SCREEN END OF BLOCK action.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'ACT'.
screen-invisible = COND #( WHEN rb_cata = abap_true THEN 0 ELSE 1 ).
WHEN OTHERS.
ENDCASE.
MODIFY SCREEN.
ENDLOOP.
When selecting rb_catb and then re-selecting the first radiobuttion I get the runtime error DYNP_TOO_MANY_RADIOBUTTONS_ON with comment:
In a group of radio buttons, exactly one of the fields must be set - meaning that must have the value 'X'. If this is not the case, one of the following situations occurs: - Multiple radio buttons of the group are set at the same time. This error causes the appplication to terminated and triggers the short dump that you are currently reading.
But I'm only changing the visibility of the buttons, why am I getting an error relating to the actual active status?
RB_ACT1 = 'X'andRB_ACT2 = 'X'the very first time, the difference in your case is that it happens after clicking buttons. If you make it invisible and at the same time you setRB_ACT1 = ' 'then there's no error. - Sandra Rossi