Sanjivani SAP Training Programme
Program 03: To design RADIOBUTTONS on selection screen to
perform arithmetic operations
REPORT Z1208PROG3.
data v_z type i.
*parameters : p_x type i default 20,
* p_y type i default 15.
" The above statement gives the paraments names on screen on left side,so if
we want to dispaly the names as per our convenience then use the following
selection-screen begin of block bk1 with frame title t1.
selection-screen begin of line.
selection-
screen comment 8(20) lb1. " This statement is used to start the name of text
on screen at 8th position and allowed length is 20
parameters p_x type i default 20 obligatory.
selection-screen end of line.
selection-screen begin of line.
selection-
screen comment 8(20) lb2. " This statement is used to start the name of text
on screen at 8th position and allowed length is 20
parameters p_y type i default 15 obligatory.
selection-screen end of line.
selection-screen end of block bk1.
" to design radiobutton
selection-
screen begin of block bk2 with frame title t2. " to put the title and block t
o the text
parameters : p_r1 radiobutton group grp1,
p_r2 radiobutton group grp1,
p_r3 radiobutton group grp1,
p_r4 radiobutton group grp1,
p_r5 radiobutton group grp1 default 'X'. " radiobutton can have
either 'X' or ' ' as default value 'X' is for selected '' is for not selecte
d
selection-screen end of block bk2.
Prepared By: Salkar Sailee R (SAP Co-Incharge, SAP ABAP Trainer, Sanjivani College of Engineering
Kopargaon)
Sanjivani SAP Training Programme
" EVENT HANDLING
" to perform the arithematic operations after executing program use the follo
wing
start-of-selection.
if p_r1 = 'X'.
v_z = p_x + p_y.
write : / 'addition is' , v_z.
elseif p_r2 = 'X'.
v_z = p_x - p_y.
if v_z >= 0.
write :/ 'difference is' ,v_z.
else.
write :/ 'difference is -', v_z no-sign no-gap.
endif.
elseif p_r3 = 'X'.
v_z = p_x * p_y.
write : / 'product is', v_z.
elseif p_r4 = 'X'.
v_z = p_x / p_y.
write : / 'division is', v_z.
else.
write : / 'no radiobutton is selected'.
message 'no radiobutton selected' type 'I'. " information message
*ssage 'no radiobutton selected' type 'S'. " status message
endif.
Prepared By: Salkar Sailee R (SAP Co-Incharge, SAP ABAP Trainer, Sanjivani College of Engineering
Kopargaon)
Sanjivani SAP Training Programme
Initialization.
lb1 = 'Enter the First No'.
lb2 = 'Enter the second No'.
t1 = ' Enter the input values'.
t2 = 'arithematic operations'.
Prepared By: Salkar Sailee R (SAP Co-Incharge, SAP ABAP Trainer, Sanjivani College of Engineering
Kopargaon)