2005 Dec 09 7:45 PM
Hi,
I would like code that does the following:
Creates a selection screen with three input boxes. If all three input boxes contain numbers, it adds them and displays the result in a smaller screen or messagebox - otherwise, it loops continually until data is entered in all three fields.
thanks,
Kevin
2005 Dec 09 7:58 PM
I am just typing it in so please excuse me if there are some typos resulting in syntax errors.
parameters: p_nbr1 type i obligatory,
p_nbr2 type i obligatory,
p_nbr3 type i obligatory.
start-of-selection.
v_total = p_nbr1 + p_nbr2 + p_nbr3.
message i000(OO) with 'Your Total is' v_total.
Srinivas
2005 Dec 09 7:54 PM
Is this what you are looking for?
report zrich_0001 .
parameters: p_parm1 type i,
p_parm2 type i,
p_parm3 type i.
data: result type i.
start-of-selection.
if p_parm1 > 0
and p_parm2 > 0
and p_parm3 > 0.
result = p_parm1 + p_parm2 + p_parm3.
message s001(00) with result.
endif.
You could also replace the START-OF-SELECTION statement with AT SELECTION-SCREEN. This way, you can just hit ENTER instead of Execute.
Regards,
Rich Heilman
2005 Dec 09 7:56 PM
PARAMETERS: p_1(10) TYPE n OBLIGATORY,
p_2(10) TYPE n OBLIGATORY,
p_3(10) TYPE n OBLIGATORY.
DATA: p_total(10) TYPE n,
g_msg(100).
p_total = p_1 + p_2 + p_3.
CONCATENATE 'The total of three variables is :'
p_total INTO g_msg SEPARATED BY space.
MESSAGE i000 WITH g_msg.
Please close the issue with appropriate points if it helps.
Thanks.
Vemu
2005 Dec 09 7:58 PM
I am just typing it in so please excuse me if there are some typos resulting in syntax errors.
parameters: p_nbr1 type i obligatory,
p_nbr2 type i obligatory,
p_nbr3 type i obligatory.
start-of-selection.
v_total = p_nbr1 + p_nbr2 + p_nbr3.
message i000(OO) with 'Your Total is' v_total.
Srinivas
2005 Dec 09 8:08 PM
The addition 'OBLIGATORY' in my code will force the user to enter all the three values and I think that is what you wanted.
Srinivas
2005 Dec 09 8:12 PM
I agree with Srinivas, instead of doing an IF statement, the OBLIGATORY extension is a better way if you want to "lock down" to the specific field. You will get error messages on each field untill they are filled, in my code, there is no error messages, it just doesn't do anything untill all are filled.
Not sure what you had in mind.
Regards,
Rich Heilman
2005 Dec 09 9:00 PM