Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Finding a source table for structure field RKPLN-KSGRU in tcode KSB1

Former Member
0 Kudos
1,223

One of our business requesters recently send me a new ABAP report he wanted designed that goes after cost center data. Once of the things he wants to do is to have the selection option of cost center group as seen in tcode KSB1 selection screen. When I go into this screen I can see the field but it is in a structure and I cannot find the table where the data is stored.

Things I have tried:

1. Gone to the structure RKPLN and then on to the field. From there I did a where used but get only 4 matches, none of which contain the data I am looking for.

2. ST05 trace when doing F4 for selection drop down. This brings back different tables in the trace but none of them contain the cost center group to cost center linkage.

3. Manually traced through the code in debug mode. This is just taking far too long.

Is there any other way to find the fields behind the structure?

3 REPLIES 3

Former Member
0 Kudos
267

Cost Centre groups are stored as sets in SAP. Take a look at program RGSEX001 for example code on how to read set values.

To provide the select option you can define it as SELECT-OPTIONS S_CCG FOR RKPLN-KSGRU. you may need to add a matchcode object / search help to give F4 functionality, or possibly add AT SELECTION-SCREEN ON VALUE REQUEST FOR S_CCG-LOW and ...FOR S_CCG-HIGH statements to call a function module to display F4 lists. Take a look at the source code of standard SAP reports (rather than dialog transactions) where Cost Centre group is used with F4 help to get options for this.

Andrew

Former Member
0 Kudos
267

Hi

Check the tables

<b>SETNODE and SETLEAF</b> where the Cost center groups/profit center/cost element groups are stored

to retrive all the cc/pc/ce's related to a group you have to use these tables recursively in select statements

you can also use a fun module G_SET_TREE_IMPORT

to find all these cc/ce/pc etc

<b>Reward points for useful Answers</b>

Regards

Anji

Former Member
0 Kudos
267

Hi Larry,

all kinds of sets of CO and report painter are stored in the tables

SETHEADER, SETLEAF, SETNODE.

The sets have different types, right now I'm not having system acces, so

it could be different,

0101 Costelemnt gorups

0102 Costcenter groups

0104 Statistical key figure groups.

The names of the sets on the tables contain three parts:

- the key number of the type of set e.g. '0102'

- the key of the controlling area e.g. 'CO01'

- the name of the group e.g. 2007_ALL_COSTC

so the group would be '0102CO012007_ALL_COSTC' on the tables.

Check the fnction modules 'G_SET_ENCRYPT_SETID' -> that builds the name

for you and 'G_SET_DECRYPT_SETID' -> that splits the name.

In the documentation you will find the correct keys for the different types of

sets.

To read the tables you use the function Module starting with G_SET_*.

E.g. use G_SET_GET_ALL_VALUES to resolve the set into its values.

G_SET_GET_NEXT, G_SET_GET_SUPERSETS etc. for every use there's

the correct function module, you never have to read the tables with select statement on your own.

If you need to find groups on F4 value request, call the function module

K_GROUP_SELECT. This will bring a dialogue where you can search

the different types of sets, depends if you provided the FM with the keys

like '0101' or '0104'.

<b>Reward if useful</b>

Kind Regards

Henner