Hello,

Sign up to join our community!

Welcome Back,

Please sign in to your account!

Forgot Password,

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask a question.

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

SAP EWM Help Latest Questions

  • 0
  • 0
DPM125

Dynamic Screen Modification in SAP ABAP Using Radio Buttons

*&---------------------------------------------------------------------*
*& Report  ZTEST_PROGRAM_2
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ztest_program_2.

*--- Radio Buttons
PARAMETERSr_opt1 RADIOBUTTON GROUP grp DEFAULT 'X' USER-COMMAND rad,
            r_opt2 RADIOBUTTON GROUP grp,
            r_opt3 RADIOBUTTON GROUP grp.

*--- Fields controlled by radio buttons
PARAMETERSp_field1 TYPE char20,
            p_field2 TYPE char20,
            p_field3 TYPE char20.

*--- Screen Modification
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
CASE screen-name.
WHEN 'P_FIELD1'.
screen-active COND #WHEN r_opt1 'X' THEN ELSE ).
WHEN 'P_FIELD2'.
screen-active COND #WHEN r_opt2 'X' THEN ELSE ).
WHEN 'P_FIELD3'.
screen-active COND #WHEN r_opt3 'X' THEN ELSE ).
ENDCASE.
MODIFY SCREEN.
ENDLOOP.

*--- Output
START-OF-SELECTION.
WRITE/ 'Option 1:'r_opt1,
         / 'Option 2:'r_opt2,
         / 'Option 3:'r_opt3,
         / 'Field1:'p_field1,
         / 'Field2:'p_field2,
         / 'Field3:'p_field3.

Output:

This ABAP program ZRADIO_DEMO demonstrates how to create a dynamic selection screen using radio buttons. It defines three radio buttons, where only one can be selected at a time, and three corresponding input fields (p_field1, p_field2, p_field3). The logic inside the AT SELECTION-SCREEN OUTPUT event uses a LOOP AT SCREEN to check which radio button is active and then enable or disable the related input field accordingly, making the other fields invisible. This ensures that only the field relevant to the selected option is shown to the user. Finally, in the START-OF-SELECTION block, the program outputs the selected option and the entered values. Overall, the code provides a simple but effective example of how to use radio buttons to control screen modifications in SAP reports, making the user interface more interactive and user-friendly.

Related Questions

Leave an answer

Leave an answer