ENTER function is activated, unwantedly.
Hi,
I'm writing a transaction program. A piece of code looks like this....
MODULE TIMES INPUT.
CASE OKCODE.
WHEN 'ARR'.
CLEAR OKCODE.
ARRIVAL_TIME = SY-UZEIT+0(4).
WHEN 'T_START'.
CLEAR OKCODE.
TRIP_START = SY-UZEIT+0(4).
WHEN 'T_END'.
CLEAR OKCODE.
TRIP_END = SY-UZEIT+0(4).
ENDCASE.
ENDMODULE.
Another Module is.....
MODULE USER_COMMAND_9002.
CASE OKCODE.
WHEN SPACE.
TOTAL = STOCK_ITAB-TOTAL.
PERFORM FARM_NAME.
PERFORM ROUTE_NAME.
PERFORM HAULIER_NAME.
ENDCASE.
ENDMODULE.
Now, my problem was, when I press on a button which should activate function code ARR, it's executing PERFORM FARM_NAME, PERFORM ROUTE_NAME AND PERFORM HAULIER_NAME.
I want to execute those three subroutines when the user presses ENTER key on the keyboard. Where am I going wrong? Kindly help me. Thanks in advance.
Wishes,
Srini S.
First thing to do before testing an okcode is to code like this :
DATA : w_okcode LIKE sy-ucomm.
MOVE okcode TO w_okcode.
CLEAR okcode.
CASE w_okcode.
WHEN 'xxx'.
...
WHEN 'yyy'.
...
WHEN OTHERS.
...
ENDCASE.
By this method, you avoid some wrong residual value in your variable 'okcode' defined in your screen.
After implementing that, just debug after pressing 'ENTER' and identify what is the corresponding okcode. Just treat this okcode in your CASE statement and it should be OK.
Regards,
Thomas.
Hi Thomas,
Thank you. What I'm writing is a Module Pool program so I dont think your code works. Correct me if I'm wrong. Where should I give this 'MOVE okcode TO w_okcode' statement? I'm sure my OKCODE was having residual values and bothering me. What's the effective way to get rid of residual values and to have only whatever is desired? I've all my MODULES in the main program itself, is it causing any problems?
Wishes,
Srini S.
Hi Srini,
What Thomas wrote is right, u should not face the problem if the code is written as he has advised. The reason is u are clearing the OKCODE (now the value in OKCODE is SPACE). So obviously PERFORM FARM_NAME, PERFORM ROUTE_NAME AND PERFORM HAULIER_NAME. will be executed.
Regards,
Siva.
try with function code 'ENTR' for enter key....
_________________
Best Regards
Manohar