chapter 01_user exits

Upload: sunil-reddy

Post on 04-Apr-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 Chapter 01_User Exits

    1/30

    IBM Global Services

    2005 IBM CorporationUser Exits | 8.01 March-2005

    User Exits

  • 7/31/2019 Chapter 01_User Exits

    2/30

    IBM Global Services

    2005 IBM Corporation2 March-2005User 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.

  • 7/31/2019 Chapter 01_User Exits

    3/30

    IBM Global Services

    2005 IBM Corporation3 March-2005User Exits | 8.01

    Overview

    If you try to change the SAPprogram SAPMF02K, you will

    be prompted to enter the accesskey for that object.

    It mandatory for users to register all manual changes to SAP source coding andSAP Dictionary objects through a procedure called SSCR.

  • 7/31/2019 Chapter 01_User Exits

    4/30

    IBM Global Services

    2005 IBM Corporation4 March-2005User Exits | 8.01

    SAP Modification

    After you enter the appropriate access key, you will be able to modify a SAPstandard object. You should avoid making repairs to SAP objects/code.

  • 7/31/2019 Chapter 01_User Exits

    5/30

    IBM Global Services

    2005 IBM Corporation5 March-2005User Exits | 8.01

    Obtaining Object Access Key

    To obtain the access key for changing a SAPStandard object, either run transaction OSS1 or

    go to the site www.service.sap.com.

  • 7/31/2019 Chapter 01_User Exits

    6/30

    IBM Global Services

    2005 IBM Corporation6 March-2005User Exits | 8.01

    Obtaining Object Access Key (Contd.)

    Go to the registration tab

    Go to Register Objects

  • 7/31/2019 Chapter 01_User Exits

    7/30

    IBM Global Services

    2005 IBM Corporation7 March-2005User 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.

  • 7/31/2019 Chapter 01_User Exits

    8/30

    IBM Global Services

    2005 IBM Corporation8 March-2005User 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

  • 7/31/2019 Chapter 01_User Exits

    9/30

    IBM Global Services

    2005 IBM Corporation9 March-2005User Exits | 8.01

    Information on existing User-Exits

    Using transaction SPRO, one can information along with detailed documentationon the Exits available for areas of concern.

  • 7/31/2019 Chapter 01_User Exits

    10/30

    IBM Global Services

    2005 IBM Corporation10 March-2005User Exits | 8.01

    Function-Exits

    *----------------------------------*

    * include zxf05u01.*

    *----------------------------------*

    This INCLUDE

    program is where youwill write thecustomer-specificcode.

    call customer-function 001...

    functionexit_sapmf02k_001.

    include zxf05u01.

    endfunction.

    SAP Original CodeSAPMF02K

    Function Module INCLUDE Program

    This INCLUDE programwill not be overwrittenwith an SAP upgradebecause it is not SAP

    original code.

  • 7/31/2019 Chapter 01_User Exits

    11/30

    IBM Global Services

    2005 IBM Corporation11 March-2005User Exits | 8.01

    Call Customer-Function Versus Call Function

    The CALL CUSTOMER-FUNCTIONstatement will only execute thefunction module if the moduleis activated.

    call function EXIT_SAPMF02K_001

    Both of these CALL statements refer

    to the function module

    EXIT_SAPMF02K_001.

  • 7/31/2019 Chapter 01_User Exits

    12/30

    IBM Global Services

    2005 IBM Corporation12 March-2005User Exits | 8.01

    Business Case Scenario

    UPDATE LOG

    Vendor #Vendor name

    When the user updates a vendor record, you want toinsert a record into an update log that contains thevendor number and name of the updated record.

  • 7/31/2019 Chapter 01_User Exits

    13/30

    IBM Global Services

    2005 IBM Corporation13 March-2005User 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

  • 7/31/2019 Chapter 01_User Exits

    14/30

    IBM Global Services

    2005 IBM Corporation14 March-2005User Exits | 8.01

    Locate Function-Exit(s)

  • 7/31/2019 Chapter 01_User Exits

    15/30

    IBM Global Services

    2005 IBM Corporation15 March-2005User 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) inthe program.

  • 7/31/2019 Chapter 01_User Exits

    16/30

    IBM Global Services

    2005 IBM Corporation16 March-2005User Exits | 8.01

    Locate Function-Exit(s)

    Double-click anywhere onthe call customer-function001 statement to go to

    that line in the SAP program.

    In program SAPMF02K, there is

    only one function-exit at line 83 of

    MF02KFEX.

  • 7/31/2019 Chapter 01_User Exits

    17/30

    IBM Global Services

    2005 IBM Corporation17 March-2005User Exits | 8.01

    Go to Function Module

    Double-click on 001 of theCALL CUSTOMER-FUNCTION

    001 statement in the SAPprogram to go to the functionmodule EXIT_SAPMF02K_001.

  • 7/31/2019 Chapter 01_User Exits

    18/30

    IBM Global Services

    2005 IBM Corporation18 March-2005User Exits | 8.01

    Create INCLUDE Program

    Double-click on the INCLUDEZXF05U01 statement in thefunction module to create theINCLUDE program.

  • 7/31/2019 Chapter 01_User Exits

    19/30

    IBM Global Services

    2005 IBM Corporation19 March-2005User 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 theuser 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 Gl b l S i

  • 7/31/2019 Chapter 01_User Exits

    20/30

    IBM Global Services

    2005 IBM Corporation20 March-2005User Exits | 8.01

    Activating Function-Exit

    X

    X

    PROJECT 1

    (can be activated/deactivated)

    Enhancement1

    Enhancement2

    FunctionExit

    ScreenExit

    FunctionExit

    PROJECT 2

    (can be activated/deactivated)

    Enhancement3

    FunctionExit

    You do not actually activate a single function-exit; instead, you activate aPROJECT that will include your user-exit(s).

    IBM Gl b l S i

  • 7/31/2019 Chapter 01_User Exits

    21/30

    IBM Global Services

    2005 IBM Corporation21 March-2005User Exits | 8.01

    User-Exit Transactions

    CMOD : This transaction allows you to create a PROJECT by identifying itsENHANCEMENT(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 Gl b l S i

  • 7/31/2019 Chapter 01_User Exits

    22/30

    IBM Global Services

    2005 IBM Corporation22 March-2005User Exits | 8.01

    Transaction CMOD

    In transaction CMOD, type in thename of your project and pressthe CREATE pushbutton.

    IBM Gl b l S i

  • 7/31/2019 Chapter 01_User Exits

    23/30

    IBM Global Services

    2005 IBM Corporation23 March-2005User Exits | 8.01

    Transaction CMOD

    Once you SAVE your project,you can add as manyenhancements as you want bypressing the SAPenhancements pushbutton.

    IBM Global Services

  • 7/31/2019 Chapter 01_User Exits

    24/30

    IBM Global Services

    2005 IBM Corporation24 March-2005User Exits | 8.01

    Transaction CMOD

    Add the enhancements youwant included inthe project.

    IBM Global Services

  • 7/31/2019 Chapter 01_User Exits

    25/30

    IBM Global Services

    2005 IBM Corporation25 March-2005User Exits | 8.01

    Transaction CMOD

    After saving your project,you need to ACTIVATE it.

    IBM Global Services

  • 7/31/2019 Chapter 01_User Exits

    26/30

    IBM Global Services

    2005 IBM Corporation26 March-2005User Exits | 8.01

    Transaction SMOD

    With the name of the enhancement,you can display its components.

    IBM Global Services

  • 7/31/2019 Chapter 01_User Exits

    27/30

    IBM Global Services

    2005 IBM Corporation27 March-2005User Exits | 8.01

    Transaction SMOD

    In the case of enhancement

    SAPMF02K, there is only one

    user-exit a function-exit usingthe function moduleEXIT_SAPMF02K_001.

    IBM Global Services

  • 7/31/2019 Chapter 01_User Exits

    28/30

    IBM Global Services

    2005 IBM Corporation28 March-2005User 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

  • 7/31/2019 Chapter 01_User Exits

    29/30

    IBM Global Services

    2005 IBM Corporation29 March-2005User Exits | 8.01

    Summary

    You should avoid making modifications/repairs to SAP objects/code wheneverpossible.

    It mandatory for users to register all manual changes to SAP source coding andSAP Dictionary objects through a procedure called SSCR.

    To obtain the access key for changing a SAP Standard object, either runtransaction 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 willinclude in a PROJECT, by identifying its COMPONENT(S).

    IBM Global Services

  • 7/31/2019 Chapter 01_User Exits

    30/30

    IBM Global Services

    2005 IBM C ti30 M h 2005U E it | 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 ?