Handy SAP function module to automate user events
Let me start my first blog with a useful function module that I came to know while solving one of the commonly faced issues in SAP.
ABAP Statement: MESSAGE ‘Text’ TYPE ‘E’.
On execution of this statement,processing stops,screen input field(s) gets disabled and the poor end-user has to press ENTER key to input again the screen input values. During my initial days as an ABAPer,I was not aware of the useful message_options of the MESSAGE statement (DISPLAY LIKE ‘W‘ and ‘E‘). So I googled without any hope to find out if there is any way that I could automate the event of user pressing the ENTER key.Wow! I got one.Made me wonder whether there is anything that ABAP doesn’t provide. ABAP is too good!!!!!
*Begin-Auto triggers ENTER command
CALL FUNCTION ‘SAPGUI_SET_FUNCTIONCODE‘
functioncode = ‘ENTER‘
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.
“Never calculate the height of a mountain before you climb it. When you reach the top, you will realise how low it was”