cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BPC10.0 NW Script logic problem to calculation of accounts

daniel_cepok2
Participant
0 Likes
1,481

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor

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

daniel_cepok2
Participant
0 Likes

Thanks Vadim, as I can see it works!

BR

Daniel

Answers (3)

Answers (3)

former_member186338
Active Contributor
0 Likes

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

former_member186338
Active Contributor
0 Likes

But the script is logically strange:

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

daniel_cepok2
Participant
0 Likes

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_member186338
Active Contributor
0 Likes

Please answer my question about sending data from input form:

If not single month then:

For multiple months of the single year?

For multiple months of different years?

daniel_cepok2
Participant
0 Likes

Data sending from input form for multiple month of single year

former_member186338
Active Contributor
0 Likes

P.S. To store data in 1422100

*REC(...,ACCOUNT=1422100)

former_member186338
Active Contributor
0 Likes

First of all, please read: https://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues/

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!

Former Member
0 Likes

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

daniel_cepok2
Participant
0 Likes

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
0 Likes

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

daniel_cepok2
Participant
0 Likes

I am running it through default logic.

former_member186338
Active Contributor
0 Likes

Sorry, but please, provide full info!

daniel_cepok2
Participant
0 Likes

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_member186338
Active Contributor
0 Likes

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...

daniel_cepok2
Participant
0 Likes

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