cancel
Showing results for 
Search instead for 
Did you mean: 

Copying Key Figure

cote_adams
Participant
0 Kudos

I have created an agg. level on a plan cube to input Planned Hours at a cost center level (Employee Excluded from Agg Level).

I then want to assign these planned hours to EVERY employee within that cost center. I currently have Master Cost Center as an attribute of 0EMPLOYEE, and I have created a characteristic relationship on 0EMPLOYEE to Cost Center. I am trying to use a copy function on a new Agg. level that includes employee, but have not been successful.

I am able to successfully perform the copy function if I specify exactly which employee I want to copy to, but how can I copy this key figure to ALL employees within this cost center?

Ex: Cube contains the following:

Cost Center Plan Hour

0000006405 155

I want top copy the value 155 to ALL empoyees who are contained within the employee attribute cost center 6405.

Emp: Emp_CC Cost Center Plan Hour

123 6405 6405 155

145 6405 6405 155

156 6405 6405 155

In the copy function, I am using # (not assigned) as the from value. This works if I input a specific employee as the to value. I have attempted to use ># as the "to" value in the copy function, and that produces the error "cannot generate combinations in step 00."

Accepted Solutions (1)

Accepted Solutions (1)

former_member5472
Active Contributor
0 Kudos

Hi,

Sinc there is no data for EMP initially in CUBE you cannot do a FOR EACH loop on EMP;

Alternate approach will be to read the value of EMP based on your CC ( which you know ) and then do a loop over it;

I hope it will help you proceed further.

Thanks

Pratyush

cote_adams
Participant
0 Kudos

Pratyush,

That's exactly what I need clarifiaction on. I want to be able to read 0EMPLOYEE based on Cost Center. Is it possible to do this within Fox?

Deepti,

Repost is the same thing as Copy, other than than it offsets the prior amounts, which I'm not wanting to do. I tried using a Copy function with a characteristic relationship, but the characteristic relationship is not working. This will fail due to the invalid combinations without passing the permissible combinations. The BLOCKs will show the correct changes, but since there is a single invalid combination in each block, it will not pass the valid combinations (Line 150 of class CL_RSPLFC_COPY, method IF_RSPLFA_SRVTYPE_IMP_EXEC_REF~EXECUTE). It would work if I altered this method, but it is bad practice to edit delivered SAP code.

Thanks.

cote_adams
Participant
0 Kudos

Is this possible through fox?

I'd like to perform a FOREACH loop on CostCenter, and within the foreach loop, call a function module to select all the employees who belong to that cost center, and then return all those employees to FOX to copy the key figures.

Is it possible to return a List/table of employees to FOX?

Former Member
0 Kudos

Hi,

When you use function moduels in FOX the function module parameters must be of simple types (F, I, D, STRING, and characteristic and attribute types). Class references, structures, and table parameters are not permitted.

Hence, you can't return a list of Employees from function module in your FOX.

Regards,

Deepti

Answers (2)

Answers (2)

former_member5472
Active Contributor
0 Kudos

Hi,

Why not using FOX codes for it ;

so if CC is an attribute of EMP u can derive the value of CC

The algorithm may go like this

for each EMP;

CHA_CC = ATRV ( EMP).

( EMP, CHA_CC, HRS) = ( # , CC , HRS).

endfor.

Thanks

Pratyush

cote_adams
Participant
0 Kudos

Definitely on the right track. Can you please be more specific?

THe FOREACH loop is not returning any values for employee. In debug, it looksl ike this is trying to loop all entries of 0EMPLOYEE that already exist in the cube. Initially there won't be any employees in the cube. I am wanting to read the MD table of 0EMPLOYEE.

Here is what I have so far:

DATA ZEMP TYPE 0EMPLOYEE.

DATA CC TYPE 0MAST_CCTR. <= This is the CC in the cube

DATA EMP_CC TYPE 0MAST_CCTR. <= This is the 0EMPLOYEE attribute Cost Center

BREAK-POINT.

CC = OBJV().

FOREACH ZEMP. <= This foreach has no entries

EMP_CC = ATRV (0MAST_CCTR, ZEMP). <= Therefore this EMP_CC is blank

IF EMP_CC = CC.

{WCCMTRGD, ZEMP} = {WCCMTRGD, #}.

{WPLGLPRC, ZEMP} = {WPLGLPRC, #}.

ENDIF.

ENDFOR.

Any additional info would be greatly appreciates.

Thanks!

Former Member
0 Kudos

Hi,

Just a suggestion, if you can try using function 'Repost (Characteristic Relationship)'. You can create a characteristic relationship of type Attribute betwwen CostCenter and Employee with a check on 'Excl #' while creating the char relationship.

In Repost in characteristic usage, you can specify 'Employee' to be corrected.

Note that the aggregation level for this function should be based directly on the RTP.

You can just give it a try and see if it works.

Regards,

Deepti

cote_adams
Participant
0 Kudos

I've decided to preload the cube with ALL Employees to be planned.

I am going to use a FOX formula to copy the key figures.

The issue is, the FOREACH loop on ZEMP is not returning any employees if the Key Figures = 0 for the employees.

In DEBUG, the LOOP AT LT_CUR_0001 has 1 entry = 00000000.

Only if I manually enter a KF for the employees will they show up in the FOREACH loop.

How can I get this FOREACH to work even though the EMPLOYEE KFs = 0? Is this possible, or do I need to work around forcing values to these employees prior to the FOX formula/FOREACH loop?

Edited by: Cote Adams on Dec 18, 2008 11:55 PM

Former Member
0 Kudos

Hi,

To simulate the requirement as specified, in the copy function, we have to explicitly specify all the employees. It can't get the values of the employees by itself.

However, this scenario can be achieved with the use of exit function modules. The function module should get all the employees for a particular cost center from the master data table and copy the key figure to these employees.

Please award points if helpful.

cote_adams
Participant
0 Kudos

So do you mean to use an Exit Function module to perform the entire copy function, or do you mean to use an exit variable on 0EMPLOYEE to be used within the copy function?

If I was to create a function module, any advice on how to go about this? I have never copied data within an InfoCube.

Any template function modules i could use as a reference?

Also, just to clarify, we will be copying data from over 100 cost centers to many employees within each cost center.

Thanks!