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

Radi buttons

Former Member
0 Likes
1,524

Hi All,

I have two radio buttons.I have a requirement that if one radio button is clicked some input parameters should be disabled.How to achieve that?

Regards,

Jeetu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,485

Hi,

Pls check out the following piece of code...

parameters : p_down radiobutton group g1 default 'X'

user-command act,

p_up radiobutton group g1,

p_pathd type localfile default

'C:\Documents and

Settings\gen\Desktop\Untitled.XLS',

p_pathu type localfile.

at selection-screen output.

if p_down = 'X'.

loop at screen.

if ( screen-name = 'P_PATHU' ) or

( screen-name = '%_P_PATHU_%_APP_%-TEXT' ).

screen-invisible = '1'.

screen-active = '0'.

modify screen.

endif.

if ( screen-name = 'P_PATHD' ) or

( screen-name = '%_P_PATHD_%_APP_%-TEXT' ).

screen-invisible = '0'.

screen-active = '1'.

screen-input = '1'.

modify screen.

endif.

endloop.

elseif p_up = 'X'.

loop at screen.

if ( screen-name = 'P_PATHD' ) or

( screen-name = '%_P_PATHD_%_APP_%-TEXT' ).

screen-invisible = '1'.

screen-active = '0'.

modify screen.

endif.

if ( screen-name = 'P_PATHU' ) or

( screen-name = '%_P_PATHU_%_APP_%-TEXT' ).

screen-invisible = '0'.

screen-active = '1'.

screen-input = '1'.

modify screen.

endif.

endloop.

endif.

If you select p_down radio button, parameter p_pathd will be displayed and p_pathu will be in invisible mode and if you select p_up radio button it will be vice versa

Thanks

14 REPLIES 14
Read only

Former Member
0 Likes
1,485

Hi,

PARAMETERS P0 RADIOBUTTON GROUP RADI.

PARAMETERS P1 RADIOBUTTON GROUP RADI.

Parameters p_matnr type mara-matnr.

AT SELECTION-SCREEN OUTPUT.

if po = `X` or

p1 = `X`.

LOOP AT SCREEN.

IF SCREEN-NAME = `P_MATNR`.

SCREEN-INPUT = 0.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

Best regards,

Prashant

Read only

0 Likes
1,485

Hi Prashant,

I did exactly u suggested but surprisingly it is not working.

Regards,

Jeetu

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
1,485

Hi,

U can use this logic..

PARAMETERS: r1 RADIOBUTTON GROUP rad1 USER-COMMAND cli DEFAULT 'X',

r2 RADIOBUTTON GROUP rad1.

parameters: p_ch1(8) TYPE c MODIF ID sc1,

p_ch2(8) TYPE c MODIF ID sc2.

AT SELECTION-SCREEN OUTPUT.

IF r2 = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'SC1'

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

else.

loop at screen.

IF screen-group1 = 'SC2'

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Hope this helps...

Cheers,

SImha.

Read only

Former Member
0 Likes
1,485

Hi,

You only need add this statement: USER-COMMAND, after Radio Button. And add statement at AT SELECTION-SCREEN OUTPUT.

Try this code:



REPORT  Z_JRQ034R                               .

*-----------------------------------------------------------------------
* S.E.L.L.E.C.T.I.O.N.  .S.C.R.E.E.N.
*-----------------------------------------------------------------------
SELECTION-SCREEN BEGIN OF BLOCK BL03 WITH FRAME TITLE TEXT-S30.
  SELECTION-SCREEN BEGIN OF LINE.
    PARAMETER RB_STD RADIOBUTTON GROUP GRP1 USER-COMMAND RB1
                     DEFAULT 'X'.
    SELECTION-SCREEN COMMENT (25) TEXT-S31.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN BEGIN OF LINE.
    PARAMETER RB_ALV RADIOBUTTON GROUP GRP1.
    SELECTION-SCREEN COMMENT (5) TEXT-S32.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 4.
    SELECTION-SCREEN COMMENT (15) TEXT-S33.
    PARAMETER P_VAR LIKE DISVARIANT-VARIANT.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN BEGIN OF LINE.
    PARAMETER RB_EMAIL RADIOBUTTON GROUP GRP1.
    SELECTION-SCREEN COMMENT (15) TEXT-S34.
  SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK BL03.

*-----------------------------------------------------------------------
* A.T.  .S.E.L.L.E.C.T.I.O.N.  .S.C.R.E.E.N.
*-----------------------------------------------------------------------
AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
      IF RB_ALV = 'X'.
         IF SCREEN-NAME CS 'P_VAR'.
           SCREEN-INPUT = 1.
           MODIFY SCREEN.
         ENDIF.
      ELSE.
         IF SCREEN-NAME CS 'P_VAR'.
           SCREEN-INPUT = 0.
           MODIFY SCREEN.
         ENDIF.
      ENDIF.
    ENDLOOP.

Regards,

Read only

Former Member
0 Likes
1,485

Hi Jeetu,

pls chk this

report ZCHA.
 
 
parameters: p_rad1 radiobutton group grp1 default 'X'
                         user-command check.
parameters: p_rad2 radiobutton group grp1 .
 
parameters: p_fld1(10) type c.
parameters: p_fld2(10) type c.
 
at selection-screen output.
  
loop at screen.
 
if p_rad1 = 'X' or 
   p_rad2 = 'X'.
if screen-name = 'P_FLD1' or
   screen-name = 'P_FLD2'
   screen-input = '0'.
endif.
endif.
  
modify screen.
endloop.

Read only

0 Likes
1,485

hi Chandrasekhar,

It is not working because both my parameters are OBLIGATORY type and want to make disable both the parameters.

Can u please help?

Regards,

Jeetu

Read only

0 Likes
1,485

Hi Jeetu,

I had modified my code in first post , can u try that

Read only

Former Member
0 Likes
1,485

hi,

when first radiobutton is selected, v_matnr will be disabled otherwise, if second radiobutton is selected, v_matnr will be enabled.


parameters : p_rad1  radiobutton group g1 user-command ABCD,
             p_rad2  radiobutton group g1,
             v_matnr like mara-matnr.

data: v_data type c value 'X'.

at selection-screen output.

 if v_data = 'X'.
   loop at screen.
     if screen-name = 'V_MATNR'.
       screen-input = 0.
       modify screen.
     endif.
   endloop.
 else.
   loop at screen.
     if screen-name = 'V_MATNR'.
       screen-input = 1.
       modify screen.
     endif.
   endloop.
 endif.
at selection-screen.

case sy-ucomm.
  when 'ABCD'.
   if p_rad1 = 'X'.
     v_data = 'X'.
   else.
     v_data = ' '.
   endif.
endcase.

Regards,

Sailaja.

Read only

0 Likes
1,485
Parameters: rd1 RADIOBUTTON group g1 default 'X' user-command ch ,
            kishan1(15)  modif id ID1,
            kishan2(15)  modif id ID2,
            rd2 RADIOBUTTON group g1 ,
            kishan3(15)  modif id ID3,
            kishan4(15)  modif id ID4.
 
 
 
AT SELECTION-SCREEN.
check sy-ucomm = 'CH'.
 
AT SELECTION-SCREEN output.
IF rd2 = 'X'.
 
LOOP AT SCREEN.
IF screen-group1 = 'ID1' or screen-group1 = 'ID2'.
screen-input = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
 
ENDIF.
IF RD1 = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'ID3' or screen-group1 = 'ID4'.
screen-input = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
 
ENDIF.
Read only

Former Member
0 Likes
1,485

u can used

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SCREEN-NAME = '?'.

SCREEN-INPUT = 0.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

Read only

0 Likes
1,485
just copy and  paste....

Parameters: rd1 RADIOBUTTON group g1 default 'X' user-command ch ,
            kishan1(15)  modif id ID1,
            rd2 RADIOBUTTON group g1 ,
            kishan3(15)  modif id ID3.



AT SELECTION-SCREEN.
check sy-ucomm = 'CH'.

AT SELECTION-SCREEN output.
IF rd2 = 'X'.

LOOP AT SCREEN.
IF screen-group1 = 'ID1' .
screen-input = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.

ENDIF.
IF RD1 = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'ID3' .
screen-input = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.

ENDIF.

if rd1 = 'X' AND kishan1 = ''.
message w000(001) with ' enter the parameter value'.
endif.
if rd2 = 'X' AND kishan3 = ''.
message w000(002) with 'enter the parameter value'.
endif.

Read only

Former Member
0 Likes
1,485

Hi ,

U can Do like This

SELECTION-SCREEN: BEGIN OF BLOCK ss_note WITH FRAME TITLE text-001.

PARAMETERS: fpareaid TYPE /sapapo/prom_keyf-pareaid MODIF ID g1, " default 'DP_DFPA' ,

p_vsum RADIOBUTTON GROUP g2 , " volume summary

p_vsum1 RADIOBUTTON GROUP g2 . " volume summary

SELECTION-SCREEN: END OF BLOCK ss_note.

AT SELECTION-SCREEN output.

if p_vsum = 'X'.

LOOP AT SCREEN.

CHECK screen-group1 = 'G1'.

screen-input = '0'.

MODIFY SCREEN.

ENDLOOP.

endif.

Regards

Ahasan

Read only

Former Member
0 Likes
1,485

Hello,

In the event AT-SELECTION SCREEN OUTPUT.

LOOP AT SCREEN.

IF RAD1 EQ 'X'.

IF SCREEN-NAME EQ F1.

SCREEN-INPUT = 0.

ENDIF.

ELSE.

IF SCREEN-NAME EQ F2.

SCREEN-INPUT = 0.

ENDIF.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

Regs,

Venkat Ramanan N

Read only

Former Member
0 Likes
1,486

Hi,

Pls check out the following piece of code...

parameters : p_down radiobutton group g1 default 'X'

user-command act,

p_up radiobutton group g1,

p_pathd type localfile default

'C:\Documents and

Settings\gen\Desktop\Untitled.XLS',

p_pathu type localfile.

at selection-screen output.

if p_down = 'X'.

loop at screen.

if ( screen-name = 'P_PATHU' ) or

( screen-name = '%_P_PATHU_%_APP_%-TEXT' ).

screen-invisible = '1'.

screen-active = '0'.

modify screen.

endif.

if ( screen-name = 'P_PATHD' ) or

( screen-name = '%_P_PATHD_%_APP_%-TEXT' ).

screen-invisible = '0'.

screen-active = '1'.

screen-input = '1'.

modify screen.

endif.

endloop.

elseif p_up = 'X'.

loop at screen.

if ( screen-name = 'P_PATHD' ) or

( screen-name = '%_P_PATHD_%_APP_%-TEXT' ).

screen-invisible = '1'.

screen-active = '0'.

modify screen.

endif.

if ( screen-name = 'P_PATHU' ) or

( screen-name = '%_P_PATHU_%_APP_%-TEXT' ).

screen-invisible = '0'.

screen-active = '1'.

screen-input = '1'.

modify screen.

endif.

endloop.

endif.

If you select p_down radio button, parameter p_pathd will be displayed and p_pathu will be in invisible mode and if you select p_up radio button it will be vice versa

Thanks