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

radio button on selection screen

Former Member
0 Likes
1,431

hi friends my having problem with radio buttons. he is having 2 radio buttons on selection screen. when he clicks on button he wants to have parameter to be populated with one value and he clicks the other he wants other value to be populated and appear on selection screen. pls suggest.

Kumar.

5 REPLIES 5
Read only

Former Member
0 Likes
749

check this...

PARAMETERS:

p_num TYPE i MODIF ID abc,

p_str(10) TYPE c MODIF ID xyz LOWER CASE.

PARAMETERS:

rone type c RADIOBUTTON GROUP r1 DEFAULT 'X' USER-COMMAND ucom,

rtwo type c RADIOBUTTON GROUP r1 .

SELECTION-SCREEN PUSHBUTTON /10(20) charly USER-COMMAND abcd.

TABLES sscrfields.

DATA:

w_str(10) TYPE c,

w_len TYPE i. .

AT SELECTION-SCREEN OUTPUT.

IF rone EQ 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'XYZ'.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSE.

LOOP AT SCREEN.

IF screen-group1 = 'ABC'.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

INITIALIZATION.

MOVE 'My text' TO charly.

AT SELECTION-SCREEN.

IF p_num LT 0.

MESSAGE e100(bctrain) WITH 'Invalid Number'.

ENDIF.

IF sscrfields-ucomm = 'ABCD'.

IF rone EQ 'X'.

p_num = p_num * p_num.

ELSE.

MOVE strlen( p_str ) TO w_len.

WHILE w_len GE 0.

WRITE p_strw_len(1) TO w_strsy-index(1).

SUBTRACT 1 FROM w_len.

ENDWHILE.

WRITE w_str TO p_str.

ENDIF.

ELSEIF sscrfields-ucomm = 'UCOM'.

IF rone EQ 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'XYZ'.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSE.

LOOP AT SCREEN.

IF screen-group1 = 'ABC'.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

ENDIF." at user-command.

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
749

Hi

Refer the sample code:

*>> Intial/Common selection screen

selection-screen begin of block block1 with frame title text-002.

selection-screen skip 1.

*>> Selection for Material Master

select-options: s_matnr for mara-matnr,

  • s_werks FOR marc-werks," By Sreeram DU1K933728

s_mtart for mara-mtart,

s_matkl for mara-matkl,

s_ersda for mara-ersda.

selection-screen end of block block1.

*>> Selection for Released Batches

selection-screen begin of block block_rb with frame title text-034.

selection-screen skip 1.

select-options: so_werks for marc-werks,

so_matnr for mara-matnr,

so_charg for mch1-charg,

so_mtart for mara-mtart,

so_verab for mch1-verab.

selection-screen end of block block_rb.

selection-screen skip 1.

*>> Selection for Online Display & Download

selection-screen begin of block block2 with frame title text-012.

selection-screen begin of line.

selection-screen position 1.

*****Changes by Sreeram DU1K933700*************

*PARAMETERS: p_rd_upl RADIOBUTTON GROUP grp1.

parameters: p_rd_upl radiobutton group grp1 user-command abc.

****end of changes by Sreeram******************

"Radio Button for Download

selection-screen comment 3(30) text-003 for field p_rd_upl.

selection-screen position 75.

parameters: p_rd_rep radiobutton group grp1 default 'X' .

"Radio button of Online Display

selection-screen comment 77(20) text-004 for field p_rd_rep.

selection-screen end of line.

*>> Selection for check box & radi buttion line wise........

selection-screen begin of line.

selection-screen position 1.

parameters: p_cb1 as checkbox modif id chk.

"default 'X'. "Check box for Material Master checkbox

selection-screen comment 3(20) text-005 for field p_cb1.

selection-screen position 77.

parameters: p_rd1 radiobutton group grp2 modif id rdb.

"Radio Button for Material Master Report display

selection-screen comment 79(20) text-006 for field p_rd1.

selection-screen end of line.

selection-screen begin of line.

selection-screen position 1.

parameters: p_cb2 as checkbox modif id chk.

"default 'X'. "Check box for Material Types checkbox

selection-screen comment 3(20) text-007 for field p_cb2.

selection-screen position 77.

parameters: p_rd2 radiobutton group grp2 modif id rdb.

"Radio Button for Material Types Report display

selection-screen comment 79(20) text-008 for field p_rd2.

selection-screen end of line.

selection-screen begin of line.

selection-screen position 1.

parameters: p_cb3 as checkbox modif id chk.

"default 'X'. "Check box for Material Groups checkbox

selection-screen comment 3(20) text-009 for field p_cb3.

selection-screen position 77.

parameters: p_rd3 radiobutton group grp2 modif id rdb.

"Radio Button for Material Groups Report display

selection-screen comment 79(20) text-010 for field p_rd3.

selection-screen end of line.

selection-screen begin of line.

selection-screen position 1.

parameters: p_cb4 as checkbox modif id chk.

"default 'X'. "Check box for Released Bacthes checkbox

selection-screen comment 3(20) text-013 for field p_cb4.

selection-screen position 77.

parameters: p_rd4 radiobutton group grp2 modif id rdb.

"Radio Button for Material Groups Report display

selection-screen comment 79(20) text-014 for field p_rd4.

selection-screen end of line.

*>> File Location Parameter

parameters: p_loc type rlgrap-filename default '/usr/sap/tmp/'

obligatory.

*>> Selection for email input

select-options: s_email for soli-line no intervals.

selection-screen end of block block2.

Regards,

Sreeram

Read only

Former Member
0 Likes
749

Hi,

REPORT demo_at_selection_on_radio .

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: r1 RADIOBUTTON GROUP rad1 DEFAULT 'X',
            r2 RADIOBUTTON GROUP rad1,
            r3 RADIOBUTTON GROUP rad1.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
PARAMETERS: r4 RADIOBUTTON GROUP rad2 DEFAULT 'X',
            r5 RADIOBUTTON GROUP rad2,
            r6 RADIOBUTTON GROUP rad2.
SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN ON RADIOBUTTON GROUP rad1.

  IF r1 = 'X'.
"process ur logic here u may use loop at screen.
  ENDIF.

AT SELECTION-SCREEN ON RADIOBUTTON GROUP rad2.

  IF r2 = 'X'.
"process ur logic here u may use loop at screen.
  ENDIF.

Read only

Former Member
0 Likes
749

Hi,

Try using event AT SELECTION-SCREEN OUTPUT.

AT SELECTION-SCREEN OUTPUT.

IF RAD1 = 'X'.

PAR1 = 'abc'.

ELSE IF RAD2 = 'X'.

PAR2 = 'xyz'.

ENDIF.

Reward if it helps.

Regards,

Hemant.

Read only

Former Member
0 Likes
749

hI.. Kumar,

paste this code..solves ur problem..

<b>REPORT ZYH642_TEST_4.</b>

parameters:

p_r1 radiobutton group g1 user-command RAM,

p_r2 radiobutton group g1 ,

P_F1(10) TYPE C MODIF ID SCR,

P_F2(10) TYPE C MODIF ID SCR.

<b>at selection-screen output.</b>

if p_r1 = 'X'.

<b>loop at screen.</b>

if screen-name = 'P_F1'.

P_F1 = 'ABC'.

P_F2 = SPACE.

ENDIF.

MODIFY SCREEN.

<b>ENDLOOP.</b>

ELSE.

<b>loop at screen.</b>

if screen-name = 'P_F2'.

P_F2 = 'XYZ'.

CLEAR P_F1.

ENDIF.

MODIFY SCREEN.

<b>ENDLOOP.</b>

ENDIF.