Professional Documents
Culture Documents
Substitution Exit PDF
Substitution Exit PDF
1
A Knowledge-Driven Consulting® White Paper
© 2010 Hitachi Consulting Corporation
Contents
Introduction .................................................................................................. 3
Step 2 Make the substitution exit visible substitution rule definition ............ 4
Step 4 Assign the substitution program to the exit application area. ........... 5
Step 5 Create the substitution rule that will call the exit .............................. 5
2
Introduction
Quite often on SAP FI/CO projects the SAP configuration offers limited ability to
influence how certain fields on financial documents are being populated. For
example, the sort key on the GL account master record determines what values
get populated into the allocation field of the financial document when this GL
account is posted to. Very often the simplistic logic of these assignments does
support the actual business requirement. In order to be able to model a more
realistic way of supplying values to transactions, a substitution rule is used. A
substitution rule allows the consultant to define their own conditions for
substituting specific fields.
A substitution rule consists of parts, the prerequisite and the substitution. If the
prerequisite is met the substitution is carried out. There are constraints put
around substitution rules, that limit what fields can be updated/substituted, and
the complexity of the formulas/assignments that can be made within a
substitution rule. In these cases, a substitution exit must be used.
The steps required to create a substitution exit, and define it within a substitution
rule are as follows:
1. Make a customer copy of the RGGBS000 program
2. Make the substitution exit visible substitution rule definition
3. Create the logic for the substitution exit
4. Assign the substitution program to the exit application area
5. Create the substitution rule that will call the exit
6. Assign and activate the substitution exit
There are two changes that must be made to the 'Z' version of the program.
First the substitution exit must be defined in the GET_EXIT_TITLES form. This
allows the substitution exit to be available for selection from the substitution rule
screen. The second change is the actual coding of the new substitution exit. The
coding for the new substitution exit should be in a form with same name that was
entered in the GET_EXIT_TITLES form. The following is a detailed explanation
of the fields that must be populated in the GET_EXIT_TITLES form, followed by
examples of code from the RGGBS000 program.
3
Step 2 - Make the substitution exit visible substitution
rule definition
The following are fields that must be populated in the GET_EXIT_TITLES form.
• Exits-name
o The naming convention for the exits-name field is UXXX for user
defined substitution exits, and SXXX for standard substitution exits.
You will need to give your substitution exit a new name (one that has
not already been used).
• Exits-param
o C_EXIT_PARAM_NONE - No parameters are defined for the
substitution exit. Anything that you wish to substitute must be a field
in one of the tables that is declared in the tables section of the
include.
o C_EXIT_PARAM_FIELD - There is one field passed to the
substitution exit, and this is the field that can be changed.
o C_EXIT_PARAM_CLASS - All data is passed as one parameter; this
exit type can only be used in a matrix validations and substitutions.
• Exits-title
o You will need to create a text element that contains the description of
the substitution exit you are creating. The text element you created
will be assigned to the Exits-title field.
4
very simple example, but it is something that can't be accomplished by using a
substitution rule alone. Substitution exits are capable of performing functions
much more complicated than the example below, however, there are several
things to be aware of when developing the substitution exit. Avoid calling dialog
boxes, issuing any messages, and do not use any commands that will result in
leaving the exit directly (Leave to screen, etc.). Once the substitution exit is
coded, activate the program.
FORM U002.
Concatenate BKPF-USNAM BKPF-BUDAT into BSEG-ZUONR.
ENDFORM.
The application area GBLS are for the GL Validation/substitution rules and
substitutions. The name of the program where the new substitution exit resides
should be entered here. This table lets SAP know where to locate the
substitution exits.
Step 5 - Create the substituion rule that will call the exit
There are several transactions that can be used to navigate to the substitution
exits, GGB1 is the substitution overview transaction. This transaction has a tree
structure that contains the substitution rules for all application areas.
5
Transaction OBBH can be used to navigate to the GL and Sub-ledger
substitution exits, transaction OKC9 can be used to navigate to the Controlling
substitution exits, and transaction 0KEM can be used to navigate to the profit
centers on sales documents substitution exits.
For the purpose of this document transaction GGB1 is used, and the new
substitution exit is inserted into the line item section of the Financial Accounting
section of the tree structure.
A substitution rule can be created by selecting the desired area and clicking on
the create substitution button.
6
Next a step must be defined for the substitution rule. This can be done by
highlighting the new substitution and clicking on the create step button.
Once the create step button is pushed, a pop-box will appear and here the only
exit option can be selected. This will allow the new substitution exit to be called.
7
Next the pre-requisite should be defined. For this example the ZUONR field
should be populated for every document, so there is no pre-requisite defined.
The absence of a pre-requisite will result in the substitution being called every
time.
Finally the new substitution exit is assigned to the substitution rule. By selecting
the drop down on the exit field SAP presents a list of all substitution exits which
can be selected. The newly created substitution exit is on this list and can be
selected at this time.
Once the substitution exit is selected and the substitution rule is saved, the final
step is complete.
8
Step 6 - Assign and activate the substitution exit
The transaction OBBH (for FI substitutions) can be used to assign the
substitution rule to particular company codes, and also set the activation level.
There can only be one substitution rule/call up point per company code, so if the
call up point is already assigned then the substitution exit will have to be added
as an additional step in the existing substitution rule. If there is not a substitution
rule/call up point assigned to the desired company code, then it can be assigned
by clicking the New Entries button.
9
To assign the substitution rule enter the desired company code, enter the call up
point that is associated with the newly created substitution rule, select the
substitution rule from the drop down menu. If a call point was selected that was
not associated with the newly created substitution rule, it will not appear in the
drop down list. Next the activation level must be set. There are three different
activation levels (0 - Inactive, 1 - Active, 2 - Active, no batch input). If the
activation level is set to 0, the assignment is made, but is not active. If the
activation level is set to 1 the assignment is made, and the substitution is active.
This level will also allow the substitution rule to be called in batch mode. If the
activation level is set to 2 the assignment is made and the substitution is active,
but not available during batch input. Once the record is entered it must be
saved.
The final step is the activation/regeneration of the ABAP coding for the
substitution. This can be accomplished by executing transaction SE38 or SA38
and executing program RGUGBR00.
Once the RGUGBR00 program is execute the selection screen will appear. This
selection screen instructs the program to only generate certain things and only
for specific application areas and call up points. For this example the application
area is FI, the call up point is '*', and the following checkboxes should be
checked (Regenerate main program, Generate Substitutions, Generate
Substitution Usage, Generate Substitution exp. Routines). When the program
runs with these selections, it will activate/regenerate all of the objects tied to the
newly created substitution exit.
10
Once the program has finished running the following message will appear on the
status bar at the bottom of the screen. This message indicates that the
substitution exit is saved and generated.
Most FI/CO consultants are very familiar with substitution/validation rules so the
task of creating a substitution exit may be split between a functional and
technical resource, but it is always a good thing when we as consultants learn to
step outside of our boxes and acquire knowledge and skill on an area different
than our own.
This document focused primarily on GL substitution exits, but these same steps
(with some minor modifications) can be used in other areas.
11
Author Bio
Matt Montgomery
Hitachi Consulting's client base includes 25 percent of the Global 100 as well as
many leading mid-market companies. We offer a client-focused, collaborative
approach and transfer knowledge throughout each engagement.
12