Skip to Content

Modifying Cost Element Hierarchies

There could be need to modify a huge number of cost element hierarchies at times or sometimes we might need to transfer them from one system to another. This blog gives a small tip on how to do the same.

Cost elements in SAP are basically stored as sets in SAP with Set Class 0102 and organizational unit as the CoA (chart of accounts). For example we can see a sample cost element structure below:

image

And now if we go to GS03:

image

image

Within Range_2

image

This can also be seen within the table SETLEAF

image

(There is no cost element data in TEST)

image

Transferring without any modifications

Cost element hierarchies can be exported as well as imported. This can be seen within the transaction itself.

image

Through this method it is possible to export the cost element hierarchy from the host system to recipient system.

In this case it is possible to download only individually. For doing it in large numbers we would need to use the ABAP programs behind the same. These ABAP programs are the same programs which are used to upload and download sets.

Download: RGSSTE00

image

The flat file for the Cost Element Hierarchy “TEST” is shown below.

image

Upload: RGSSTI00

image

But this doesn’t work when some modifications needs to be done. For example the CoA is being modified, so the new cost element hierarchy needs to reflect the same.

Transferring with modifications

Unfortunately SAP doesn’t provide any help with the Flat File structure. Below I try briefly to explain the structure and how I have managed to convert the existing sets.

The first line:

image

This is a general header line and starts at the left most end. SAP doesn’t interpret this line when the upload program runs. This need not be changed.

The second line:

 

image

The second line also starts at the left most end. This starts with HSTSO which is followed by three space and then 0102. 0102 signifies cost element hierarchy. XCOA refers to the CoA and Range_1 refers to the Cost Element hierarchy.

The Third line:

image

This begins with a space and STSHD. This is the headerline for the cost element hierarchy and contains the user who has created it (XXXXXXXX in this case). The text immediately following STSHD should correspond to the same above in the HSTSO line.

The Fourth Line:

image

This starts with STSBS. Immediately following STSBS; is the from in the hierarchy and the next is the to as can be seen in the SETLEAF table.

The third column is a 15 digit number which specifies a counter and this has to be unique within a hierarchy. And the maximum value of this is 000000099900000.

It is these three rows that require changes at times. In my base I have used an excel formula to recalculate the counter and for the other two I had used a mapping table.

The Fifth Line:

This starts with T800Y and this is followed by the language key (E for English here). And immediately afterward is the decryption.

The sixth Line:

E, this is the indicator to show that the substructure has ended here.

The last Line:

X, indicates that the whole structure is over

It is generally better to have the sub hierarchies listed above the main hierarchy. This way you can ensure that the sub hierarchies are there before the main hierarchy is created.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply