• Home   /  
  • Archive by category "1"

Okb9 Default Account Assignment Template

Applies to:

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)

  1. Per company code
  2. Per Business area
  3. Per Profit Center
  4. 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

Example: Key-

“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

  1. Valuation Area is mandatory
  2. Business Area is mandatory
  3. 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.

Standard settings

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. 1. Determine in which controlling area you want to substitute values.
  2. 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
*       text

COBL–WERKS = bseg–bupla.
COBL–BWKEY  = bseg–bupla.




DATUM           = COBK–BUDAT
KOKRS           = COBK–KOKRS
KSTAR           = COBL–HKONT
V_CSKB          = CSKBV


IF  COBL–KOSTL IS INITIAL              “*!

IF  COBL–AUFNR IS INITIAL              “*!

IF  COBL–PRCTR IS INITIAL              “*!


ENDFORM.                                                    “UOKB9


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”)


This wiki provides a demonstration of how cost center, profit center and segment are derived for cash discount and realized exchange rate lines from the cleared (original) item.


According to note 1085921:

Case 2.2: Automatic split for clearing processes

For clearing lines, the account assignments are derived by referring to the original line items to be cleared. During the automatic splitting, only the cleared items of the original documents are considered in order derive the relevant account assignments for the clearing lines and to split the line accordingly if necessary. If a clearing line contains a different account assignment in the entry view (which normally should not happen in the standard) it will be overwritten by the account assignments from the cleared items. This logic is followed in order to make sure that the whole clearing process does balance to zero also on the account assignment level. The exception is the so called follow-up costs as realized exchange rate differences, cash discount lines and penalties which are split already in the entry view (not only in the entry view). The account assignments for the follow-up costs are also derived from the cleared items of the original documents analog to the clearing lines, but already in the entry view.

The reason for the different logic in this case is to ensure the integration with the CO. The g/l accounts for follow-up cost are normally relevant for Controlling and are defined as cost elements. Since CO is only integrated with the entry view (and not with g/l view) of the FI document, it is important that the relevant account assignments are derived already in the entry view and are transferred to Controlling. The option of whether the splitting characteristic fields are considered in splitting during this type of splitting is defined in view V_FAGL_SPLIT_FL2. Refer to section "Document Splitting in Realized Exchange Rate Differences" in the online documentation for more information.

According to note 1652002:

“You want to implement a CO account assignment or a customer field as a document splitting characteristic in the new general ledger.”

“In Customizing for the document splitting, there is a differentiation between "Document Splitting Characteristics For General Ledger Accounting" and "Document Splitting Characteristics for Controlling". These differences reflect two different functions of document splitting. However, the two functions follow the same model to ensure the account assignments are derived according to cause.”

“Follow-up costs include cash discount lines, exchange rate differences, penalty interest and other subsequent costs that carry an item reference to an original line item and arise from the operational processes or during closing operations. During processing of the subsequent processes, the original account assignments for the follow-up costs are read and already set when the FI document is created.”

“The CO document splitting characteristics replace the earlier function for adjusting the profit and loss statement. The function enables the original account assignment of the follow-up costs at the time of the posting of the follow-up process.”

In the scenario example presented; the document splitting is active; cost center, profit center and segment are split characteristics. During the clearing of vendor invoice a cash discount line (transaction key: SKE - cash discount received) is generated.

The same logic is also relevant for cash discount expenses (transaction key: SKT), lost cash discount (transaction key: VSK) and also for the realized exchange rate difference lines (transastion key: KDF).


In this example a vendor invoice was posted with cash discount and also with cost center, profit center and segment information. If you clear this vendor line the system will generate an additional line for cash discount received account.

4 cases are presented below to demonstrate how account assignments are derived for the cash discount line from the vendor invoice.

In this example the cash discount account is mantained as cost element account.

Important information

You can maintain your P&L account (cash discount account / realized exchange rate difference account) as cost element account in the account master data (TC: FS02)

You can also maintain the splitting characteristics to be relevant for subsequent processes in sm 30 --> view: V_FAGL_SPLIT_FL2 

In this example the cost center, profit center and segment information are stored for the vendor line in table FAGL_SPLINFO.

Comment: The open item stores profit center and segment information but the cost center information is not always available in table FAGL_SPLINFO. Please read the following wiki for more information:

No CO account assignment field stored in FAGL_SPLINFO table for some documents

In this example the following account assignments are maintained in the master data:

cost center   profit center  segment



In all 4 cases the logic illustrated for cash discount items would work analogously for realized exchange rate difference items.


case 1: NO default cost center has been assigned to cash discount account, in view V_FAGL_SPLIT_FL2 all account assignments have been assigned to cash discount:

At clearing cash discount line is generated. All account assignments have been derived from the original invoice (see vendor invoice in FAGL_SPLINFO above):

case 2: Default cost center (TDCOST2) has been assigned to cash discount account, in view V_FAGL_SPLIT_FL2 all account assignments have been assigned to cash discount:

(Remark: you may assign default cost center in several transactions like OKB9, OKC9 and also in the master data of the account (FS02) etc.)

At clearing cash discount line is generated. All account assignments have been derived from the original invoice, default cost center TDCOST2 has been overwritten via document splitting (cost center is marked in V_FAGL_SPLIT_FL2 for cash discount).

case 3: Default cost center (TDCOST2) has been assigned to cash discount account, in view V_FAGL_SPLIT_FL2 profit center and segment have been assigned to cash discount:

At clearing cash discount line is generated like here:

According to the settings in view V_FAGL_SPL_FL2 the system splits the cash discount into profit center TDPC1 and segment TDSEG1 based on account assignments in FAGL_SPLINFO table, without cost center.

Afterwards the cost center TDCOST2 is derived from master data of the cost element. Generally in line items with cost center it´s not possible to post to another profit center than the one specified in cost center master data.Therefore the profit center TDPC1  of the cash discount item is overwritten by TDPC2 – which is assigned to cost center TDCOST2 in the cost center master data.

Different from the assignment of the profit center to cost center master data, the assignment of a segment to profit center master data is just a default assignment which would be used only if no other segment was filled in the line item. According to note 686531 the segment from profit center master data has only the 4th, i.e. the lowest priority of the various options how a segment can be derived in a line item:

686531 - ERP: How is the characteristic SEGMENT derived?


The following priorities apply when you set the characteristic SEGMENT:
1. Segment set manually
2. Segment set by the system for balance sheet accounts with document splitting
3. BAdI (user exit or substitution)
4. From the master record of the profit center

case 4: Default cost center (TDCOST2) has been assigned to cash discount account, in view V_FAGL_SPLIT_FL2 only profit center has been assigned to cash discount:

At clearing cash discount line is generated. Cost center information is derived from default settings. Profit center information is derived from cost center master data – segment information is derived from profit center master data (4th priority of segment derivation as written in note 686531):

+1 case:

In the cases presented above (case 1-case 4) I explained how account assignments are derived if the the cost center, profit center and segment information are stored for the vendor line in table FAGL_SPLINFO.

The open item stores profit center and segment information, but not always the cost center in table FAGL_SPLINFO.

This is a common case for G/L account open items (for which no cash discount items, but realized exchange rate difference items might be created at clearing), but it may also occur for customer/vendor open items split based on items posted to an account not defined as a cost element.

For this case it’s recommended to specify default cost centers depending of profit centers for the cash discount lines or for the realized exchange rate difference items in OKB9.

And example is represented here:

KI 235 with document splitting 2 - default cost center

Related Content

Related Notes

SAP Note 1085921 : Document split

SAP Note 1652002:  CO account assignmts/customer fields as doc

SAP Note 686531:  ERP: How is the characteristic SEGMENT derived?

One thought on “Okb9 Default Account Assignment Template

Leave a comment

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *