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

code to call a function when enter key is pressed

Former Member
0 Likes
2,186

hi all,

In a table control program i need to call a function when i press enter key...

but im not able to do that since the function is always called when i press a push button on the screen.... can any one help me in this.. please....

6 REPLIES 6
Read only

Former Member
0 Likes
1,695

Hi John,

When you want to call the function when you press enter,

you need to keep the function code of the button used in that screen as enter and write the code regarding that in the PAI of that screen.

OR

If you want the functionality to happen when you press enter,then check the function code of enter in the debugging and put that value in the cases you write in the PAI module.

Reward if useful.

Thanks & Regards,

Khan.

Edited by: Ahmed Khan on May 16, 2008 7:35 PM

Read only

0 Likes
1,695

no sy-ucomm is coming for enter command it is keeping the previous sy-ucomm value... so i am not able to code for it..

i have add , delete and change button on the screen

i like to add values first so i will use the add push button.. after adding i would like to call a function once enter is pressed.. but the sy-ucomm value is always add...

Read only

0 Likes
1,695

Hi John,

You are not getting any value in SY-UCOMM when you press "Enter",because the function code is not set for 'Enter" key in "Function Key" of the GUI-STATUS..

First define some fucntion code say 'ENT' for the Enter button available in "Fucntion key" of the GUI status.Once you done and activate the program and test it.The function code which u defined will be coming to SY-UCOMM field when you press 'ENTER" button and you can handle the various fucntionality whichevcer you want on "ENTER" .

Eg:

case sy-ucomm.

When 'ENT'.

..............

..........

Endcase.

Regards,

Vigneswaran S

Read only

Former Member
0 Likes
1,695

hi check this..

the only way for this is to use the sy-ucomm and clear before it is calling ...then there is nothing to bother ...

check this ..

case sy-ucomm.

when 'ADD'.

write some thing to do..

when 'DEL'.

write some thing to do..

endcase.

regards,

venkat

Read only

Former Member
0 Likes
1,695

how to clear the sy-ucomm eveytime..

Read only

Former Member
0 Likes
1,695

Hi John,

Following snippet might help:

In PAI section

V_FCODE = OK-CODE.

CLEAR: OK-CODE.

CASE V_FCODE.

WHEN 'BACK' OR 'EXIT' OR 'CANC'.

LEAVE TO SCREEN 0.

WHEN ' ' . " for <enter>

"Write your validations & processing here

ENDCASE.

Cheers,

Vikram

Edited by: Vikram Jalali on May 16, 2008 3:10 PM