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

Hide selection screen based on radio button.

Former Member
0 Likes
20,334

I'm new to abap. Toggling(hide) the selection screens based on radio button input. But the code seems not working.

* Radio button block
SELECTION-SCREEN BEGIN OF BLOCK search_block WITH FRAME TITLE text-001.
PARAMETER: rad_flt RADIOBUTTON GROUP rgb DEFAULT 'X',
 rad_cus RADIOBUTTON GROUP rgb.
SELECTION-SCREEN END OF BLOCK search_block.


* Selection screen 1
SELECTION-SCREEN BEGIN OF BLOCK flight_block WITH FRAME TITLE text-002.
PARAMETER: carrid TYPE sbook-carrid,
 connid TYPE sbook-connid,
 fldate TYPE sbook-fldate MODIF ID sc1.
SELECTION-SCREEN END OF BLOCK flight_block.


*Selection screen 2
SELECTION-SCREEN BEGIN OF BLOCK customid_block WITH FRAME TITLE text-002.
PARAMETER: customid TYPE sbook-customid MODIF ID sc2.
SELECTION-SCREEN END OF BLOCK customid_block.


AT SELECTION-SCREEN OUTPUT.
* Toggle the selection screens based on radio buttons
 LOOP AT SCREEN.
 IF rad_flt = 'X' AND screen-group1 = 'sc2'.
 screen-active = 0.
 MODIFY SCREEN.
 ELSEIF rad_cus = 'X' AND screen-group1 = 'sc1'.
 screen-active = 0.
 MODIFY SCREEN.
 ENDIF.
 ENDLOOP.

Thanks in advance.

I'm new to abap. Toggling(hide) the selection screens based on radio button input. But the code seems not working.

* Radio button block
SELECTION-SCREEN BEGIN OF BLOCK search_block WITH FRAME TITLE text-001.
PARAMETER: rad_flt RADIOBUTTON GROUP rgb DEFAULT 'X',
 rad_cus RADIOBUTTON GROUP rgb.
SELECTION-SCREEN END OF BLOCK search_block.


* Selection screen 1
SELECTION-SCREEN BEGIN OF BLOCK flight_block WITH FRAME TITLE text-002.
PARAMETER: carrid TYPE sbook-carrid,
 connid TYPE sbook-connid,
 fldate TYPE sbook-fldate MODIF ID sc1.
SELECTION-SCREEN END OF BLOCK flight_block.


*Selection screen 2
SELECTION-SCREEN BEGIN OF BLOCK customid_block WITH FRAME TITLE text-002.
PARAMETER: customid TYPE sbook-customid MODIF ID sc2.
SELECTION-SCREEN END OF BLOCK customid_block.


AT SELECTION-SCREEN OUTPUT.
* Toggle the selection screens based on radio buttons
 LOOP AT SCREEN.
 IF rad_flt = 'X' AND screen-group1 = 'sc2'.
 screen-active = 0.
 MODIFY SCREEN.
 ELSEIF rad_cus = 'X' AND screen-group1 = 'sc1'.
 screen-active = 0.
 MODIFY SCREEN.
 ENDIF.
 ENDLOOP.

Thanks in advance.

4 REPLIES 4
Read only

Sandra_Rossi
Active Contributor
16,414

Question also asked at StackOverflow with a comment/answer.

Read only

dev_parbutteea
Active Contributor
0 Likes
16,414
Read only

former_member1716
Active Contributor
16,414

Hello,

Two Mistakes from Your end:

1) You did not Assign USER COMMAND value to your radio button group.

2) In the Loop at screen, you are comparing SC1 and SC2 using lowercase.

Below is the correct code for your reference.


SELECTION-SCREEN BEGIN OF BLOCK search_block WITH FRAME TITLE TEXT-001.
PARAMETER: rad_flt RADIOBUTTON GROUP rgb USER-COMMAND cmd_rd DEFAULT 'X',
           rad_cus RADIOBUTTON GROUP rgb.
SELECTION-SCREEN END OF BLOCK search_block.

* Selection screen 1
SELECTION-SCREEN BEGIN OF BLOCK flight_block WITH FRAME TITLE TEXT-002.
PARAMETER: carrid TYPE sbook-carrid,
           connid TYPE sbook-connid,
           fldate TYPE sbook-fldate MODIF ID sc1.
SELECTION-SCREEN END OF BLOCK flight_block.

*Selection screen 2
SELECTION-SCREEN BEGIN OF BLOCK customid_block WITH FRAME TITLE TEXT-003.
PARAMETER: customid TYPE sbook-customid MODIF ID sc2.
SELECTION-SCREEN END OF BLOCK customid_block.

AT SELECTION-SCREEN OUTPUT.
* Toggle the selection screens based on radio buttons
  LOOP AT SCREEN.
    IF rad_flt = 'X' AND screen-group1 = 'SC2'.
      screen-active = 0.
      MODIFY SCREEN.
    ELSEIF rad_cus = 'X' AND screen-group1 = 'SC1'.
      screen-active = 0.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

Regards!
Read only