cancel
Showing results for 
Search instead for 
Did you mean: 

Display Cost Center Group Text

Former Member
0 Kudos

Hi..

I'm new to abap, and I am working for abap for hr module now. My question will be...

How can I display a cost center group text in report? Is there a text table for it?

I get the cost center value from table pa0001-kostl.

I find the function BAPI_COSTCENTERGROUP_GETLIST by searching this forum. But, the parameters I can get is only for controllingareamask from pa0001-kokrs.

any help would be grateful

thanks

Accepted Solutions (1)

Accepted Solutions (1)

andreas_mann3
Active Contributor
0 Kudos

Hi Yusuf,

BAPI_COSTCENTERGROUP_GETLIST works fine .

-> here's an example :

SELECT SINGLE kostl kokrs FROM pa0001 INTO: (kostl, kokrs)

WHERE pernr = '4711'.

*

select single khinr from csks into khinr

WHERE kokrs = kokrs

AND kostl = kostl

AND datbi GE sy-datum

AND datab LE sy-datum.

CALL FUNCTION 'BAPI_COSTCENTERGROUP_GETLIST'

EXPORTING

controllingareamask = kokrs

groupnamemask = khinr

TABLES

grouplist = it.

regards Andreas

Former Member
0 Kudos

All the above works fine... I have tested it....

thanks...

new question will be

How can I find out the top hirarchy of the cost center? example: cost center 1010256 has 101025 as costcenter group in csks table... and 101025 also has cost center group 1010...

how can I get 1010 if I only has info for 1010256?

here is the figure for example.

1010 --- 101025 --- 1010256
                |-- 1010257
     |-- 101041 --- 1010415

Message was edited by: Yusuf Bottie Gaos

Message was edited by: Yusuf Bottie Gaos

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Yusuf,

What input u specified for executing FM?

I think input values are wrong.

If you want company based on cost center...

You have to first find one node above cost center means department in your case. then pass KHINR value in FM G_SET_GET_ID_FROM_NAME as shortname which returns SETID of the node based on its KHINR value. pass this setid to FMs metioned in my earlier reply as SETNAME. U will surely get output.

Let me know the status after trying this.

Former Member
0 Kudos

hi Yusuf,

You can get top hierarchy by using two SAP function modules.

<u><b>G_SET_GET_SUPERSETS</b></u>

<i><b>G_SET_GET_ALL_SUPERSETS</b></i>

Using G_SET_GET_SUPERSETS function module you can get immediate parent node of the specified cost center group.

And if you want all parent nodes for specified cost center group then use G_SET_GET_ALL_SUPERSETS function module.

I hope this information will help you.

And then let me know the status of it.

Former Member
0 Kudos

Dear Andreas,

here is the figure of my question,

mycompany--Plant1--department1.1--division1.1.1
                                --division1.1.2
                 --department1.2
                 --department1.3
         --Plant2--department2.1
                 --department2.2
                 --department2.3

my company has two plants, each plant have departments, and each department has divisions which have their own cost center.

I want to know which plant the division belongs to by using it cost center. The cost center group of the division will be the cost center of department right?

please advise...

Dear Bhavik,

Thanks,.. but the FM is not return me anything.

Former Member
0 Kudos

Hello Yusuf,

I have been following this topic and your last post has been a bit confusing. The terminology is ambiguous. Got a few questions for oyu:

1. What do you mean by department here ? Are you, by any chance, talking about SAP Retail?

2. And what is this <i>division</i> ? Is that the same division as in Sales and Distribution ?

3. Where (I mean, in which table ) did you see this data ?

4. By <i>company</i>, don't you actually mean <i>company code</i>?

From your example above, it seems that one department belongs to only one department and one department belongs to only one plant, So what is the problem? Find the department for the divion and then the plant for that department.

Regards,

Anand Mandalika.

Former Member
0 Kudos

Dear Anand...

Sorry if my question a bit confusing...

anyway, I am working for SAP HR now,...

There is a need to display employee cost report based on cost center group which I can display in standard hirarchy, tcode: KSH3.

You may see in my question before as sample of this hirarchy.

with function "BAPI_COSTCENTERGROUP_GETDETAIL", I can get cost center under the group, the need is I want to know the cost center group based on the specific cost center I have.

example: I belong to IT Department in Plant #1. And in IT there is 3 cost center, Application, Network and Service Support. How can I know that the Application division is belongs to Plant #1 instead of Plant #2?

athavanraja
Active Contributor
0 Kudos

<b>CSKS-KHINR</b> would give you the <b>cost center group</b> (in stadard hierarchy) to which the cost center belongs to .

this (CSKS-KHINR) is just immediate parent. If you want all the parents use the function G_SET_GET_ALL_SUPERSETS

and the import parameter <b>SETNAME</b> for this function is

setclass + controlling area + csks-khinr .

Hoep this helps.

Regards

Raja

Former Member
0 Kudos

Hi All,...

Sorry for this confusing discussion I finally realize that the answer from andreas is the one that solved my problems

thanks again.

andreas_mann3
Active Contributor
0 Kudos

Hi Yusuf,

i'll guess you mean the standard hierarchy for the controlling aerea (1 Kokrs : 1 KHINR ).

-> so when you've the controlling aera (pa0001-kokrs):

select single KHINR from <b>TKA01</b> into top_hirarchy

where kokrs = pa0001-kokrs.

regards Andreas

athavanraja
Active Contributor
0 Kudos

<b>cost center group</b> text is in <b>SETHEADERT</b>

for Cost center Group setclass = '0101'

subclass = <your controlling area>

Regards

Raja

Former Member
0 Kudos

Hi...

Welcome to group...

What i understood is u require text for that particular cost center....

Use table <u><i><b>CSKS</b></i></u> field name <u><i><b>KTEXT</b></i></u>.

If this help u out give me points. I hope u know the system.

Regards,

Sagar