cancel
Showing results for 
Search instead for 
Did you mean: 

Fox in Planning function

Former Member
0 Kudos

Greetings!!

I have a question on FOX I am sure some people in thsi network might help me here.

In The planning function (COPY) I have headcount information in the planning cube and basically this function copy into cost center planning. Employee salary distribution into various cost element/center per job code. We used to have one job code for Direct employee now HR has created more job codes for direct hire .I thought of adding more line with similar syntax just wondering if this is the correct way or do we have any better option..

Here is the code which I am using currently..

*******************************

{ 0AMOUNT, 0005012000,10, #, ZSACOST1 } = { 0AMOUNT, #,

#, 40001519, ZSAHDCT1 } + { ZOVERTME, #, #, 40001519,

ZSAHDCT1 }.

*************************************

Say Instead of job code 40001519 we have now 5 new job codes so I am thinking to add more lines with similar syntax..

Any input from Fox experts !!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If you think this can keep on changing later, it would be better to create a variable (multiple single value type) storing all the job codes and then looping on it in the FOX code - that way you would not have to change the code and transport it. You can create a 'default values' type variable but then you would have to change it to add/remove job codes and retransport; if you do not want that, you can maintain the job codes in some table and create an exit variable which will read the job codes so you can directly change the table data in production system and no need for any transporting.

For looping, you can use the FOREACH IN VARIABLE statement or a VARC, VARI construct. Search this forum if you need help with either of these and also look in SAP documentation.

Former Member
0 Kudos

Hello Mayank

Thanks.. If we repeat the code for other 3 jobcodes will that work? As this would be very simple straight forward solution. No this(change) is not something we expect quite often..

Thanks again

Former Member
0 Kudos

Hi,

Yes it will work. The code would be somewhat like below -

sum = 0.

foeach jobcode in variable jobcodeslist.

sum = sum + { 0AMOUNT, #, #, jobcode, ZSAHDCT1 }.

endfor.

{ 0AMOUNT, 0005012000,10, #, ZSACOST1 } = sum.

Former Member
0 Kudos

Many Thanks

I have written as below

******************************************

DATA VJOB TYPE 0JOB.

                                                  • NEW *************************

{ 0AMOUNT, 0005012000,10, #, ZSACOST1 } = { 0AMOUNT, #,

#, 40001519, ZSAHDCT1 } + { ZOVERTME, #, #, 40001519,

ZSAHDCT1 }.

{ 0AMOUNT, 0005012000,10, #, ZSACOST1 } = { 0AMOUNT, #,

#, 50000147, ZSAHDCT1 } + { ZOVERTME, #, #, 50000147,

ZSAHDCT1 }.

************************************************************

Do I need to add Sum function as well?

Former Member
0 Kudos

Many Thanks

I have written as below

******************************************

DATA VJOB TYPE 0JOB.

                                                  • NEW *************************

{ 0AMOUNT, 0005012000,10, #, ZSACOST1 } = { 0AMOUNT, #,

#, 40001519, ZSAHDCT1 } + { ZOVERTME, #, #, 40001519,

ZSAHDCT1 }.

{ 0AMOUNT, 0005012000,10, #, ZSACOST1 } = { 0AMOUNT, #,

#, 50000147, ZSAHDCT1 } + { ZOVERTME, #, #, 50000147,

ZSAHDCT1 }.

************************************************************

Do I need to add Sum function as well?

Former Member
0 Kudos

This does not look correct - where is the loop?

And the "sum" in the psedo-code in my earlier post was not a function - it would simply be a local fox variable of type number.

declare it like -

data sum type f.

Answers (0)