07-03-2007 8:28 AM
Can any one send me the program to create a calculator in Screen Painter..
07-03-2007 8:35 AM
Hi Sudhir,
REfer this FM and check its program,
Screen 300 has been called.
FITRV_CALCULATOR
Or simply create your own.
By taking buttons and assiging UCODE and do simple operations.
Reward if useful!
07-03-2007 8:50 AM
Hi,
Create push buttons for the + , - , / , * , = in your dialog program.
Create an input field with the data type that can accept decimal places..
When the enter 12 then press the push button "+" button store the value 12 in a variable v1..Then clear the input field..
Then when the user enters another number..lets say "13"..
Then if the user presses the "=" button...Then sum the values from the variable v1 with the input field..
Hope this helps..
Check this sample code..
MODULE USER_COMMAND.
CASE SY-UCOMM.
WHEN 'ADDITION'.
ASSUMING THE INPUT FIELD NAME IS P_INPUT.
V_V1 = P_INPUT.
V_OPERATION = '+'.
CLEAR: P_INPUT.
WHEN 'EQUALTO'.
CASE V_OPERATION.
ADDITION
WHEN '+'.
SUM UP THE VALUES.
P_INPUT = P_INPUT + V_V1.
ENDCASE.
MULTIPLICATION
WHEN '*'.
MULTIPLY UP THE VALUES.
P_INPUT = P_INPUT * V_V1.
ENDCASE.
ENDCASE.
ENDMODULE.
Reward points if it helps..
Regards,
Omkar.
07-03-2007 9:42 AM
07-19-2007 1:12 PM
can any one give the complete program ... so as to understand as a new SAP user.
07-03-2007 8:52 AM
Hi Sudir,
first you go to se38 and create zpgm name and press create.
then save it and activate the screen and come back.
then go to se51 and create pgm name with screen no.
in layout take 3 input fields and 3 text fields for it as mentioned below.
then add four push buttons for add,sub,mul,div.
then write following code in PAI.
PAI.
Module user_command_1000_input
case sy-ucomm.
when 'add'.
field3 = field1+field2.
when 'sub'.
field3 = field1-field2.
when 'mul'.
field3 = field1*field2.
when 'div'.
field3 = field1/field2.
endcase.
endmodule.
Then finaly execute you can see a simple calculator.
Reward if helpful.
Regards
Raghavendra.D.S