Escolar Documentos
Profissional Documentos
Cultura Documentos
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
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. 2. 3. 4. 5. 6. Make a customer copy of the RGGBS000 program Make the substitution exit visible substitution rule definition Create the logic for the substitution exit Assign the substitution program to the exit application area Create the substitution rule that will call the exit Assign and activate the substitution exit
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. C_EXIT_PARAM_FIELD - There is one field passed to the substitution exit, and this is the field that can be changed. C_EXIT_PARAM_CLASS - All data is passed as one parameter; this exit type can only be used in a matrix validations and substitutions.
o o
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. APPEND exits. After it has been copied and updated: exits-name = 'U002'. exits-param = c_exit_param_none. exits-title = text-002. your substitution exit APPEND exits. "Text element that contains description of "Cost center from CSKS
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.
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.
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.
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.
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
12