When the USER selects a function in a transaction ,the system copies the function code into a specially DESIGNATED system FIELD called SY-UCOMM.
This field is GLOBAL in ABAP/4 Module Pool.The F-CODE can then be evaluated in the corresponding PAI module.
The function code is always passed in exactly the same WAY, regardless of whether it comes from a screen push button, a menu option, function key or other GUI element.