Show TOC

 Evaluating Function Codes in the ProgramLocate this document in the navigation structure

When you create new menu and toolbar functions, you must assign a unique code to every function. When the user chooses a function, its function code is placed in the system field SY-UCOMM and the OK_CODE screen field.

The SY-UCOMM field always contains the current function code. You do not need to declare this field in your module pool.

The OK_CODE Field

The OK_CODE field stores the function code in your program. It is always the last field in the field list of a screen. You need to assign a name to this field in the Screen Painter. Traditionally, it is always called "OK_CODE". However, you can call it anything you like. Once you have assigned a name to the OK_CODE field, you need to declare a field with the same name in your module pool.

Example

If your GUI status contains the function codes 'BACK', 'EXIT', and 'SAVE', for example, you need the following code in your PAI module.

MODULE USER_COMMAND_0100.

CASE OK_CODE.

WHEN 'BACK'.

...

WHEN 'EXIT'.

...

WHEN 'SAVE'.

...

ENDCASE.

ENDMODULE.