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

dialog module

Former Member
0 Likes
1,166

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.

13 REPLIES 13
Read only

Former Member
0 Likes
1,144

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

Read only

0 Likes
1,144

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

Read only

0 Likes
1,144

shah am forgot to tell u. when am click the push button namely exit . it should not be exit. from that screen.

Read only

0 Likes
1,144

hi,

while am click the push button add , it should not display in the output field

what is meaning of this?

Read only

0 Likes
1,144

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.

Read only

0 Likes
1,144

have u assign fcode to ur buttons?

Read only

0 Likes
1,144

ya, i assigned as add and exit in fctcode field

Read only

0 Likes
1,144

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

Read only

0 Likes
1,144

&----


*& 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

Read only

0 Likes
1,144

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?

Read only

0 Likes
1,144

YA, both fields name are identical.

Read only

0 Likes
1,144

ok,

so put stop point at ADD button and check that its going in that and data coming in ll fields or not?

Read only

Former Member
0 Likes
1,144

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