Skip to Content
Author's profile photo RAHEEM BAKSH

Automatic account assignment OKB9 does not work

A1.jpg

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

Summary

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)

“OFF” (GTA)

“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

A2.jpg

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

A3.jpg

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.

Activities

  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

A4.jpg

Substitution-

Prerequisite – Company code =1000 and Controlling area =1000

If Prerequisite is met substitute by User exit UOKB0

A5.jpg

Check Client specific user exit GCX2         

Transaction code: GCX2

Here you need to check assigned program for the Application Area GBLS.

A6.jpg

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.

A7.jpg

A8.jpg

Change in Z Program as below-

A9.jpg

A10.jpg

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
*———————————————————————————————————————————————————————————–*
FORM UOKB9 .

if COBLWERKS is INITIAL AND COBLBWKEY is INITIAL.
COBL
WERKS = bsegbupla.
COBL
BWKEY  = bsegbupla.
ENDIF.

DATA:
LD_KOSTL
LIKE COBLKOSTL,
LD_AUFNR
LIKE COBLAUFNR,
LD_PRCTR
LIKE COBLPRCTR,
LD_PAOBJNR
LIKE COBLPAOBJNR.

CHECK COBKVRGNG = ‘COIN’.

CHECK NOT COBLHKONT IS INITIAL.

CALL FUNCTION ‘RK_KSTAR_READ’
EXPORTING
DATUM          
= COBKBUDAT
KOKRS          
= COBKKOKRS
KSTAR          
= COBLHKONT
IMPORTING
V_CSKB         
= CSKBV
EXCEPTIONS
KSTAR_NOT_FOUND
= 1.
CHECK SYSUBRC = 0.

CALL FUNCTION ‘K_ACCOUNT_ASSIGNMENT_GET’
EXPORTING
BUKRS    
= COBLBUKRS
WERKS    
= COBLWERKS
BWKEY    
= COBLBWKEY
GSBER    
= COBLGSBER
KSTAR    
= COBLHKONT
I_COBL   
= COBL
IMPORTING
KOSTL    
= LD_KOSTL
AUFNR    
= LD_AUFNR
PRCTR    
= LD_PRCTR
E_PAOBJNR
= LD_PAOBJNR.

IF  COBLKOSTL IS INITIAL              “*!
AND NOT LD_KOSTL IS INITIAL.
COBL
KOSTL = LD_KOSTL.
ENDIF.

IF  COBLAUFNR IS INITIAL              “*!
AND NOT LD_AUFNR IS INITIAL.
COBL
AUFNR = LD_AUFNR.
ENDIF.

IF  COBLPRCTR IS INITIAL              “*!
AND NOT LD_PRCTR IS INITIAL.
COBL
PRCTR = LD_PRCTR.
ENDIF.

IF  COBLPAOBJNR IS INITIAL            “*!
AND NOT LD_PAOBJNR IS INITIAL.
COBL
PAOBJNR = LD_PAOBJNR.
ENDIF.

ENDFORM.                                                    “UOKB9

*&—————————————————————————-*

Assign Z program in to Client specific user exit GCX2

A11.jpg



Please also refer Next related post Automatic account assignment OKB9 ( Set Acc. Assignment “3 Profite center is mandatory”)

Assigned Tags

      35 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Godavari SAP
      Godavari SAP

      Hello Raheem,

      Good article.

      Thanks

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Thanks Dear ...........

      Author's profile photo Former Member
      Former Member

      Dear Raheem,

      Very good article. Good work !!!!

      Thanks,

      Srini

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Dear Srinivasa,

      Thanks!!!!!

      Rate the article if u like it

      Regards

      Raheem

      Author's profile photo Jason Shao
      Jason Shao

      this is very useful

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Dear Jason,

      Thanks!!!!!

      Author's profile photo Sean Xiao
      Sean Xiao

      detailed and systematic, great work!

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Thanks Sean Xiao      

      Regards

      Raheem

      Author's profile photo Former Member
      Former Member

      Good Job Raheem

      Sachin j

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Thanks sachin,

      Author's profile photo Former Member
      Former Member

      Very Informative...Many Thanks.

      Best Regards,

      Naresh K.

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Thanks Naresh,

      Author's profile photo Former Member
      Former Member

      Really  Good work Yaar!!

      .Many Thanks.

      Best Regards,

      Niran.OK.

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Thanks Niran

      Author's profile photo Former Member
      Former Member

      Hello Raheem,

      Very useful and informative article.

      Thnx 4 ur fabulous article.

      Regards,

      Satendra

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Thanks Satendra

      Author's profile photo Former Member
      Former Member

      Hi Raheem

      Its very good and useful info... 🙂

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Thanks

      Author's profile photo Lakshmi Sama
      Lakshmi Sama

      Hello Raheem,

      Its a very good article. Thanks for sharing your knowledge and keep sharing.

      Regards,

      Lakshmi S

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Thanks Lakshmi,

      Author's profile photo Former Member
      Former Member

      Good one.....

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Thanks

      Author's profile photo Pavan Kumar Arvapally
      Pavan Kumar Arvapally

      Hi Ramesh,

      Nice document.....

      Regards,

      Pavan Kumar Arvapally

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Thanks Pavan,

      Its Raheem 😎

      Regards

      Raheem

      Author's profile photo Akash Dhakulkar
      Akash Dhakulkar

      Hi, Raheem Bhai

      Thanks for the Documentation provided by you, My requirement is to update the Center Field & I have done with every thing  , But I have an issue in the code while substituting the values of BSEG in COBL..... the BSEG is not Returning values of WERKS & BWKEY..... Its empty while cheking in debugging

      Can u help with this??

      *&      Form  UOKB9
      *&---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*
      *       text
      *-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*
      FORM UOKB9 .

      if COBL-WERKS is INITIAL AND COBL-BWKEY is INITIAL.
      COBL
      -WERKS = bseg-bupla.       """""""""""" over here
      COBL
      -BWKEY  = bseg-bupla.     """""""" over here
      ENDIF.

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Hi Akash,

      if COBL-WERKS is INITIAL AND COBL-BWKEY is INITIAL.
      COBL
      -WERKS = xxxxxx      """""""""""" {identify the value on particular line item (where object is missing ) that can be used to identify the Valuation area. In case nothing is matching with valuation area / Business area / Profit center keep Valuation area in memory id from first line item and import that ID here
      COBL
      -BWKEY = xxxxxxx     """""""" Same as above

      Author's profile photo Akash Dhakulkar
      Akash Dhakulkar

      Nice Blog Shared Bro.... Really Descriptive & Helpful 🙂

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH
      Blog Post Author

      Thanks

      Author's profile photo Former Member
      Former Member

      hi Raheem

      good article nice one .........keep it up

      Regards

      Raj

      Author's profile photo TACO TTL USER
      TACO TTL USER

      Hi Raheem,

       

      How to make the Business Area Mandatory for Tax line item posted through MRKO transaction?

       

      Regards,

      Hari

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH

      Hi Hari,

      If Document splitting activated at business area level, All the financial traction will be mandatory to post with Business area.

      In case document splitting is not activated at business area level you can write validation for financial posting, whenever any integrated posting will hit to financial transaction validation will validate it.

       

      Regards

      Raheem

       

      Author's profile photo Pratik Kodiya
      Pratik Kodiya

      Dear Raheembhai,

       

      it really very useful, Thank you so much for this article.

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH

      Thanks Pratik.

      Author's profile photo Fernando Simovic
      Fernando Simovic

      Excellent,

      I have a doubt I need to change a cost element in substitution.

      I did it in GGB0 and in GGB1 in FI works fine but in CO doesn t work.

      What would I have to check? Thanks so much

      Author's profile photo RAHEEM BAKSH
      RAHEEM BAKSH

      Hi , Hi ,

       

      Cost element can be substituted in the FI directly. Cost elements in CO are closely related to the general ledger accounts used in Financial Accounting, hence cost element can be substituted in source only.

       

      Regards

      Raheem Baksh