‎2008 Feb 25 10:46 AM
hi,
plz tell the coding for addition program using dialog module .
here my spec given below.
two input fields,
one output fields,
two pushbuttons namely add, exit.
while click the add button the two input number should be add and depicts in the output field
i dont know how to set the properties of all gui components and program.
regards
surender.
‎2008 Feb 25 11:02 AM
hi,
have u took field on screen...
i have taken three I/O field on screen.
two are input field and one is output field....all are type int4...
now i have taken two buttons ADD and EXIT ...
have given function code ADD and EXIT....
now declare I/O fields with same name in top module...
DATA : in1 TYPE i,
in2 TYPE i,
op TYPE i.
now in user_command_1000 module of PAI
write like this
*MODULE user_command_1000 INPUT.*
CASE ok_code.
WHEN 'ADD'.
op = in1 + in2.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
*ENDMODULE. " USER_COMMAND_1000 INPUT*
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 25, 2008 5:24 PM
‎2008 Feb 25 11:10 AM
shah,
while am click the push button add , it should not display in the output field.i tried several times. but i couldn't find it what is the mistakes.?
i am stick these problems for last two days.
and now i also tried ur program ,it also had the same problem. plz resolve this.
regards
surender
‎2008 Feb 25 11:13 AM
shah am forgot to tell u. when am click the push button namely exit . it should not be exit. from that screen.
‎2008 Feb 25 11:17 AM
hi,
while am click the push button add , it should not display in the output field
what is meaning of this?
‎2008 Feb 25 11:26 AM
suppose i give the input value 2 and 3 the resultant value 5 is not displayed in the output field.
and while am click the exit button it should not be exit from the screen.
‎2008 Feb 25 11:32 AM
‎2008 Feb 25 11:39 AM
‎2008 Feb 25 11:42 AM
ok
paste ur code here
and if possible then write /h in command window before pressing on ADD button ...it will go to debug so u can under stand whats going on...
Edited by: Dhwani shah on Feb 25, 2008 12:43 PM
‎2008 Feb 25 11:47 AM
&----
*& Module pool SAPMYSP2
*&
&----
*&
*&
&----
INCLUDE MYSP2TOP . " global Data
INCLUDE MYSP2O01 . " PBO-Modules
INCLUDE MYSP2I01 . " PAI-Modules
INCLUDE MYSP2F01 . " FORM-Routines
INCLUDE MYSP2_O01.
INCLUDE MYSP2_I01.
top include program
&----
*& Include MYSP2TOP Module pool SAPMYSP2
*&
&----
PROGRAM SAPMYSP2.
DATA:INPUT1 TYPE I,
INPUT2 TYPE I,
OUTPUT1 TYPE I,
OK_CODE TYPE SY-UCOMM,
SAVE_CODE LIKE OK_CODE.
pbo program
-
***INCLUDE MYSP2_O01 .
-
&----
*& Module INIT_SCREEN_100 OUTPUT
&----
text
-
MODULE INIT_SCREEN_100 OUTPUT.
ENDMODULE. " INIT_SCREEN_100 OUTPUT
pai program
-
***INCLUDE MYSP2_I01 .
-
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
-
MODULE USER_COMMAND_0100 INPUT.
SAVE_CODE = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_CODE.
WHEN 'ADD'.
OUTPUT1 = INPUT1 + INPUT2.
WHEN 'SUB'.
OUTPUT1 = INPUT1 - INPUT2.
WHEN 'MUL'.
OUTPUT1 = INPUT1 * INPUT2.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
REGARDS
SURENDER
‎2008 Feb 25 11:54 AM
hi,
code seems ok....
uer screen field and program fields should have same name...
check that
and have u declare them into top module no?
‎2008 Feb 25 12:26 PM
‎2008 Feb 25 12:33 PM
ok,
so put stop point at ADD button and check that its going in that and data coming in ll fields or not?
‎2008 Feb 25 11:48 AM
Hi
Do like this:
In top include :
declare all the variables.
Top_include;
data : op type i,
in1 type i,
in2 type i.
op, in1 and in2 should be there in the screen as Input/oot field with the same name as in top_include file.
Jus drag Input/output box on to the screen, name it as op
name it as in1,
name it as in2.
PAI module.
MODULE user_command_1000 INPUT.
CASE sy-ucomm.
WHEN 'ADD'.
op = in1 + in2.
LEAVE TO LIST-PROCESSING.
WRITE : / OP.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_1000 INPUT
Regards
Sandeep Reddy