Routines vs User Exit in SAP
User exit
In this step, you can implement the user exits listed below.
You should carry out this step only if both of the followings apply:
- The SAP standard processes does not suit your needs.
- You are a competent ABAP/4 programmer.
User Exit Replaces
PBEN0001 Feature BAREA
PBEN0002 Feature BENGR
PBEN0003 Feature BSTAT
PBEN0004 Feature CSTV1
PBEN0005 Feature CRDV1
PBEN0006 Feature ELIGR
PBEN0007 Feature TRMTY
PBEN0008 Function HR_BEN_CALC_BENEFIT_COST
PBEN0009 Function HR_BEN_CALC_BENEFIT_CREDIT
PBEN0010 Function HR_BEN_CALC_BENEFIT_SALARY
PBEN0011 Function HR_BEN_CALC_COVERAGE_AMOUNT
PBEN0012 Form CALC_ELIG_DATE
PBEN0013 Form CALC_TERM_DATE
PBEN0014 Function HR_BEN_CALC_SAVE_ER_CONTRIB
PBEN0015 Form CHECK_ELIG_SERVICE
PBEN0016 Function HR_BEN_CALC_PARTICIPATION_DATE
PBEN0017 Feature EVTGR
PBEN0018 Feature COVGR
PBEN0019 Feature EECGR
PBEN0020 Feature ERCGR
PBEN0021 Funtionmodule HR_BEN_CALC_SPEN_ER_CONRIB
PBEN0022 Function HR_BEN_GET_PROCESS_DATES
PBEN0023 Function HR_BEN_CALC_CUTOFF_AGE
PBEN0024 Function HR_BEN_CALC_CUTOFF_LOS
PBEN0025 Function HR_BEN_CALC_CUTOFF_SAL
PCOB0001 COBRA Letter
PCOB0004 Form HR_BEN_COB_GET_TOTAL_COSTS
If you need to implement any of these User exits, you first create a project for the user exit, then assign the user exit(s) to your project. Then you write the coding for the user exit, and finally activate the project.
For general information about user exits, in the R/3 Library, go to Basis components and look at the Enhancements section. In addition, there is detailed information about each user exit that you can access when you assign it to your project (see below).
Activities
Start by creating your project.
1. Enter a name for your project.
2. Select Modification -> Create.
3. Enter a short text for your project and select save.
Next assign the user exit to your project.
4. Select Components.
5. Enter the name(s) of the user exits you want to implement.
6. Select SAP documentation, if you want detailed information on this user exit.
7. Select save.
8. Select back.
Next make your coding modifications.
9. Select enhancement components.
10. Select change.
11. Select the user exit you want to write code for.
12. Select the include zxpbco01.
The system will then prompt you to create this include, and you can continue to write your coding in it.
Next activate your project.
13. Return to the initial screen and select activate project.
Routines
Routines are short sub-programs that carry out various checks during document processing. In the SD module, you can create and process routines for copying requirements, data transfer, requirements and formulas using transaction VOFM. Besides the routines delivered to you with the system, you can create your own individual routines.
Transaction VOFM allows you to follow a standardized procedure for creating routines. The name ranges are predefined for routines delivered to you with the system and for routines created by the customer. This name convention guarantees that your own routines are not overwritten during a Release upgrade.
Copying requirements and data transfer
The routines for coying requirements and data transfer are defined for the document types sales orders, deliveries, billing documents, sales activities, as well as for texts. You specify copying requirements and the data transfers when defining the document flow for each document type. You enter the routines for texts in the access sequences for texts.
- Copying requirements determine which data is copied during the copying of documents. A copying requirement could define, for example, that the same customer must appear in the document header when you copy an inquiry to a quotation.
- Routines for data transfer make a detailed control of the copying of fields possible. A data transfer could define, for example, that particular item fields can only be copied in combination with other particular fields and can only be copied into contracts or credit and debit memos.
Requirements and formulas
Routines for requirements and formulas are used for functions using the condition technique. You enter these routines in the pricing procedure or the condition types. Requirements are also used for statistics.
- A requirement in pricing can determine that an access is dependent on a particular precondition. It can carry out a check of the document currency, for example, and, depending on whether it is a foreign or the local currency, allow or deny the access.
- Formulas are used in pricing to define various factors for pricing. Formulas are defined for scale base value, condition base value, condition amount, group key, and rounding rules. The formula for a rounding rule could define, for example, that all calculated amounts are rounded to two places behind the decimal point during a price change of the condition record. The formula for a condition base value could define, that the header discount is distributed among the order items according to volume an not value of the item, as is the case in the standard SAP R/3 System.
Creating routines
There are two methods to create a routine
1. Creating by overwriting
When using this method, a note appears as a commentary in the routine to be newly created.
2. Creating
When creating a new routine, an ABAP with internal number assignment is created.
You always have to activate a new routine before using it. Each routine for requirements and formulas, copying requirements and data transfers is stored in a separate program. For each new routine an entry is added in table TFRM and TFRMT. For each routine, a long text can be stored as a text module.
Most routines must be changed in client 000. Transaction VOFM can be transported as XPRAs, which means that after the import all routines can be activated.
Name ranges for routines
- The standard routines are to be within the number range 001-599 (for 2 digit formula numbers, 01-49)
- The user routines are to be within the number range 600-999 (for 2 digit formula numbers, 50-99).
Interface to the transport system
For technical reasons, an interface to the transport system is not possible at the moment. Until up to and including Release 3.0, developments have to be transported manually using correction numbers and transport requests.
Read Here for More SAP SD Tutorials