Welcome to the tutorial about SAP CO Account Assignment. This tutorial is part of our free SAP CO training. You will learn how account assignment works in SAP ERP and what are different sources of information about account assignment that the SAP system uses.
Normally, when a financial document is entered in SAP FI module, user has the option of entering the cost center in the financial document. However, when documents are entered from different modules or a cross-module financial transaction occurs, such as from MM or SD, there is no option of entering the cost center in the document. In this situation, the SAP system will derive the cost center through automatic SAP CO account assignment, substitutions, or through default settings made in the primary cost element.
Automatic SAP CO Account Assignment
The automatic account assignment has to be configured in the transaction code OKB9. For posting made in external accounting, such as for price differences, exchange rate differences, etc., the SAP system automatically checks entries in the OKB9 settings and derives the cost center.
If you do not enter a CO object (order, cost center, or project) in external accounting postings made in FI, MM or SD modules and the posting is cost relevant, then the automatic account assignment checks the relevant cost center and makes the posting.
Here are examples of automatic account assignments:
- Banking fees, exchange rate differences and discounts in FI
- Minor differences and price differences in MM
The account assignment objects that can be maintained in the transaction OKB9 are:
Normally, the automatic account assignment runs on the company code level along with the CO object. However, if the user wants to make the posting on the business area level, valuation area level or profit center level, it is also available in OKB9 settings. So basically it includes the following levels:
- Company code level
- Business area level
- Valuation area level
- Profit center level
The above 3 excluding the company code level are used in cases when the account assignment is needed below the company code level.
Here are the prerequisites of activating automatic SAP CO account assignment:
- Activation of the cost center accounting
- Creation of cost centers
- Maintenance of cost elements
Additionally, you can also create orders and profit centers as per the business requirements.
Settings in Transaction OKB9
Let’s discuss settings that are possible for automatic SAP CO account assignment in OKB9 transaction.
Start SPRO transaction and navigate to the following path:
Controlling – Cost Center Accounting – Actual Postings – Manual Actual Postings – Edit Automatic Account Assignment (OKB9)
Alternatively, you can start OKB9 transaction directly from the command bar.
- If you want to have the setting on the company code level only, then enter the company code and the cost element along with the corresponding CO object, i.e. a cost center, an order or a profit center.
- If you want to have the settings on the valuation area level, then enter the company code and the cost element and chose the ‘valuation area’ option in the account assignment detail as ‘1’.
- Similarly, if you want to have the settings on the business area or profit center level, then choose the option ‘2’ or ‘3’ respectively.
If you have chosen account assignment detail ‘1’ or ‘2’, then click on ‘Detail per business area/valuation area’ on the left sidebar.
Enter the valuation area and enter the corresponding CO object, then click save button.
Default SAP CO Account Assignment
In order to determine the correct CO account assignment, the SAP system performs several checks in the following sequence. First it checks the document which a user is posting. If the cost center is empty in the document, then the system checks if any substitutions are maintained for the particular G/L account. Next, if the substitution is also missing, then the system moves on to the OKB9 settings for automatic SAP CO account assignments. Finally, if these settings are also missing, the SAP system checks master data of the primary cost element (G/L Account) under the tab of Default Account Assignment. You can display this master data using the transaction KA03.
You can maintain the cost center and the order in the master data of the primary cost element.
So, basically the order of checks the system makes is:
- Financial document – Cost center
- Substitutions – transaction OKC9
- Automatic account assignments – transaction OKB9
- Default account assignments – transaction KA03/KA02
Lastly, if any of the above is not maintained, then the SAP system throws an error ‘Account X requires an assignment to a CO Object’ and doesn’t allow posting of a document.
SAP CO Account Assignment using Substitution
In cases where you don’t need OKB9 or default account assignment, the user can go for user exits where a specific G/L account is mentioned under the company and the value in the cost center is substituted by the cost center given in the substitution.
The transaction for maintaining the substitution is GGB1.
Usage of substitutions for SAP CO account assignment is justified by the business requirement and usually SAP CO account assignment requirements are fulfilled by OKB9 or default account assignments.
Did you like this tutorial? Have any questions or comments? We would love to hear your feedback in the comments section below. It’d be a big help for us, and hopefully it’s something we can address for you in improvement of our free SAP CO tutorials.
Page last updated by Cleo Isco on
All releases of SAP for Financial postings made from a various applications like SAP-Logistics, SAP-Financials, etc for more information, visit the Enterprise Resource planning homepage
Automatic assignment occurs during postings in external accounting (with in the FI, MM, or SD components) if you did not enter a CO account assignment object (cost center, order, or project) for a cost accounting relevant posting. This is always the case if the R/3 System automatically created the posting row in question.
This paper highlights an alternative approach where standard default account assignment (OKB9) based on Valuation area or Profit Center is not sufficient and a default account assignment based on Valuation area and Profit center is required.
Author: Raheem Baksh
Company: NovelERP Solution Pvt.Ltd.
Created On: Apr 2013
Standard SAP – Default Account Assignment (OKB9)
The standard SAP offers to specify a default account assignment (Cost Center/Internal Order)
- Per company code
- Per Business area
- Per Profit Center
- Per Valuation area
In cases, where a default account assignment is to be specified below the company code, then “Account Assignment Detail” field in OKB9 is used to specify a default CO object per Business area or Profit center or Valuation area.
But system does not determined Default cost object from OKB9 for automatically generated lines that reference the entire document and not individual items.
For More Information Read SAP Notes 105024, and 32654
“DIF” (minor differences)
“UPF” (unplanned delivery costs)
“KDT” (tax exchange rate difference)
“KDR” (exchange rate rounding)
Default Account Assignment in OKB9
You can define automatic account assignments In OKB9 or defaults in the cost element masters data record .The cost element master data record can determine these assignments per controlling area, and the IMG per company code, business area, and/or valuation area.
Transaction Code – OKB9
Here it is mandatory to set Minimum One Combination to call Default Account Assigned Object
- Valuation Area is mandatory
- Business Area is mandatory
- Profit center is mandatory
Here we have set as “1”Valuation Area is mandatory
Here whenever Prerequisite met from your Transaction System will pickup default cost center as per Valuation area.
Define Substitution OKC9
In substitution, the SAP System checks whether particular input values satisfy one or more user-defined conditions. If the condition is fulfilled, the values are automatically replaced by other values.
The following callup points are defined in the standard SAP System for Controlling:
- 0001 – Document row : Used for all CO-relevant postings in external accounting as well as for manual postings in CO.
- 0010 – Order: Used for order background processing and irrelevant for account assignment checks.
- 0100 – Document header: Used for manual postings in CO, such as reposting costs or activity allocation.
- 1. Determine in which controlling area you want to substitute values.
- 2. Create a substitution.
Proceed as follows:
a) Choose the “New entries” function.
b) Enter the controlling area in which the substitution is to be executed.
c) Enter a callup point.
d) Save your entries
e) Choose “Environment -> Substitution”.
f) Enter a name and a callup point for the substitution.
You can use an existing substitution as a reference.
g) Change the model data to meet your specifications, or copy them without changes.
h) Save your entries.
i) If you do not use a reference, proceed as follows:
j) Verify your entries by freeing the data for release.
k) Enter a description of the substitution.
l) To define the substitution steps, choose “Insert entry”.
m) Choose the substitution fields in the dialog box that appears.
You can choose “Exit only” or database fields. “Exit only” ensures that all fields allowed for substitution are available only in this USER-EXIT. Otherwise, you can replace one field only, using a value defined in the USER-EXIT.
n) Transfer one or more of the displayed substitution fields.
o) Enter a description of the substitution step.
p) Enter one or more conditions under “Prerequisites”.
Use the function “Fields for conditions” to do so. You may also maintain rules by choosing the corresponding function.
q) Enter constant values for the fields to be substituted, or store a substitution exit.
r) Save the substitution steps.
s) Return to the initial screen.
t) Enter the substitution’s name for your controlling area and set an activation level.
Activation level “1” ensures that the substitution is active in the correct controlling area.
u) Save the substitution.
Note on transport
To transport substitutions, a separate function is available in the IMG for “General Controlling”
Transaction Code – OKC9
Prerequisite – Company code =1000 and Controlling area =1000
If Prerequisite is met substitute by User exit UOKB0
Check Client specific user exit GCX2
Transaction code: GCX2
Here you need to check assigned program for the Application Area GBLS.
You need to some change in Program, First copy from Existing program RGGBS000.
Copy from Exiting program SE38
Copy from Existing program and change in Z Program, Ask technical guy if you are not familiar on Program, for copy or change new program you need to developer ID.
Change in Z Program as below-
Note : see below changes are based on organization structure here you need to determine which field you can enter to get Cost center, if you are using Business area so OKB9 can be determine by Business area .
We have made OKB9 account assignment as per Valuation Area, but here system does not determine profit center and Valuation Area for auto generated line item,
Our Business Place and Section Code is equal to Plant (Valuation Area)
*& Form UOKB9
FORM UOKB9 .
if COBL–WERKS is INITIAL AND COBL–BWKEY is INITIAL.
COBL–WERKS = bseg–bupla.
COBL–BWKEY = bseg–bupla.
LD_KOSTL LIKE COBL–KOSTL,
LD_AUFNR LIKE COBL–AUFNR,
LD_PRCTR LIKE COBL–PRCTR,
LD_PAOBJNR LIKE COBL–PAOBJNR.
CHECK COBK–VRGNG = ‘COIN’.
CHECK NOT COBL–HKONT IS INITIAL.
CALL FUNCTION ‘RK_KSTAR_READ’
DATUM = COBK–BUDAT
KOKRS = COBK–KOKRS
KSTAR = COBL–HKONT
V_CSKB = CSKBV
KSTAR_NOT_FOUND = 1.
CHECK SY–SUBRC = 0.
CALL FUNCTION ‘K_ACCOUNT_ASSIGNMENT_GET’
BUKRS = COBL–BUKRS
WERKS = COBL–WERKS
BWKEY = COBL–BWKEY
GSBER = COBL–GSBER
KSTAR = COBL–HKONT
I_COBL = COBL
KOSTL = LD_KOSTL
AUFNR = LD_AUFNR
PRCTR = LD_PRCTR
E_PAOBJNR = LD_PAOBJNR.
IF COBL–KOSTL IS INITIAL “*!
AND NOT LD_KOSTL IS INITIAL.
COBL–KOSTL = LD_KOSTL.
IF COBL–AUFNR IS INITIAL “*!
AND NOT LD_AUFNR IS INITIAL.
COBL–AUFNR = LD_AUFNR.
IF COBL–PRCTR IS INITIAL “*!
AND NOT LD_PRCTR IS INITIAL.
COBL–PRCTR = LD_PRCTR.
IF COBL–PAOBJNR IS INITIAL “*!
AND NOT LD_PAOBJNR IS INITIAL.
COBL–PAOBJNR = LD_PAOBJNR.
Assign Z program in to Client specific user exit GCX2
Please also refer Next related post Automatic account assignment OKB9 ( Set Acc. Assignment “3 Profite center is mandatory”)