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 codes

Former Member
0 Likes
2,738

can any body tell about the ok-code and all ok-codes in the sap. for what purpose '=ausw' is used for.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
991

Hi raman,

1. Whenever we interact on the screen,

a) press some button on toolbar

b) select something from menu

c) select a radiobutton or push some push button on screen

d) press Enter

e) etc..

2. Then to DETECT what has happened and which thing has been pressed/interacted,

a simple code is pre-defined for each such actions.

That code is called OKCODE.

3. It is totally dependent upon each program. We can give any code we like

to each of the actions.

regards,

amit m.

5 REPLIES 5
Read only

Former Member
0 Likes
992

Hi raman,

1. Whenever we interact on the screen,

a) press some button on toolbar

b) select something from menu

c) select a radiobutton or push some push button on screen

d) press Enter

e) etc..

2. Then to DETECT what has happened and which thing has been pressed/interacted,

a simple code is pre-defined for each such actions.

That code is called OKCODE.

3. It is totally dependent upon each program. We can give any code we like

to each of the actions.

regards,

amit m.

Read only

0 Likes
991

hi amith,

can i know the particular ok-code from pushbutton, radiobutton, checkbox etc...on a particulsr screen. if yes how can i find out it.

Read only

0 Likes
991

Hi again,

1. supppose u want to know the fcode

for a button on toolbar.

2. then follow these simple steps.

3.

a) Take your mouse on the button

Left Click It

DO NOT RELEASE THE LEFT MOUSE BUTTON

Then Move Away your mouse pointer from the button,

then release the left mouse button

b) In this manner, the button is SELECTED.

(We can also do this using TAB TAB..)

c) Then just press F1

d) a new small window will come

which will display the program name and fcode.

-- If this is to be done in menu,

then select the menu and press Shift + F1

regards,

amit m.

Read only

0 Likes
991

Thank you. You have no idea how much time and grief you just saved me.

Read only

Former Member
0 Likes
991

Hi

In your ABAP programs, you should work with the OK_CODE field instead of SY-UCOMM. There are two reasons for this: Firstly, the ABAP program has full control over fields declared within it, and secondly, you should never change the value of an ABAP system field. However, you should also always initialize the OK_CODE field in an ABAP program for the following reason:

In the same way that the OK_CODE field in the ABAP program and the system field SY-UCOMM receive the contents of the corresponding screen fields in the PAI event, their contents are also assigned to the OK_CODE screen field and system field SYST-UCOMM in the PBO event. Therefore, you must clear the OK_CODE field in the ABAP program to ensure that the function code of a screen is not already filled in the PBO event with an unwanted value. This is particularly important when the next PAI event can be triggered with an empty function code (for example, using ENTER). Empty function codes do not affect SY-UCOMM or the OK_CODE field, and consequently, the old field contents are transported.

In your application programs, the first step in PAI processing should be to save the function code in an auxiliary variable and then initialize the OK_CODE field. You can then read the function code from the auxiliary variable (for example, using a CASE structure), and control the program flow from there.

The OK_CODE field can have a different name on each screen. However, common practice is to use the same name for the field on each screen of an ABAP program. You then only need one field in the ABAP program, with the same name, into which the function code is placed, and from which you can read it.

Regards