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

enter key command not working

Former Member
0 Likes
3,291

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..

1 ACCEPTED SOLUTION
Read only

Kiran_Valluru
Active Contributor
0 Likes
2,559

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

12 REPLIES 12
Read only

Kiran_Valluru
Active Contributor
0 Likes
2,560

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

Read only

0 Likes
2,559

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..

Read only

0 Likes
2,559

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

Read only

0 Likes
2,559

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.

Read only

0 Likes
2,559

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

Read only

0 Likes
2,559

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.

Read only

0 Likes
2,559

Thanks & Regards,

Mithun.

Edited by: mithun12345 on Jun 4, 2011 2:03 PM

Read only

0 Likes
2,559

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

Read only

0 Likes
2,559

Hi,

' When space ' did the work for me.

Thanks & Regards,

Mithun.

Edited by: mithun12345 on Jun 5, 2011 8:01 AM

Read only

0 Likes
2,559

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.

Read only

0 Likes
2,559

This message was moderated.

Read only

Former Member
0 Likes
2,559

This message was moderated.