Chapter 01 - User Exits
April 5, 2023 | Author: Anonymous | Category: N/A
Short Description
Download Chapter 01 - User Exits...
Description
IBM Global Services
User Exits
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Objectives
The participants will be able to:
2
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.
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Overview
It mandatory for users to register all manual changes to SAP source coding and SAP Dictionary objects through a procedure called SSCR.
If you try to change the SAP program “SAPMF02K”, you will be prompted to enter the access key for that object.
3
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
SAP Modification
4
After you enter the appropriate access key, key, you will be able to modify a SAP standard object. You You should avoid making repairs to SAP objects/code.
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Obtaining Object Access Key
5
To obtain the access key for changing a SAP Standard object, either run transaction OSS1 or go to the site www.service.sap.com.
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Obtaining Object Access Key (Contd.)
6
User Exits | 8.01
Go to the registration tab Go to Register Objects
March-2005
© 2005 IBM Corporation
IBM Global Services
Obtaining Object Access Key (Contd.)
7
User Exits | 8.01
Select your server by matching installation number. Provide the Object name, SAP Release and click on the „Register‟ tab. tab. The Registration Key for the Object will be displayed.
March-2005
© 2005 IBM Corporation
IBM Global Services
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
8
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Information on existing User-Exits
9
Using transaction SPRO, one can information along with detailed documentation on the Exits available for areas of concern.
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Function-Exits
SAP Original Code “SAPMF02K”
Function Module
INCLUDE Program
call customer-
function
*------------------------------
function “001”...
exit_sapmf02k_001. include zxf05u01.
----* * include zxf05u01. *
endfunction.
*---------------------------------* This INCLUDE program is where you will write the customer-specific This INCLUDE program will not be overwritten code. with an SAP upgrade because it is not SAP original code. 10
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Call Customer-Function Versus Call Function
Both of these CALL statements refer to the function module “EXIT_SAPMF02K_001”. “EXIT_SAPMF02K_001”.
call function „EXIT_SAPMF02K_001‟ „EXIT_SAPMF02K_001‟
The CALL CUSTOMER-FUNCTION statement will only execute the function module if the module is activated. 11
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Business Case Scenario When the user updates a vendor record, you want w ant to insert a record into an update log that contains the vendor number and name of the updated record.
12
User Exits | 8.01
March-2005
UPDATE LOG Vendor # Vendor name
© 2005 IBM Corporation
12
User Exits | 8.01
March 2005
IBM Global Services
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
© 2005 IBM Corporation
13
User Exits | 8.01
IBM Global Services
Locate Function-Exit(s)
March 2005
© 2005 IBM Corporation
14
User Exits | 8.01
March 2005
© 2005 IBM Corporation
IBM Global Services
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.
15
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Locate Function-Exit(s)
Double-click anywhere on the call customer-function customer-function “001” statement to go to that line in the SAP program.
In program “SAPMF02K”, there only one function-exit at line 83 is of “MF02KFEX”.
16
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
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”.
17
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Create INCLUDE Program
Double-click on the INCLUDE ZXF05U01 statement in the function module to create the INCLUDE program.
18
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
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.
19
User Exits | 8.01
© 2005 IBM Corporation
March-2005
IBM Global Services
Activating Activatin g Function-Exit Function-Exit
You do not actually activate a single function-exit; instead, you activate a PROJECT that will include your user-exit(s).
PROJECT 1
PROJECT 2
(can be activated/deactivated) activated/deactivated)
Enhancement 1
Function Exit
Screen Exit
Enhancement 2
Function Exit
(can be activated activated/deactivated) /deactivated)
X
X
Enhancement 3
Function Exit
20
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
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 ENHANCEMENT,, which you will include in a PROJECT, 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.
21
User Exits | 8.01
March-2005
IBM Global Services
Transaction CMOD
In transaction CMOD, type in the name of your project and press the CREATE pushbutton.
© 2005 IBM Corporation
22
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Transaction CMOD
Once you SAVE your project, you can add as many enhancements as you want by pressing the SAP enhancements pushbutton.
23
User Exits | 8.01
March-2005
IBM Global Services
Transaction CMOD
Add the enhancements you want included in the project.
© 2005 IBM Corporation
24
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Transaction CMOD
After saving your project, you need n eed to ACTIVA ACTIVATE TE it.
25
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Transaction SMOD
With the name of the enhancement, you can display its components.
26
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Transaction SMOD
In the case of enhancement “SAPMF02K”, there is only one user-exit – a function-exit using the function module “EXIT_SAPMF02K_001”.
27
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Additional Information Information
You can use ttable able MODACT to find the Project an Enhancement is included in.
You can use ttable able MODSAP to find the Enhancement for a Function Exit.
Component or Function Exit
28
User Exits | 8.01
March-2005
© 2005 IBM Corporation
IBM Global Services
Summary
You should avoid making modifications/repairs to SAP objects/code objects/c ode 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 CUSTOMERCUSTOMER-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).
29
User Exits | 8.01
March-2005
IBM Global Services
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 ?
© 2005 IBM Corporation
View more...
Comments