Function module exit is nothing but a function module with a Z include where you can put your code.
Function module EXIT is called using
CALL CUSTOMER-FUNCTION ‘<XXX>’. syntax.
Where XXX is three digits no. So the Function module name looks like
EXIT_SAPLSUSF_XXX.
Scenario: Let’s take an example in that the requirement is to put a welcome message to user when he/she log in into SAP system.
Step 1:
Go to the transaction SMOD: use menu path utilitiesà find
And give the Package name as SUSR and execute it you can see the below component in it:
Step 2
We have SUSR0001 component. From the description of the component you can make out that this EXIT is called after user log in into SAP system so we can use it for our purpose.
Go to Transaction CMOD and create a Project named ZGUICHCK (you can give any name starting with Z ).
Step3
Click on the Enhancement Assignment to include the component into this project. Give our component SUSR0001 and click enter button.
Go to Components window (It will show all the exits included in this enhancement), in our case only one Function Exit will be shown.
Double click on the Function exit EXIT_SAPLSUSF_001.It will open Function Module Editor. Double click on the INCLUDE ZXUSRU01.
Write down your welcome message here. you can use below code:
If sy-uname eq <userid>.
Message ‘Welcome Sweet Heart’ type ‘I’.
Endif.
Now logout and log in again with <userid>. You will get the popup saying
(Note: Take care that <userid> is not your lady Boss!!!!!!).