Application Development 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: 

Checkboxes within Radiobutton group?

Former Member
0 Kudos

Hi Gurus,

I have a requirement for report where in i need to display checkboxes within radiobutton group.

Example:

RadioButton_1

CheckBox_1

CheckBox_2

CheckBox_3

RadioButton_2

CheckBox_4

CheckBox_5

CheckBox_6

Requirement: I should be able to select checkbox 1, 2, 3..any one or all....

but not checkbox in other radiobutton.(4,5,or/6) if i select radio_1.

How do i do that. is it possible?

Thanks,

Rashmi

9 REPLIES 9

JozsefSzikszai
Active Contributor
0 Kudos

hi,

pls. try the following code:

PARAMETERS : p_rb1 RADIOBUTTON GROUP 1 DEFAULT 'X' USER-COMMAND uc01,
             p_cb1 AS CHECKBOX MODIF ID cb1,
             p_cb2 AS CHECKBOX MODIF ID cb1,
             p_cb3 AS CHECKBOX MODIF ID cb1,
             p_rb2 RADIOBUTTON GROUP 1,
             p_cb4 AS CHECKBOX MODIF ID cb2,
             p_cb5 AS CHECKBOX MODIF ID cb2,
             p_cb6 AS CHECKBOX MODIF ID cb2.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
    CASE 'X'.
      WHEN p_rb1.
        CASE screen-group1.
          WHEN 'CB1'.
            screen-input = '1'.
          WHEN 'CB2'.
            screen-input = '0'.
        ENDCASE.
      WHEN p_rb2.
        CASE screen-group1.
          WHEN 'CB1'.
            screen-input = '0'.
          WHEN 'CB2'.
            screen-input = '1'.
        ENDCASE.
    ENDCASE.
    MODIFY SCREEN.
  ENDLOOP.

hope this helps

ec

Former Member
0 Kudos

Hi Rashmi,

I think if you select one radio button then there is not need of any code since either your radio_1 or radio_2 will be selected if you declare 2 radiobuttons in a single group.

If you can add some more information in the post will be better .

Former Member
0 Kudos

Hi,

Check this sample code


REPORT z_sdn.


PARAMETERS:
  p_num RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND abc,
  p_char RADIOBUTTON GROUP rad1.

PARAMETERS:
  p_num1 AS CHECKBOX MODIF ID num,
  p_num2 AS CHECKBOX MODIF ID num,
  p_char1 AS CHECKBOX MODIF ID chr,
  p_char2 AS CHECKBOX MODIF ID chr.

AT SELECTION-SCREEN OUTPUT.
  IF p_num EQ 'X'.
    LOOP AT SCREEN.
      IF screen-group1 EQ 'CHR'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 EQ 'NUM'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

Regards

Abhijeet

Former Member
0 Kudos

Thanks a lot gurus,

I am using Module pool. I am including the peice i code in my PBO.

Guess its not working.!!!

-


IF radio_1 EQ 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'ID1'. "(MODIF ID ID1)

screen-input = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSE.

LOOP AT SCREEN.

IF screen-group1 = 'ID2'. " (MODIF ID ID2)

screen-input = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Could you pls suggest.

Thanks a lot once again,

Rashmi

0 Kudos

Hi,

Implement this code in PAI as while clicking the radiobuttons, you are interacting with screen.

Regards

Abhijeet

0 Kudos

Hi Abhishek,

Doesnot seem to work in PAI.

Thanks,

Rashmi

0 Kudos

Could not include in PAI/PBO modules. I am doing like this, and it works!

But it works only one time, because..

WHile defining parameters, i am giving one radio button as default 'X'

So, it acts accordingly.

Later in the program,

Even if i am allowed to change the radio button, the checkboxes are already disabled.

Only The one which enabled is present.

How do i proceed.

Thanks a lot for all the guidance.

Rashmi

_______________code________________

AT SELECTION-SCREEN OUTPUT.

IF radio_1 EQ 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'ID1'.

screen-input = 1.

MODIFY SCREEN.

ENDIF.

IF screen-group1 = 'ID2'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSE.

LOOP AT SCREEN.

IF screen-group1 = 'ID2'.

screen-input = 1.

MODIFY SCREEN.

ENDIF.

IF screen-group1 = 'ID1'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

0 Kudos

try this code , it works .

make sure that you define a function code "R1" for your radio button


DATA : r1 TYPE c,
       r2 TYPE c,
       p1 TYPE c,
       p2 TYPE c,
       p3 TYPE c,
       p4 TYPE c,
       p5 TYPE c,
       p6 TYPE c.
data : ok_code type sy-ucomm.
CALL SCREEN 9000.
*&---------------------------------------------------------------------*
*&      Module  STATUS_9000  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_9000 OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.
    ok_code = sy-ucomm.
  CASE ok_code .
    WHEN 'R1'."R1 is the function code assigned to the radio button
    LOOP AT SCREEN .
    IF r2 = 'X' AND  screen-group1 = 'M1'.
      screen-input  = '0'.
      MODIFY SCREEN.
    ENDIF.
    IF r1 = 'X' AND  screen-group1 = 'M2'.
      screen-input  = '0'.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
  ENDCASE.
ENDMODULE.                 " STATUS_9000  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_9000  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_9000 INPUT.
ENDMODULE.                 " USER_COMMAND_9000  INPUT

screen flow logic


PROCESS BEFORE OUTPUT.
 MODULE STATUS_9000.
*
PROCESS AFTER INPUT.
 MODULE USER_COMMAND_9000.

0 Kudos

>

> Could not include in PAI/PBO modules. I am doing like this, and it works!

> But it works only one time, because..

> WHile defining parameters, i am giving one radio button as default 'X'

> So, it acts accordingly.

>

> Later in the program,

> Even if i am allowed to change the radio button, the checkboxes are already disabled.

> Only The one which enabled is present.

> How do i proceed.

see again my sample (above)! Is the USER-COMMAND addition there in your coding, after the definition of the radiobutton?