Search on this Website

Thursday, May 24, 2007

Example Of User Exit

This example code is based on enhancement SUSR0001.This enhancement uses function exit EXIT_SAPLSUSF_001 .

Enhancement : SUSR0001 User Exit after logon to SAP system.
When the User logs in the system ,this exit is called each and every time for every user after logon to the R/3 system.


Function Exit : EXIT_SAPLSUSF_001 .
Every dialog user passes thrugh this function module after logon,It can be used to execute individual customer checks and send mesages to the user.TABLE USR02 CONTAINS LOGON DATA and can be used in this exit to get the user logon data and take necessary actions as required by the customer requirement and even LOG_OFF (not recommended by SAP).

STEPS REQUIRED FOR IMPLEMETING THE EXIT

1) Open CMOD(Project maintenance) Transaction.Enter a project name starting with Z.Press enter.

2) Goto Enhancement window by clicking the enhancement button in the application tool bar.

3) Write SUSR0001 in the enhancement column and press enter.

4) Goto Components window(It will show al the exits included in this enhancement), in our case only one Function Exit will be shown.

5) Double click on the Function exit EXIT_SAPLSUSF_001.
The following function source code will be displayed in the function editor

FUNCTION EXIT_SAPLSUSF_001.*"----------------------------------------------------------------------*"*"Lokale Schnittstelle:*"----------------------------------------------------------------------
INCLUDE ZXUSRU01.
ENDFUNCTION.

6) Double click on the include ZXUSRU01 .If it will ask to create the include say yes .
7)Write the following code in the include.
DATA W_TEXT(30) TYPE C.DATA W_DATE(10) TYPE C.WRITE sy-datum TO W_DATE DD/MM/YYYY.CONCATENATE ' Date is ' W_DATE INTO W_TEXT.
CALL FUNCTION 'POPUP_TO_INFORM' EXPORTING titel = 'Welcome to Paradise !' txt1 = 'Have A Nice Day' txt2 = W_TEXT* TXT3 = ' '* TXT4 = ' '

8)Save the include and activate it .Activate the Project also by going to the menu in CMOD transaction.Now The user exit SUSR0001 has been implemented and is ready to use.
9) Logon to the R/3 system . A dialog box will appear with the message
Welcome to Paradise ! with date .

NOTE: BAPIs like BAPI_USER_GET_DETAIL can also be used to get user info or directly read from tables USR02 etc.
PP User Exit .
This user exit is used in PP and is for u to try
MCP20020 User exit for reading info structure when transferring reqtsit contains function exitEXIT_SAPMMCP6_020
When planned independent requirements are transferred from SOP to program data, the data is read at material/plant level as standard. You can use this user exit to have a greater or smaller number of characteristics for data selection. In this case, the data is read on a different level than that in the standard system.
The interface of this user exit corresponds to that of function module 'MC_PG_TRANSFER_PBED', but the info structure and the key fields table (structure IKEYF) are also transferred. YF). The characteristic attributes of the characteristics used for data must be transferred to the user exit in field 'Value' of the key fields table.
For further information, see function module: 'MC_PG_TRANSFER_PBED'

No comments: