You are on page 1of 12

Creating a Substitution Exit

1
A Knowledge-Driven Consulting® White Paper
© 2010 Hitachi Consulting Corporation
Contents

Introduction .................................................................................................. 3

Step 1 Make a customer copy of the RGGBS000 program ......................... 3

Step 2 Make the substitution exit visible substitution rule definition ............ 4

Step 3 Create the logic for the substitution exit ............................................ 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

Step 6 Assign and activate the substitution exit .......................................... 9

Author Bio .................................................................................................. 12

About Hitachi Consulting Corporation.................................................... 12

About Hitachi, Ltd...................................................................................... 12

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

We will now take a deeper dive into these 6 steps.

Step 1 - Make a customer copy of the RGGBS000


program
There is a standard SAP program (RGGBS000) that is delivered with SAP. This
program contains examples of substitution exits. In order to create custom
substitution exits, a 'Z' version of this program must be created (ZGGBS000).
The example program contains examples of how the substitution exit should be
coded and what naming standards should be followed. These examples can be
used as a template for creating new substitution exits.

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.

Examples of the actual code.


SAP Example:
exits-name = 'U101'.
exits-param = c_exit_param_field.
exits-title = text-101. "Cost center from CSKS
APPEND exits.

After it has been copied and updated:


exits-name = 'U002'.
exits-param = c_exit_param_none.
exits-title = text-002. "Text element that contains description of
your substitution exit
APPEND exits.

Step 3 - Create the logic for the substitution exit


The actual code for the substitution exit should be placed in a form with the
same name that was assigned to the exits-name field. Depending on what type
of substitution exit was defined, the new substitution exit form may or may not
have a parameter associated with it. There are examples of the three different
types of substitution exits in the sample program (RGGBS000). For the
purposes of this document we will assume that c_exit_param_none is being
used. The following is an example of the substitution exit that was written to
concatenate the posting date and the username of the person who posted the
document into the BSEG-ZUONR (document item assignment field). This is a

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.

Step 4 - Assign the substitution program to the exit


application area
The next step in setting up the substitution exit is to let SAP know the name of
the program where the substitution exits reside. This can be accomplished by
executing the transaction GCX2 or following this path in the IMG Financial
Accounting (New) - Special Purpose Ledger -Basic Settings - User Exits -
Maintain Client Specific User Exits.

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.

A substitution name and description must be entered at this time.

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.

The newly created step must be given a name.

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

About Hitachi Consulting Corporation


As Hitachi, Ltd.'s (NYSE: HIT) global consulting company, with operations in the
United States, Europe and Asia, Hitachi Consulting is a recognized leader in
delivering proven business and IT strategies and solutions to Global 2000
companies across many industries. With a balanced view of strategy, people,
process and technology, we work with companies to understand their unique
business needs, and to develop and implement practical business strategies and
technology solutions. From business strategy development through application
deployment, our consultants are committed to helping clients quickly realize
measurable business value and achieve sustainable ROI.

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.

For more information, call 1.877.664.0010 or visit


www.hitachiconsulting.com.

About Hitachi, Ltd.


Hitachi, Ltd., (NYSE: HIT / TSE: 6501), headquartered in Tokyo, Japan, is a
leading global electronics company with approximately 360,000 employees
worldwide. Fiscal 2009 (ended March 31, 2010) consolidated revenues totaled
8,968 billion yen ($96.4 billion). Hitachi will focus more than ever on the Social
Innovation Business, which includes information and telecommunication
systems, power systems, environmental, industrial and transportation systems,
and social and urban systems, as well as the sophisticated materials and key
devices that support them For more information on Hitachi, please visit the
company's website at http://www.hitachi.com.
© 2010 Hitachi Consulting Corporation.
All rights reserved. “Building the Market Responsive Company,” “Knowledge-Driven Consulting,” and “Dove Consulting”
are all registered service marks of Hitachi Consulting Corporation. “Business Intelligence at the Edge of the Enterprise”
and “Performance Management at the Edge of the Enterprise” are service marks of Hitachi Consulting Corporation.

12

You might also like