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: 

Problem with the Radio button checking

Former Member
0 Kudos

Hi Experts,

I have 2 blocks in the selection screen. In block1 I have 2 radio buttons say A & B and in block2 I have 4 radio buttons say C, D, E & F.Now my requirement is when button A is checked button C should get checked automatically. If button B is checked then button D should be checked and vice versa.

Thanks in advance.

Regards,

Ullas.

11 REPLIES 11

Former Member
0 Kudos

Hi Ullas,

If you use radiobuttons, then the problem is that the user can change the selection several times before control passes to any of your code (e.g., when the user executes or presses return).

If you want something that works more immediately, then use pushputtons.

OK, they're clumsier, and you have to do the logic yourself to make them act like radiobuttons.

But the payoff is that the user sees the screen change right away.

Use AT SELECTION-SCREEN to store the UCOMM value (indicates the choice of button), and use AT SELECTION-SCREEN OUTPUT for your changes to your screen.

You could invent a way to show the chosen buttons, say by having tick icons on them.

John

0 Kudos

Hi John,

Thanks for your Reply.

But my requirement is to use only Radio Buttons.

Regards,

Ullas

0 Kudos

Hi,

I retract my answer.

You have some good replies, like that from Eric Cartman.

John

Former Member
0 Kudos

Hi Ullas.

Try using following code

At selection-screen.

If radA = 'X'.

RadB = 'X'.

elseif RadB = 'X'.

radA = 'X'.

endif.

Similarly you can do it for other radio buttons.

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Feb 8, 2008 11:29 AM

0 Kudos

Hi Ankit,

I did write the logic on the same grounds,but this is not working.

Thanks for your Reply,

Regards,

Ullas.

JozsefSzikszai
Active Contributor
0 Kudos

hi Ullas,

pls. have a look:

PARAMETERS : a RADIOBUTTON GROUP 1 USER-COMMAND uc01,

b RADIOBUTTON GROUP 1,

c RADIOBUTTON GROUP 2 USER-COMMAND uc02,

d RADIOBUTTON GROUP 2,

e RADIOBUTTON GROUP 2,

f RADIOBUTTON GROUP 2.

AT SELECTION-SCREEN.

CASE sy-ucomm.

WHEN 'UC01'.

IF a = 'X'.

CLEAR : d,

e,

f.

c = 'X'.

ELSEIF b = 'X'.

CLEAR : c,

e,

f.

d = 'X'.

ENDIF.

WHEN 'UC02'.

IF c = 'X'.

CLEAR : b.

a = 'X'.

ELSEIF d = 'X'.

CLEAR : a.

b = 'X'.

ENDIF.

ENDCASE.

hope this helps

ec

Former Member
0 Kudos

Check this



SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS : a RADIOBUTTON GROUP grp USER-COMMAND cmd DEFAULT 'X'.
PARAMETERS : b RADIOBUTTON GROUP grp .
SELECTION-SCREEN END OF BLOCK b1.


SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
PARAMETERS : c RADIOBUTTON GROUP pg.
PARAMETERS : d RADIOBUTTON GROUP pg.
PARAMETERS : e RADIOBUTTON GROUP pg.
PARAMETERS : f RADIOBUTTON GROUP pg.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN.
  LOOP AT SCREEN.
    IF a = 'X'.
      CLEAR d.
      c  = 'X'.
      MODIFY SCREEN.
    ENDIF.
    IF b = 'X'.
      CLEAR c.
      d = 'X'.

      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

Former Member
0 Kudos

Hi Ullas

Please try this. Its working vice versa also.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

PARAMETERS : a RADIOBUTTON GROUP grp USER-COMMAND CMD DEFAULT 'X'.

PARAMETERS : b RADIOBUTTON GROUP grp .

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.

PARAMETERS : c RADIOBUTTON GROUP pg USER-COMMAND YYY.

PARAMETERS : d RADIOBUTTON GROUP pg.

PARAMETERS : e RADIOBUTTON GROUP pg.

PARAMETERS : f RADIOBUTTON GROUP pg.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN.

CASE SY-UCOMM.

WHEN 'CMD'.

LOOP AT SCREEN.

IF a = 'X'.

CLEAR d.

c = 'X'.

MODIFY SCREEN.

ENDIF.

IF b = 'X'.

CLEAR c.

d = 'X'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

WHEN 'YYY'.

LOOP AT SCREEN.

IF c ='X'.

clear b.

a = 'X'.

modify screen.

endif.

if d = 'X'.

clear a.

b = 'X'.

modify screen.

endif.

ENDLOOP.

ENDCASE.

Redg,

Madhu

Former Member
0 Kudos

Hi,

try this code.

parameters:

p_a radiobutton group g1 user-command rad,

p_b radiobutton group g1,

p_c radiobutton group g2,

p_d radiobutton group g2.

at selection-screen.

if sy-ucomm eq 'rad'.

if p_a eq 'X'.

CLEAR P_D.

P_C = 'X'.

ENDIF.

IF P_B EQ 'X'.

CLEAR P_C.

P_D = 'X'.

ENDIF.

endif.

Plzz reward points if helps

Former Member
0 Kudos

Hi

see this with 2 radiobuttons

******DATA DECLARATIONS**********

DATA : BEGIN OF IT_PLANT OCCURS 0,

MATNR LIKE MARA-MATNR,

WERKS LIKE MARC-WERKS,

PSTAT LIKE MARC-PSTAT,

EKGRP LIKE MARC-EKGRP,

END OF IT_PLANT.

DATA : BEGIN OF IT_PONO OCCURS 0,

EBELN LIKE EKKO-EBELN,

EBELP LIKE EKPO-EBELP,

MATNR LIKE EKPO-MATNR,

WERKS LIKE EKPO-WERKS,

LGORT LIKE EKPO-LGORT,

END OF IT_PONO.

TABLES EKKO.

********END OF DATA DECLARATIONS*********

********SELECTION SCREEN DESIGN ***********

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETER : P_WERKS LIKE MARC-WERKS MODIF ID S1.

SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN NO INTERVALS MODIF ID S2.

SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X'.

SELECTION-SCREEN COMMENT 5(20) TEXT-002 FOR FIELD R1.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS : R2 RADIOBUTTON GROUP G1.

SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R2.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B2.

******END OF SELECTION SCREEN DESIGN****************

*********INITIALIZATION OF SELECTION SCREEN ELEMENTS.*****

INITIALIZATION.

P_WERKS = '1000'.

S_EBELN-LOW = '4500016926'.

S_EBELN-OPTION = 'EQ'.

S_EBELN-SIGN = 'I'.

APPEND S_EBELN.

CLEAR S_EBELN.

************END OF INITIALIZATION***********************

***********SCREEN MODIFICATIONS*******************

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF R1 EQ 'X' AND SCREEN-GROUP1 EQ 'S2'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

IF R2 EQ 'X' AND SCREEN-GROUP1 EQ 'S1'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

********END OF SCREEN MODIFICATIONS*****************

Former Member
0 Kudos

Hi,

Thanks for every one.