0

# BPC10.0 NW Script logic problem to calculation of accounts

Oct 27, 2016 at 11:20 AM

201

Former Member

Dear Experts,

I have one question to calculate accounts with different periods.

For example I would like to calculate the account 1422100 from the accounts 1422200 actual period - 1422200 period 12 last year.

I put the following logic script in default:

[ACCOUNT].[#1422100]=([ACCOUNT].[1422200],[TIME].[%TIME_SET%])-([ACCOUNT].[1422200],[TIME].[%YEAR%(-1).12])

The problem is, it takes everytime the time period 2015.12. For the periods in 2016 would it be ok, but for Periods in 2017, 2018 etc. it should takes 12.2016, 12.2017 etc., but it doesn´t.

Has anyone an idea how it works correctly?

Thanks and best regards

Daniel

Vadim Kalinin Oct 27, 2016 at 01:38 PM
1

For simultaneous send of multiple months of the same year:

//%TIME_SET% = 2017.07,2017.08
*SELECT(%YS%,[YEAR],TIME,ID=%TIME_SET%) // %YS%=2017,2017
*SELECT(%FM%,[ID],TIME,YEAR=%YS% AND PERIOD=JAN) // %FM%=2017.01
*WHEN ACCOUNT
*IS 1422200
*REC(EXPRESSION=%VALUE%-[TIME].[TMVL(-1,%FM%)],ACCOUNT=1422100) // TMVL(-1,%FM%)=TMVL(-1,2017.01)=2016.12
*ENDWHEN

Show 1 Share
Former Member

Thanks Vadim, as I can see it works!

BR

Daniel

Former Member Oct 27, 2016 at 11:39 AM
0

Hi DAniel,

%YEAR% will always return the current calendar year! It is a system defined variable! Instead try using TMVL function with *WHEN/ENDWHEN.

http://sapassets.edgesuite.net/sapcom/docs/2015/08/6cdcaf53-557c-0010-82c7-eda71af511fa.pdf

Regards,

JP

Show 7 Share
Former Member

Hi JP,

thanks for the quick answer. I tried already a logic with the TMVL function, but it doesn´t take me the TMVL logic. And how can I calculate the both account? Some advice?

BR

Daniel

Former Member

Are you running your script logic through default logic? Or through Default Formulas data manger package???

Former Member
Former Member

I am running it through default logic.

Former Member

Sorry, but please, provide full info!

Former Member

I put the logic script in the default.lgf in consolidation model.

So I want to calculate the account above with the different period during the data saving. So after saving data I would like to have the calculate account. I am not running special Data Manager for it.

BR

Daniel

Former Member

You have to describe what data are you sending by this input schedule:

For a single month?

For multiple months of the single year?

For multiple months of different years?

The script will be different...

Former Member

I am sending data for a single month f.e. 2017.07 for account 1422200 Value: 100.

In Period 12.2016 I have on this account 1422200 the value 50.

As result I would like to have on the account 14422100 the value 50 (100 - 50) in Period 07.2017

I hope it is a little more clear what I want to calculate

Thanks and BR

Daniel

Vadim Kalinin Oct 27, 2016 at 12:21 PM
0

Please describe how script will be launched, what data is selected etc...

Second: MDX calculations are very slow, try to use WHEN/ENDWHEN instead. And your logic is based on special variable %YEAR%, containing current year only!

Share
Vadim Kalinin Oct 27, 2016 at 01:06 PM
0

The script that will work correctly if single month data is sent (incorrect for multiple months):

//%TIME_SET% = 2017.07

*SELECT(%Y%,[YEAR],TIME,ID=%TIME_SET%) // %Y%=2017

*WHEN ACCOUNT

*IS 1422100

*REC(EXPRESSION=%VALUE%-[TIME].[TMVL(-1,%Y%.01)]) // TMVL(-1,%Y%.01)=TMVL(-1,2017.01)=2016.12

*ENDWHEN

Show 5 Share

But the script is logically strange:

User enter 100 in the cell, press Save and see 50 in the same cell :)

Former Member

One more question for missunderstanding me with the single month data

I want to sent the values also for 2017.08 etc. so the calculation should be every month. But I send just data in each month for the actual reporting period.

One more question, I see just the Account 1422100 in the logic. But the calculation is as described 1422100 = 1422200 current period - 1422200 last year.12. I don´t see the account 1422200

So is the script right for what I mean?

Thanks

Former Member

If not single month then:

For multiple months of the single year?

For multiple months of different years?

Former Member