cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent : Difference of two fiscal period

Former Member
0 Kudos

Hi,

For one of the reporting requirement I have to calculate the difference between two fiscal period's, which i am able to do using the replacement path variable and working fine for two different months of same period.

For eg ; if i calculate difference between these two values of fiscal period (Variant V9)

period1 = 3.2008 (Dec 2008)

Period2 = 6.2008 (March 2008)

Then result is fine i.e 3

But if i calculate the difference between these two periods :

Period1 = 12.2007

Period2 = 1.2008

Im getting result = 989..........!! In such case my expected result is 1.

Can anyone suggest me what can i do regarding to this calculation or how can i get this, Its very urgent issue.

Thanks & Regards,

Dipika

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Dipika!

This was one of the situation that troubled me alot!

However, my requirment was a bit different.

I have to calculate 1,2,3.... till 22 periods backwards for a given fiscal period (FP).

I used a customer exit variable.

Say you have to calculate10 fiscal Periods backwards for a given Fiscal period

Ex:0102008 is the input FP. For this 10 FP backwards would be 0122007.Then logic would be.

get the fiscal period to local variable.

divide year and period to two seperate variables.

Then assume L_PER holds Period and L_YER holds Year Value.(Variables)

IF L_PER LE 10

L_PER=L_PER2. { 102 => 12}

L_YER=L_YER-1. {2008-1 ==>2007}

ELSE.

L_PER= L_PER-10.

ENDIF.

This gives you Period number and year number which is 10 periods before, for any given Fiscal Period.

Similarly, you can reverse engineer this and add some code so that

it satisfies your requirement.

It proceeds like this.

Divide to Period and Year, both given input periods.Now,

Check the difference between years

if Zero, calculate difference between two FPs and return absolute value of it.

if not zero, ... may be you will need CASE statement for each difference value for periods.

we can work on this part and will let you know soon if i am done with it.

Cheers,

Sri

Former Member
0 Kudos

Hi!

I assume the below code I tried out should work.

Here are the Steps.

Take two input Fiscal Periods.

Divide the two periods to Period and Year.

Compare the Years first.

If both are equal, find the ABS(Diff of two Periods)

If Year1 is Less than Year2,

Check the Periods.

If Period1 is Less than Equal Period2,

No of periods is 12*Diff(Years)+Diff(Periods)

else

No of periods is 12*Diff(Years)-Diff(Periods)

If Year1 is Greater than Year2,

Check Periods.

If Period1 is Less than Equal Period2

No of periods is 12*Diff(Years)-Diff(Periods)

else

No of periods is 12*Diff(Years)+Diff(Periods)

This should work

The code is.

L_PER1 HOLDS period of FP1

L_YER1 HOLDS Year of FP1

Similarly, L_PER2 and L_YER2

L_DPR = ABS(L_PER1 - L_PER2)

L_DYR = ABS(L_YER1 - L_YER2)*12 (missed out *12 earlier)

IF L_YER1 EQ L_YER2.

L_NPR = L_DYR+L_DPR.

ELSEIF L_YER1 < L_YER2.

IF L_PER1 LE L_PER2.

L_NPR = L_DYR + L_DPR.

ELSE.

L_NPR = L_DYR - L_DPR.

ENDIF.

ELSE.

IF L_PER1 LE L_PER2.

L_NPR = L_DYR - L_DPR.

ELSE.

L_NPR = L_DYR + L_DPR.

ENDIF.

ENDIF.

I am confident this works. Let me know if I am wrong somewhere.

Cheers,

Sri

Edited by: Sri on Feb 29, 2008 10:32 PM

Answers (1)

Answers (1)

Former Member
0 Kudos

Try using, the operator process as date

Regds,

Shashank

Former Member
0 Kudos

Where this operator is available ??