Entering content frameProcedure documentation Evaluating Function Codes in the Program Locate the document in its SAP Library 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 screen field OK_CODE.

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

OK_CODE

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, this field 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.

 

Leaving content frame