cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in fetching the data from previous month

Former Member
0 Kudos

Hi,

I am facing one problem in integrated planning,scenario is given below:

Real time cube structure:

Basin Subfamily Month Week KF1 KF2

B1 SF1 200801 # 1000 2000

B1 SF1 200802 # 3000 4000

B1 SF1 200803 # 5000 6000

B1 SF1 200804 # 7000 8000

B1 SF1 200805 # 9000 10000

I have a variable on month of multi-type, function should distribute the value for those month only. Value which need to be distributed is derive by below method..

I have to distribute the month value

[( KF1 - KF2 ) of 200802 + KF2 of 200801] into the week

Eg: 3000-4000+2000 =1000

I have to distribute the result value....

But i cannot find any method to derive above equation

How to do this in planning function?

Edited by: DEEPAK SINGH on Sep 10, 2008 10:21 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Deepak,

You can do this with the help of foreach in FOX.

As per my understanding you want to distribute the value of entered month,(in your example 200802) with respect to the above period(( KF1 - KF2 ) of 200802 + KF2 of 200801 ).

If it is so you can do it with two foeeach loop.

data kf1 type f.

data kf2 type f.

data kf3 type f.

data kf4 type f.

can use VARV to read the value of a month.

foreach month.

if month same as varv.

kf1 = {KF1, Month}.

kf2 = {KF2, Month}.

foreach month1.

if month1<month.

kf3 = {kf2,month1}.

endif.

endfor.

kyf4 = (( KF1 - KF2 ) + KF3 ).

endfor.

You can also use TMVL() function.

Hope it will be helpful for you.

Rgds,

Indu

Former Member
0 Kudos

Hi Indu,

Thank you for your quick response.

We have already tried with FOREACH on the month variable (user entry of multi -type) but it's not working. When we make the month variable as single value type,then FOREACH was working (although FOREACH will work on only the month which user has entered).

Waiting for your reply.

Thanks a lot.

Deepak

Former Member
0 Kudos

Instead of using foreach, try to use DO statement.

As the variable is of type multi-valued,

read its values using VARI.

DATA n TYPE I.

DATA prevmonth TYPE month object.

count = VARC(variable).

Do

n = TMVL(n,1).

IF n > count.

EXIT.

ENDIF.

month = VARI(variable,n).

prevmonth = TMVL(month, -1).

<Do all the manipulations for distribution>

ENDDO.

Try if this is feasible for your requirement.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Deepak,

Just want to clarify is it value range variable for month or multiple values.In both the cases you can pass values to planning function and use it in foreach.

If it is value range use varc,vari,and varv or with multiple values Please refer to [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0881371-78a1-2910-f0b8-af3e184929be]

.

You can also use TMVL() with negative offset.

Rgds,

Indu