‎2011 Jun 04 11:39 AM
Hi All,
I have developed a screen and written a code for ' ENTER KEY '.
I thought by passing BLANK VALUE to ok_code i can capture ENTER KEY event and have coded as below.
WHEN ' '.
IF it_lfa1-lifnr = p_lifnr.
SELECT lifnr
name1
FROM lfa1
INTO it_lfa1
WHERE lifnr = p_lifnr.
ENDSELECT.
But after debugging the code i realised that the ENTER KEY event is not getting captured.
Can anyone help me..
‎2011 Jun 04 11:47 AM
Hi.,
yes you are correct ., For Enter Key ok_code is space. you have to put that in AT SELECTION-SCREEN. event. If you are using module pool you have to check that in PAI event.,
do like this.,
case sy-ucomm.
WHEN ' '.
IF it_lfa1-lifnr = p_lifnr.
SELECT lifnr
name1
FROM lfa1
INTO it_lfa1
WHERE lifnr = p_lifnr.
ENDSELECT.
endcase.
hope this helps u.,
Thanks & Regards,
Kiran
‎2011 Jun 04 11:47 AM
Hi.,
yes you are correct ., For Enter Key ok_code is space. you have to put that in AT SELECTION-SCREEN. event. If you are using module pool you have to check that in PAI event.,
do like this.,
case sy-ucomm.
WHEN ' '.
IF it_lfa1-lifnr = p_lifnr.
SELECT lifnr
name1
FROM lfa1
INTO it_lfa1
WHERE lifnr = p_lifnr.
ENDSELECT.
endcase.
hope this helps u.,
Thanks & Regards,
Kiran
‎2011 Jun 04 11:53 AM
Hi Kiran,
I have written my code in module pool and in PAI event. Also i have written my code between case-endcase.
But still the event is not gettin triggered..
‎2011 Jun 04 12:03 PM
Hi.,
In PAI use Sy-ucomm in case.,
Put a break point before case statement. or at the first line in PAI and check whether it is getting inside case-endcase. also check sy-ucomm value. else post your PAI code here.,
hope this helps u.,
Thanks & Regards,
Kiran
‎2011 Jun 04 12:09 PM
Hi,
The command is goin inside case-endcase.
Here s de snippet of my code-
ok_code = sy-ucomm.
CASE sy-ucomm.
break-POINT.
WHEN 'NEXT'.
LEAVE TO SCREEN 0012.
WHEN ' '.
IF it_lfa1-lifnr = it_zpmrg-lifnr.
SELECT lifnr
name1
FROM lfa1
INTO it_lfa1
WHERE lifnr = it_zpmrg-lifnr.
ENDSELECT.
it_zpmrg-name1 = it_lfa1-name1.
ENDIF.
‎2011 Jun 04 12:17 PM
Hi,
Have you checked the sy-ucomm value in the debugger..!! once the debugger starts double click on sy-ucomm or ok_code and check the value of sy-ucomm there.. For enter sy-ucomm is space.
also try with
when space.
if ......
.....
endcase.
hope this helps u.,
Thanks & Regards,
Kiran
‎2011 Jun 04 12:28 PM
Hi,
I have checked the sy-ucomm value, it does take value of NEXT BACK EXIT and as the value of ENTER key is SPACE, its hard to find if its takin the value or not. But i gave a break-point after case and when i pressed on ENTER KEY it did go to debug mode so i guess it is capturing the value but its going to the command when ' '.
i also tried with SPACE still the same.
Thanks & Regards,
Mithun.
‎2011 Jun 04 12:52 PM
Thanks & Regards,
Mithun.
Edited by: mithun12345 on Jun 4, 2011 2:03 PM
‎2011 Jun 04 1:27 PM
Hi.,
1. put your code in OTHERS and check., like
when 'NEXT'.
do
when 'BACK'.
do
when others.
for enter.
else.,
2. If you are using container with full screen decrease the container size and check..!! this may work..
else.,
3. Assign the Function code ENT for Enter Icon in Pf Status of your screen., and check.,
when 'NEXT'.
do
when 'ENT'.
do
hope this helps u.,
Thanks & Regards,
Kiran
‎2011 Jun 05 6:38 AM
Hi,
' When space ' did the work for me.
Thanks & Regards,
Mithun.
Edited by: mithun12345 on Jun 5, 2011 8:01 AM
‎2011 Jun 18 9:41 PM
Sy-ucomm cannot be used for find the okcode. Because sy-comm can be incorrect/may not work at times while working in Module pool programming... You have to define some name for OK type. If you have given okcode, then use it in case. And Enter takes you to next screen.
‎2013 May 08 9:55 AM
‎2013 May 08 10:19 AM