Handy SAP function module to automate user events
*Begin-Auto triggers ENTER command
CALL FUNCTION 'SAPGUI_SET_FUNCTIONCODE'
EXPORTING
functioncode = 'ENTER'
EXCEPTIONS
function_not_supported = 1
OTHERS = 2.
*End-Auto triggers ENTER command
Similarly we can work around with standard function codes (viz.,SAVE,EXECUTE etc.) and custom function codes (which we add in push button,radio button,hyperlink etc.) with this wonderful FM.
refer to:http://scn.sap.com/community/abap/blog/2013/07/31/handy-sap-function-module-to-automate-pai-events