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

OK_CODE For ENTER and Scroll key

Former Member
0 Likes
7,206

Hi,

when ever i press ENTER button in the module pool screen i need to capture the action code for that, because i suppose to do some action.

i need the same for scroll button also.

Kindly help me in this .

reg,

Hariharan.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,431

HI

SE51 IN screen painter select the sSCREEN NO and PGM.select "Layout", DRAG AND DROP THE check box and doube click it.In popup specfiy the Fctcode.Ex name 'chec'

DECLARATION.

DATA:OK_CODE LIKE SY-UCOMM.

CALLING

CASE OK_CODE.

WHEN 'CHEC'.

messgae 'Check box' type 'I'.

ENDCASE.

STATUs CREATION

SE41 CREATE MENU PAINTER

specift pgm and status creat a menu for the requirement

SET PF-STATUS 'STANDARD'.-->MENU PAINTER

5 REPLIES 5
Read only

Former Member
0 Likes
2,431

Hi,

Check in the PF-STATUS if ok_code is set for ENTER and use the same.

Incase not try with =ENT or =00.

For scroll bar check if it works with the page up and page down button.

Regards,

Ankur Parab

Read only

Former Member
0 Likes
2,431

hi,

can you just explain me in detail of the PF-status creation.

how we assign the OK_CODE in PF-status please give me a step by step procedure.

reg,

hariharan

Read only

Former Member
0 Likes
2,431

Hi,

I have never found an SY-UCOMM value for ENTER. What I get to do is,

Create a GUI Status, in the Function keys, create a function code for any of the function key, say 'ENTER' for the Enter function key.

This essentially means that you have assigned a Function code 'ENTER' for the user action Enter. Now, you can start coding away with IF SY-UCOMM EQ 'ENTER'.

Well, for Scroll Up and Scroll Down, I will give you the links of some useful threads

[]

[]

Read only

Former Member
0 Likes
2,432

HI

SE51 IN screen painter select the sSCREEN NO and PGM.select "Layout", DRAG AND DROP THE check box and doube click it.In popup specfiy the Fctcode.Ex name 'chec'

DECLARATION.

DATA:OK_CODE LIKE SY-UCOMM.

CALLING

CASE OK_CODE.

WHEN 'CHEC'.

messgae 'Check box' type 'I'.

ENDCASE.

STATUs CREATION

SE41 CREATE MENU PAINTER

specift pgm and status creat a menu for the requirement

SET PF-STATUS 'STANDARD'.-->MENU PAINTER

Read only

MarcinPciak
Active Contributor
0 Likes
2,431

Hi Hariharan.

Pressing ENTER returns empty function code in PAI, so you can just check OK_CODE = space . This is why you need to (at the beggining of PAI) save value of OK_CODE and then clear it. It can still hold value of previous action and if you later ENTER was pressed, the value would be incorrect. Do the following:

- create a screen, go to Element list tab type OK_CODE in empty field (column NAME) next to value OK (column TYPE).

- in program declare corresponding data object with name OK_CODE, so the value will be transported between screen and program


"in program
data: ok_code like sy-ucomm. "this OK_CODE var will hold function code of triggered action on screen

- write PBO and PAI modules in screen flow logic and corresponding ones in ABAP program


"in screen flow logic
PROCESS BEFORE OUTPUT.
  MODULE PBO. 
 
PROCESS AFTER INPUT.
  MODULE PAI.

"in ABAP program
MODULE PBO OUTPUT.
   "here you can set your GUI status 
   SET PF-STATUS space.  "using  SPACE will set default GUI status
ENDMODULE.

"now in PAI
MODULE PAI INPUT.
   "here you need to capture ok_code value in order to know what was the action
   data: save_ok like sy-ucomm. "our help var 
 
    save_ok = ok_code. "first remeber what was triggered
    clear ok_code.    "now clear the contenet of ok_code to be able to catch ENTER action (as mentioned above) 
  
    "now check if empty
     if save_ok = space.   "ENTER was hit 
        "react here accordingly
     endif.   
ENDMODULE.

For more information please refer [Reading Function Codes|http://help.sap.com/saphelp_nw04s/helpdata/en/9f/dbaa1335c111d1829f0000e829fbfe/frameset.htm]

Regards

Marcin