Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[ABAP] Activate and deactivate input fields via radiobuttons

*-----------------------------------------------------------------------
* SELEKTIONSBILD
*-----------------------------------------------------------------------
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

* Radiobutton 1 -> Deactivate Fields
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: p_radio1 RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND rad.
SELECTION-SCREEN COMMENT 6(37) text-t01 FOR FIELD p_radio1.  
SELECTION-SCREEN : END OF LINE.

* Radiobutton 2 -> Activate Fields
SELECTION-SCREEN : BEGIN OF LINE.
PARAMETERS: p_radio2 RADIOBUTTON GROUP rad1.
SELECTION-SCREEN COMMENT 6(37) text-t02 FOR FIELD p_radio2.
SELECTION-SCREEN : END OF LINE.

* Input fields
PARAMETERS:
  p_vorna TYPE vorna OBLIGATORY DEFAULT 'Max',
  p_nachn TYPE nachn OBLIGATORY DEFAULT 'Mustermann'.

SELECTION-SCREEN END OF BLOCK b1.


*----------------------------------------------------------------------
* AT SELECTION-SCREEN
*----------------------------------------------------------------------
AT SELECTION-SCREEN OUTPUT. " PBO
  LOOP AT SCREEN.
    CASE screen-name.
      WHEN 'P_VORNA' OR 'P_NACHN'.
        screen-input = COND #( WHEN p_radio2 = abap_true THEN 1 ELSE 0 ).
        MODIFY SCREEN.
    ENDCASE.
  ENDLOOP.