how to switch two fields with one of them OBLIGATORY
i have two radio button on the screen: RD_A and RD_B, while there are two fields corresponding to them: P_A and P_B, P_A is OBLIGATORY.
i want to implment: when i click RD_A, field P_A is enable and field p_B is disable. when i click RD_B, field P_B is enable and field P_A is disable.
i tried using LOOP AT SCREEN ...screen-input = '0' and screen-required = '0' ....MODIFY SCREEN...statements, but it cannot work fine. when i switch from A to B, it always popup error message 'Fill in all required entry fields'.
can anyone help me? thanks in advance!
Vijay Dudla replied
you can try this approach, instead of using Obligatory Addition.
REPORT ztest_radio. TABLES: sflight. SELECT-OPTIONS: carrid FOR sflight-carrid, connid FOR sflight-connid. PARAMETERS: r1 RADIOBUTTON GROUP g1 USER-COMMAND abc DEFAULT 'X', r2 RADIOBUTTON GROUP g1. AT SELECTION-SCREEN OUTPUT. IF r1 = 'X'. LOOP AT SCREEN. IF screen-name CS 'CONNID'. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ELSE. LOOP AT SCREEN. IF screen-name CS 'CARRID'. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. AT SELECTION-SCREEN. IF sy-ucomm = 'ONLI'. "This triggers only when you press execute button IF r1 = 'X'. IF carrid IS INITIAL. MESSAGE 'Enter Carrid' TYPE 'E'. ENDIF. ELSE. IF connid IS INITIAL. MESSAGE 'Enter Connid' TYPE 'E'. ENDIF. ENDIF. ENDIF.