cancel
Showing results for 
Search instead for 
Did you mean: 

tmvl question

Former Member
0 Kudos

Hi all

for any ABAPers out there, do we have any similar concept of internal tables, temp variables in BPC? where do we store temp values which could be used for further calculation. i have real trouble finding this information. we are on bpc-nw 10. any tips/suggestions are greatly appreciated.

i have a scenarios where i need to account b = account a - accountb(from prior period)

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Hi scr,

I do not understand why you need any temp variables. The code will be:

//For the records of [A] in current period

*XDIM_MEMBERSET TIME=%TIME_SET% // %TIME_SET% will contain current period

*XDIM_MEMBERSET ACCOUNT=A

*WHEN ACCOUNT

*IS *

*REC(EXPRESSION=%VALUE%-([TIME].[TMVL(-1,%TIME_SET%)],[ACCOUNT].[B]),ACCOUNT=B)

*ENDWHEN

//For the records in [B] in previous period

*XDIM_MEMBERSET TIME=TMVL(-1,%TIME_SET%) // %TIME_SET% will contain current period

*XDIM_MEMBERSET ACCOUNT=B

*WHEN ACCOUNT

*IS *

*REC(EXPRESSION=([TIME].[%TIME_SET%],[ACCOUNT].[A])-%VALUE%,TIME=%TIME_SET%)

*ENDWHEN

2 loops are required in the case when some records are missing.

You can also enforce All member loop with *WHEN_REF_DATA = MASTER_DATA and use only one loop.

B.R. Vadim

Correction: This code was written in the assumption that the formula is: B(curPeriod)=A(curPeriod)-B(prevPeriod)!

Message was edited by: Vadim Kalinin - Correction added

Former Member
0 Kudos

Hi Vadim, Thank you for your feedback. as explained my response to nilanjan before, i couldnt validate why my code wasnt working and so, i wanted to check parts of code in temp variables to test and the only way i could check was using commit to a temp variable.

Answers (1)

Answers (1)

0 Kudos

Hi scr,

Which version of BPC you are using? NW or MS? The TMVL option is available in NW version only. As far as your requirement is concerned it can be resolved by writing script logics.

Former Member
0 Kudos

hi harikrishnan,

yes, as i mentioned we are on NW10. sorry if i wasnt clear. my question is about script logic. i was trying to achieve account b = account a - accountb(from prior period) by script logic. Since I couldnt figure out how to write to a temp variable, i was commting to a temp account and reading the value for prior period via the when statement. how do we write to temp variables in script logic.

eg., account b( for feb 2012) = accounta(jan 2012) - account b ( jan 2012).

any suggestions?

Regards

0 Kudos

Hi Scr

sorry I was overlooked your question.

You can save intermediate result and assign them to dummy members like dummy account members or any other dimension.

Dummy members must be identified with a leading pound (#) sign.

These are temporary members and these temporary records will be automatically skipped during the commit time. Refer the below example:

   *WHEN ACCOUNT.FLAG

          *IS = Y

             *REC(ACCOUNT=#TEMP_ACC)

      *ENDWHEN

      *GO 

      *WHEN ACCOUNT

          *IS #TEMP_ACC

             *REC(FACTOR=GET(ACCOUNT=MULTIPLIER),ACCOUNT=FINAL)

      *ENDWHEN

Hope this helps you to resolve the issue

former_member186338
Active Contributor
0 Kudos

Hi Harikrishnan,

The code you provided is applicable to BPC MS version (I see GET inside).... Not for NW.

Vadim

Former Member
0 Kudos

Hi Hari,

The script you have mentioned is for MS platform, and will not work in the NW platform. NW platform doesnt support GO / GET keywords.

As per your example of account b (feb 2012) = account a (jan 2012) - account b (jan 2012), the script that can be used is:

*XDIM_MEMBERSET TIME = TMVL(-1, %TIME_SET%)

*XDIM_ACCOUNT = A

*WHEN ACCOUNT

*IS *

   *REC(EXPRESSION=(%VALUE%) - ([ACCOUNT].[B], [TIME].[TMVL(-1,%TIME_SET%)], ACCOUNT = B, TIME = %TIME_SET%)

*ENDWHEN

Hope this helps.

former_member186338
Active Contributor
0 Kudos

Hi Nilanjan,

You script will not create a proper record because you scope A in prev period, but the requirement is to have A from current period.

Vadim

Former Member
0 Kudos

Hi Vadim,

The example that was given by CSR in his 2nd post was:

account b( for feb 2012) = accounta(jan 2012) - account b ( jan 2012).

That's the reason, I have encoded it in that way.

former_member186338
Active Contributor
0 Kudos

Ups, yes, you are right . I was looking on the original post. Then the script have to be like:

*XDIM_MEMBERSET TIME = TMVL(-1, %TIME_SET%)

//For recods in prev period of account A (also if rec for B is missing)

*XDIM_MEMBERSET ACCOUNT = A // syntax correction

*WHEN ACCOUNT

*IS *

   *REC(EXPRESSION=%VALUE% - [ACCOUNT].[B], ACCOUNT = B, TIME = %TIME_SET%) // Tuple is not nesessary

*ENDWHEN

//For recods in prev period of account B (also if rec for A is missing)

*XDIM_MEMBERSET ACCOUNT = B

*WHEN ACCOUNT

*IS *

   *REC(EXPRESSION=[ACCOUNT].[A] - %VALUE%, TIME = %TIME_SET%)

*ENDWHEN

*WHEN_REF_DATA = MASTER_DATA can also be used to have only one loop, but performance may suffer.

B.R. Vadim

Former Member
0 Kudos

Hi Nilanjan

Thank you for the response. i dont know what i am missing, I had the same code, i dont know if the issue with the way i scoped my data, but i retried with exact same code you provided and when i validated by each profit center, i noticed that when i dont have entries in period1, my subtraction doesnt work.

for example, from below for 2012.nov, if a particular entry for a profit center doesnt exist, but the same profit center has entry in 2012.oct for $100, my Rec statement doesnt calculate a 0-100 as -100 whcih is what i was expecting. any ideas what else need to be added to scope to make it work?

//*XDIM_MEMBERSET TIME = TMVL(-1, 2012.NOV)

XDIM_MEMBERSET TIME = 2012.NOV, 2012.OCT

*XDIM_MEMBERSET V_ACCOUNT = account_a

*XDIM_MEMBERSET ENTITY = 1234

*WHEN ACCOUNT

*IS 2012.nov

*REC(EXPRESSION=(%VALUE%) - ([TIME].[TMVL(-1,2012.NOV)],[ACCOUNT].[account_a]), V_ACCOUNT = account_b, AUDITTRAIL= Other)

*ENDWHEN

former_member186338
Active Contributor
0 Kudos

Hi,

The idea of *WHEN/*ENDWHEN loop is that for the default case (without *WHEN_REF_DATA = MASTER_DATA) it will loop ONLY EXISTING BASE records.

If you scope some dimension to some member and there is NO record for this member in this time period - no calculation will happen.

To ensure, that you calculate everything you have 2 options:

1. To repeat calculations for members participating in the formula in different WHEN/ENDWHEN loops (to prevent accumulation).

2. Use *WHEN_REF_DATA = MASTER_DATA to enforce All records loop (may affect performance).

B.R. Vadim

former_member186338
Active Contributor
0 Kudos

And some comments about your code:

*XDIM_MEMBERSET TIME = 2012.NOV //, 2012.OCT - don't scope unused period! Add *

*XDIM_MEMBERSET V_ACCOUNT = account_a

*XDIM_MEMBERSET ENTITY = 1234

*WHEN TIME //ACCOUNT - error, use TIME if 2012.nov is a member of TIME dim

*IS * //2012.nov - use *, because nov is already scoped

//*REC(EXPRESSION=(%VALUE%) - ([TIME].[TMVL(-1,2012.NOV)],[ACCOUNT].[account_a]), V_ACCOUNT = account_b, AUDITTRAIL= Other) - tuple ([TIME].[TMVL(-1,2012.NOV)],[ACCOUNT].[account_a]) is not nesessary, use only TIME meber and remove extra brackets

*REC(EXPRESSION=%VALUE% - [TIME].[TMVL(-1,2012.NOV)], V_ACCOUNT = account_b, AUDITTRAIL= Other)

*ENDWHEN

This code will calculate the following formula:

account_b(2012.NOV) = account_a(2012.NOV) - account_a(2012.OCT)

And this code will not calculate account_b(2012.NOV) if account_a(2012.NOV) has no value, even if account_a(2012.OCT) has value.

To correct things you can add *WHEN_REF_DATA = MASTER_DATA before *WHEN TIME or add second WHEN/ENDWHEN like:

*XDIM_MEMBERSET TIME = TMVL(-1,2012.NOV) //Scope prev period

//*XDIM_MEMBERSET V_ACCOUNT = account_a - scoped before

//*XDIM_MEMBERSET ENTITY = 1234 - scoped before

*WHEN TIME

*IS *

*REC(EXPRESSION= [TIME].[2012.NOV]-%VALUE%, V_ACCOUNT = account_b, AUDITTRAIL= Other)

*ENDWHEN

B.R. Vadim