Skip to Content
Author's profile photo Karthik Potharaju

Loading Cost Center Hierarchy (CCH) into SAP using BAPI & LSMW

Definition – groups of cost centers in a tree structure within a controlling area that represent specific areas of cost incurrence from a Controlling perspective.

A cost center hierarchy comprises all cost centers for a given period and therefore represents the whole enterprise. This hierarchy is known as the standard hierarchy.

Cost Center hierarchies are typically defined before creating cost centers.

Usually considered as configuration objects, high volume and complexity in nesting may call for automated load methods. Here’s one way of automating creation (load) of CCH into SAP.

Define Input/Load File Structure

Since CCH is defined at CO. Area level, a “header” line is used to create CCH per Co. Area. This way, the same process/files can be reused for loading standard and alternate hierarchies under same/different controlling areas.

Columns

Data type

Length

Column Description

LNIND

CHAR

1

Line indicator – Header/Line

VALU1

CHAR

15

Controlling Area/Group Name

VALU2

CHAR

10

Hierarchy Level

VALU3

CHAR

10

Value Count

VALU4

CHAR

40

Description

Sample Data

Header (Co. Area)
Line (Nodes)

Controlling Area
Group Name

  1. Hier. Level

Value #

Description

H

1000

L

C1000

0

0

IDES

L

C1010

1

0

Corporate

L

C1110

2

0

Executive Board

L

1234

3

0

test

L

4567

3

0

yress

L

C1120

1

0

Internal Services

L

98763

3

0

sdfdsfds

L

C1200

1

0

Administration & Financials

L

C1210

2

0

Administration

L

C1220

2

0

Human Resources

L

C1230

2

0

Procurement

LSMW:

  • LSMW method: BAPI – BAPI_COSTCENTERGROUP_CREATE
  • Business Object: BUS1112, Cost center group 
  • Method: CREATE                    
  • Message Type: COSTCENTERGROUP_CREATE    
  • Basic Type: COSTCENTERGROUP_CREATE01

CCH001.png

Structures/Fields to populate:

  • E1COSTCENTERGROUP_CREATE (Header segment)
    • CONTROLLINGAREAIMP

  Note: Populate the above field with controlling area value only for header records  

CCH002.png

  • E1BPSETHIET (Interface structure for groups – Hierarchy table)
    • GROUPNAME
    • HIERLEVEL
    • VALCOUNT
    • DESCRIPT

Note: Populate the above fields only for hierarchy lines

CCH003.png

Post-load review/reconciliation

  • Execute transaction KSH3
  • Input Top Node name & Display
  • Validate if all nodes have been created correctly

CCH004.png

CCH005.png

  – KP (Blogging Irregular)

Assigned Tags

      20 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Ravi Sankar Venna
      Ravi Sankar Venna

      Good Job.

      This is extremely useful in multi company code projects, where number of cost centers / profit centers does exist. This would dramatically reduce the work of the consultant. Otherwise, consulting those nodes would be nightmare for the consultant.

      Thanks for sharing.

      Best Regards,

      Ravi

      Author's profile photo Karthik Potharaju
      Karthik Potharaju
      Blog Post Author

      Thank you - many more related posts to come -KP

      Author's profile photo Former Member
      Former Member

      Hi Karthik,

      I could follow the steps mentioned by you above... However the following error is displayed 'Inconsistent set hierarchy '.

      Can you please help ?

      Regards,

      Siri.

      Author's profile photo Former Member
      Former Member

      that is really useful,  i created hierarchy by ksh1 before.

      now i know lsmw can do it to ,  so next time i can do it more fast.

      thanks for the dedication!

      Author's profile photo Former Member
      Former Member

      do you have a sample file for this ? i tried with the above format.... but not able to upload...

      Rgds,

      Siri.

      Author's profile photo Former Member
      Former Member

      does not work out giving error Document cannot be posted

      Author's profile photo Former Member
      Former Member

      Hello, and thank you for your sharing.

      I followed your procedure, but when I run the  Start IDoc Processing it gives me the error:

      Inconsistent set hierarchy.

      Message no. GS513

      Diagnosis

      An empty or defective hierarchy table was presented when trying to create a set hierarchy.

      System Response

      No set is changed or created.

      Procedure

      There is probably a program error when creating the set hierarchy.

      Can you hel me?

      Thanks in advance.

      Author's profile photo Former Member
      Former Member

      HI,

      Can we use the structure E1COSTCENTERGROUP_CREATE as it is in our LSMW project?

      Regards

      Author's profile photo Sabrina Villa
      Sabrina Villa

      Hello,

      Do you know how to make massive assignments of profit centers (already created in the system) into profit center groups? These groups are not in the standard hierarchy, and will be used only for reporting purpose. The transaction KE52 allows to assign a profit center into one or more groups (that are not in the standard hierarchy), but is one at a time.

      Regards,

      Author's profile photo Former Member
      Former Member

      Hi Karthik ,

      Its Nice document thank you for sharing

      Regards

      Sada Bandla

      Author's profile photo Erwin Leitner
      Erwin Leitner

      Hello,

      Great and so Excellent. 🙂 ➕

      Thank you very much.

      all the best Erwin

      Author's profile photo Saurabh Patni
      Saurabh Patni

      Hi Karthik,

      Thanks for the very useful article. It will certainly help me out.

      If possible, can you please share BAPI for AR, AP & GL Master Data also.

      Thanks in advance

      Author's profile photo Karthik Potharaju
      Karthik Potharaju
      Blog Post Author

      BAPI_ACC_DOCUMENT_POST can handle AR AP and GL entries.

      For GL/CoA GLMAST** can be used or even RFBISA00/0010 through LSMW.

      Author's profile photo Saurabh Patni
      Saurabh Patni

      Hi,

      Was asking about master data, will the same BAPI could be used.

      Regards

      Saurabh

      Author's profile photo Harnish Shah
      Harnish Shah

      Hi Karthik,

      I tried to upload the hierarchy through the method suggested by you but could not process the IDOC. Can you share the IDOC relevant screens?

      Thanks.

      Author's profile photo Former Member
      Former Member

      Hi M.Potharaju,

      Thank you for sharing your knowledge via this blog.  I tried to create the LSMW doing the same steps as you even using the same load file in my sandbox for testing prior using with real data and the idoc has created the first line but I got the same error as another one on this blog related to the inconsistent set hierarchy, message no GS513.  I didn't find an answer to solved this issue.  Can you please help?  Thank you, Cynthia

      Author's profile photo Former Member
      Former Member

      very good! thanks for information

      Author's profile photo Murphy Karen
      Murphy Karen

      I have used this method to create cost center groups with cost centers assigned.  When I go look a the group, the cost centers do no show their description but the message No valid master record.  All the cost centers in the group are valid.  Is there a way to get the cost center description to show up and not this message. 

      Author's profile photo abdelhalim mimouni
      abdelhalim mimouni

       

      hi,

      I did the same implementation but not able to modify a Cost Center group while it has nodes up and down, when it's not linked it's updated but not when having links.

       

      thanks

       

      Author's profile photo Thomas PETITPIERRE
      Thomas PETITPIERRE

      Hi,

      Thanks for this blog.

      Important points so it works:

      • In Define Source Structures ZITEM must be under ZHEADER
      • In Define Structure Relationships
        • E1COSTCENTERGROUP_CREATE must be linked to ZHEADER
        • EE1BPSET_HIER must be linked to ZITEM
      • In Specify Files:
        • File Contents: Data for multiple Source Structures (Seq File) must be choosen
      • In Assign Files: ZHEADER and ZITEM must have the same file assigned

       

      Regards,

      Thomas