Skip to Content
avatar image
Former Member

BPC10.0 NW Script logic problem to calculation of accounts

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Oct 27, 2016 at 01:38 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 27, 2016 at 11:39 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Vadim Kalinin

      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

  • Oct 27, 2016 at 12:21 PM

    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!

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 27, 2016 at 01:06 PM

    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

    Add comment
    10|10000 characters needed characters exceeded