03-13-2010 8:50 AM
Hey i have designed a Calculator in Module pool. I have created a Screen with Buttons and other functionalities.If you Give input from Mouse by Clicking on desired button Everything is working fine .But Instead of clicking on these button i want input has to be given from keyboard itself .For example
Press 1: 1 Should be appear on Screen
Press + : It should not appear on Screen.
Press: 2 : It should Appear on Screen.
If you Press Enter Final Added Value should appear on Screen.
Is Keyboard interfacing possible with Custom developed Screen ? If possible please reply .
03-15-2010 5:17 AM
To develop Calculator in Module Pool program Instead of you can use FM FITRV_CALCULATOR. But I dont know the Keyboard Interaction.
Report ZCalculator.
DATA: OUTPUT_VALUE(15) TYPE C.
call function 'FITRV_CALCULATOR'
IMPORTING
OUTPUT_VALUE = OUTPUT_VALUE
EXCEPTIONS
INVALID_INPUT = 1
CALCULATION_CANCELED = 2
OTHERS = 3.
03-15-2010 5:17 AM
To develop Calculator in Module Pool program Instead of you can use FM FITRV_CALCULATOR. But I dont know the Keyboard Interaction.
Report ZCalculator.
DATA: OUTPUT_VALUE(15) TYPE C.
call function 'FITRV_CALCULATOR'
IMPORTING
OUTPUT_VALUE = OUTPUT_VALUE
EXCEPTIONS
INVALID_INPUT = 1
CALCULATION_CANCELED = 2
OTHERS = 3.
03-15-2010 5:53 AM
hi,
if you want to develo a custom calculator. try this.
make 1st field for first input
2nd field for operator
3rd for second no.
4th for result.
the make an enter button. in PAI
check the value of the operator field and put a case statement.
n code as per the functionality u want
eg.
case FIELD2.
when '+'
fied4 = field1 + field3.
when '-'
fied4 = field1 - field3.
etc.
hope it helps.
03-15-2010 7:09 AM
See Calculator is working Fine if you provide inputs from Mouse by clicking on push buttons . But My intention is can i provide inputs from Keyboard without touching mouse.
As in microsoft calcuator we can given input frm keyboard itself and check output. Please reply
03-15-2010 7:15 AM
Did you define a proper input field for entering your data? Sure it is possible to use the keyboard as input. This is the same for custom fields as it is for your Standard SAP fields.
03-15-2010 7:19 AM
hi,
did you check in debuggin mode what ok code is set when you press the keyboard keys?
03-15-2010 8:33 AM
@Micky Oestreich
I have designed Calcualor screen with same as of Standard Calculator. Here i havnt Defined Two Input Fields for giving input and ,Field for giving Opreator value as '+' , '-' ,'*' ,'/'.
03-15-2010 8:43 AM
Hi,
Not sure if this helps for your actual question. But, How about reusing the Windows calculator instead of redesigning on your own? (I am assuming your operating system is Windows. In case of others, you can pass appropriate command name).
CALL FUNCTION 'GUI_RUN'
EXPORTING
command = 'CALC'
* PARAMETER =
* CD =
* IMPORTING
* RETURNCODE =
.
Thanks,
Vinod.
03-15-2010 8:27 AM
hi,
you can assign a function code to that push button as well.
so you dont require mouse input.
03-15-2010 8:46 AM
@ S Jain
I didnt Understand how will you define function code so that it will pick input from keyboard itself.In PAI event we can check inside Case Statment for different FCODE . Will you please Elaborate this concept.
03-15-2010 9:34 AM
hi,
oops my mistake.
insted of function code i meant function key.
you can assign a ufnction key to the push button on the screen.
so even if the input comes from the keyboard or the mouse, the PAI event
will still be triggered.
regards,
sakshi