Download as PPT, PDF, TXT or read online from Scribd
Download as ppt, pdf, or txt
You are on page 1of 30
IBM Global Services
2005 IBM Corporation User Exits | 8.01 March-2005
User Exits IBM Global Services 2005 IBM Corporation 2 March-2005 User Exits | 8.01 Objectives The participants will be able to: Discuss the procedure of modifying SAP Standard program through procedure SSCR (SAP Software Change Registration). Locate, code and implement Function exits. Differentiate between CALL FUNCTION and CALL CUSTOMER-FUNCTION statements. Identify Projects and Enhancements and use the transactions CMOD and SMOD. IBM Global Services 2005 IBM Corporation 3 March-2005 User Exits | 8.01 Overview If you try to change the SAP program SAPMF02K, you will be prompted to enter the access key for that object. It mandatory for users to register all manual changes to SAP source coding and SAP Dictionary objects through a procedure called SSCR. IBM Global Services 2005 IBM Corporation 4 March-2005 User Exits | 8.01 SAP Modification After you enter the appropriate access key, you will be able to modify a SAP standard object. You should avoid making repairs to SAP objects/code. IBM Global Services 2005 IBM Corporation 5 March-2005 User Exits | 8.01 Obtaining Object Access Key To obtain the access key for changing a SAP Standard object, either run transaction OSS1 or go to the site www.service.sap.com. IBM Global Services 2005 IBM Corporation 6 March-2005 User Exits | 8.01 Obtaining Object Access Key (Contd.) Go to the registration tab Go to Register Objects IBM Global Services 2005 IBM Corporation 7 March-2005 User Exits | 8.01 Obtaining Object Access Key (Contd.) Select your server by matching installation number. Provide the Object name, SAP Release and click on the Register tab. The Registration Key for the Object will be displayed. IBM Global Services 2005 IBM Corporation 8 March-2005 User Exits | 8.01 Different Enhancement Techniques SAP 3 Tier Architecture
PRESENTATION : Field Exits (SAP would no longer support Field Exits) Screen Exits Menu Exits
APPLICATION: Program exits ( Function Exits, BAdis, Business Transaction Events, Substitution Exits )
DATABASE Append Structure IBM Global Services 2005 IBM Corporation 9 March-2005 User Exits | 8.01 Information on existing User-Exits Using transaction SPRO, one can information along with detailed documentation on the Exits available for areas of concern. IBM Global Services 2005 IBM Corporation 10 March-2005 User Exits | 8.01 Function-Exits
*------------------------------ ----* * include zxf05u01. * *------------------------------ ----* This INCLUDE program is where you will write the customer-specific code.
call customer- function 001...
function exit_sapmf02k_001. include zxf05u01. endfunction. SAP Original Code SAPMF02K Function Module INCLUDE Program This INCLUDE program will not be overwritten with an SAP upgrade because it is not SAP original code. IBM Global Services 2005 IBM Corporation 11 March-2005 User Exits | 8.01 Call Customer-Function Versus Call Function The CALL CUSTOMER-FUNCTION statement will only execute the function module if the module is activated. call function EXIT_SAPMF02K_001 Both of these CALL statements refer to the function module EXIT_SAPMF02K_001. IBM Global Services 2005 IBM Corporation 12 March-2005 User Exits | 8.01 Business Case Scenario UPDATE LOG Vendor # Vendor name When the user updates a vendor record, you want to insert a record into an update log that contains the vendor number and name of the updated record. IBM Global Services 2005 IBM Corporation 13 March-2005 User Exits | 8.01 Steps to Coding a Function-Exit 1. Locate Function-Exit(s) 2. Go to Function Module 3. Create INCLUDE Program 4. Code in INCLUDE Program 5. Activate Function-Exit IBM Global Services 2005 IBM Corporation 14 March-2005 User Exits | 8.01 Locate Function-Exit(s) IBM Global Services 2005 IBM Corporation 15 March-2005 User Exits | 8.01 Locate Function-Exit(s) In program SAPMF02K, search for the string call customer- function in the main program to find all of the function-exit(s) in the program. IBM Global Services 2005 IBM Corporation 16 March-2005 User Exits | 8.01 Locate Function-Exit(s) Double-click anywhere on the call customer-function 001 statement to go to that line in the SAP program. In program SAPMF02K, there is only one function-exit at line 83 of MF02KFEX. IBM Global Services 2005 IBM Corporation 17 March-2005 User Exits | 8.01 Go to Function Module Double-click on 001 of the CALL CUSTOMER-FUNCTION 001 statement in the SAP program to go to the function module EXIT_SAPMF02K_001. IBM Global Services 2005 IBM Corporation 18 March-2005 User Exits | 8.01 Create INCLUDE Program Double-click on the INCLUDE ZXF05U01 statement in the function module to create the INCLUDE program. IBM Global Services 2005 IBM Corporation 19 March-2005 User Exits | 8.01 Code in INCLUDE Program *------------------------------ * INCLUDE ZXF05U01 *------------------------------
if sy-uname = SANGRAMC.
endif.
Write code in the include program. Whatever logic you add here will affect all SAP standard transaction where this particular User Exit is being called. Put all your code within the username check, while you are at the middle of the user exit development. So, that your logic in the exit (which is incomplete now) does not affect others users in the system. At the end of the development, when you have tested that your logic is correct, remove the username check. So, the additional logic (tested & verified now) is now triggered for all users in the system.
IBM Global Services 2005 IBM Corporation 20 March-2005 User Exits | 8.01 Activating Function-Exit X X PROJECT 1 (can be activated/deactivated) Enhancement 1 Enhancement 2 Function Exit Screen Exit Function Exit PROJECT 2 (can be activated/deactivated) Enhancement 3 Function Exit You do not actually activate a single function-exit; instead, you activate a PROJECT that will include your user-exit(s). IBM Global Services 2005 IBM Corporation 21 March-2005 User Exits | 8.01 User-Exit Transactions CMOD : This transaction allows you to create a PROJECT by identifying its ENHANCEMENT(S). After determining all of the ENHANCEMENTS that are part of the PROJECT, you will have to activate the PROJECT. You will still need to code your user-exit; therefore, you may want to wait until this step is completed before activating the PROJECT. SMOD : This transaction allows you to create an ENHANCEMENT, which you will include in a PROJECT, by identifying its COMPONENT(S). In the case where SAP has already created an ENHANCEMENT for its pre-defined user-exits, you will not need to use transaction SMOD; instead, you should just use transaction CMOD.
IBM Global Services 2005 IBM Corporation 22 March-2005 User Exits | 8.01 Transaction CMOD In transaction CMOD, type in the name of your project and press the CREATE pushbutton. IBM Global Services 2005 IBM Corporation 23 March-2005 User Exits | 8.01 Transaction CMOD Once you SAVE your project, you can add as many enhancements as you want by pressing the SAP enhancements pushbutton. IBM Global Services 2005 IBM Corporation 24 March-2005 User Exits | 8.01 Transaction CMOD Add the enhancements you want included in the project. IBM Global Services 2005 IBM Corporation 25 March-2005 User Exits | 8.01 Transaction CMOD After saving your project, you need to ACTIVATE it. IBM Global Services 2005 IBM Corporation 26 March-2005 User Exits | 8.01 Transaction SMOD With the name of the enhancement, you can display its components. IBM Global Services 2005 IBM Corporation 27 March-2005 User Exits | 8.01 Transaction SMOD In the case of enhancement SAPMF02K, there is only one user-exit a function-exit using the function module EXIT_SAPMF02K_001. IBM Global Services 2005 IBM Corporation 28 March-2005 User Exits | 8.01 Additional Information You can use table MODACT to find the Project an Enhancement is included in. You can use table MODSAP to find the Enhancement for a Function Exit. Component or Function Exit IBM Global Services 2005 IBM Corporation 29 March-2005 User Exits | 8.01 Summary You should avoid making modifications/repairs to SAP objects/code whenever possible. It mandatory for users to register all manual changes to SAP source coding and SAP Dictionary objects through a procedure called SSCR. To obtain the access key for changing a SAP Standard object, either run transaction OSS1 or go to the site www.service.sap.com. The concept of a function-exit involves various points in original SAP programs that have calls to specific function modules. CALL CUSTOMER-FUNCTION statement will only execute a function module if the function module is activated. CMOD : This transaction allows you to create a PROJECT by identifying its ENHANCEMENT(S). SMOD : This transaction allows you to create an ENHANCEMENT, which you will include in a PROJECT, by identifying its COMPONENT(S). IBM Global Services 2005 IBM Corporation 30 March-2005 User Exits | 8.01 Questions How do you obtain access key for changing a SAP standard object ? What are the steps for coding a Function Exits ? What does CMOD and SMOD do ?