Logical Error in Script Logic

Hello Experts,
Please provide your guidance for the following scenario.
I need to calculate the 'Accumulated Depreciation' for every month, based on the amounts in the 'AccumDep' and the 'Depreciation' accounts.
In other words, the value of the Accumulated Depreciation for the month of Feb should be equal to (Accumulated Depreciation in Jan + Depreciation in Jan), and so on.
To accomplish this, I have written the following script logic.
*WHEN ACCOUNT
*IS AccumDep, Depreciation
     *FOR %MON% = 2009.FEB,2009.MAR,2009.APR
          *REC(FACTOR=1, ACCOUNT=AccumDep, TIME=%MON%)
     *NEXT
*ENDWHEN
*COMMIT
The above logic was validated without any 'syntax' errors.  However, I do not see the desired results, as the Accumulated Depreciation is not getting updated every month.  The amount from FEB appears for MAR & APR also.
Therefore, could you please review the above script and let me know if there are any 'logical' errors?
All your guidance is greatly appreciated.  Thanks...

Hi,
You are not getting the desired result because you are trying to aggregate the depreciation and the accumulated depreciation of the same month and post the result again in the same month. Lets say the code is working for 2009.MAR. You are trying to add the depreciation and accumulated depreciation of 2009.MAR. However, you still dont have the acc depreciation of 2009.MAR. You basically need to take the acc depreciation of the previous month.
You can try something like:
*WHEN ACCOUNT
*IS Depreciation
     *FOR %MON% = 2009.FEB,2009.MAR,2009.APR
          *REC(EXPRESSION = %VALUE% + ([ACCOUNT].[AccumDep],[TIME].Previous), ACCOUNT=AccumDep)
     *NEXT
*ENDWHEN
*COMMIT
You can have a property called Previous to store the previous month of each period in the time dimension.
Hope you got the idea.

Similar Messages

  • Error with Script logic

    Hello friends,
    I am getting an error with running currency conversion in an app, the error says Invalid dimension "C_Category". Here is the script logic, I dont see C_Category anywhere. For the record, the name of dimension is category.
    *RUN_PROGRAM CURR_CONVERSION
          CATEGORY     = %C_CATEGORY_SET% 
          GROUP = %GROUPS_SET% 
          TID_RA = %TIME_SET%
          RATEENTITY = GLOBAL
          OTHER = [ENTITY=%ENTITY_SET%]//For More than one other scope parameters: OTHER = [ENTITY=%ENTITY_SET%;INTCO=%INTCO_SET%...]
    *ENDRUN_PROGRAM

    Hello,
    Variable %C_CATEGORY_SET% means set of members selected for Dimension C_CATEGORY. So, if you want to use CATEGORY instead replace it with %CATEGORY_SET%, but if are running Consolidations I think you need C_CATEGORY Dimension.
    Regards,
    Gersh

  • [ASK] Error in Script Logic Using WHEN

    Hello guys.
    Script logic :
    *XDIM_MEMBERSET CATEGORY = %CGY_PLAN%, %CGY_FORECAST%
    *XDIM_MEMBERSET ACCOUNT = <ALL>
    *XDIM_MEMBERSET ENTITY = <ALL>
    *XDIM_MEMBERSET TIME = %YEAR_TTL%
    *XDIM_MEMBERSET VEHICLE = <ALL>
    *XDIM_MEMBERSET BUDGET_ACT = <ALL>
    *WHEN CATEGORY
    *IS %CGY_PLAN%  // Error
      *WHEN TIME
      *IS %YEAR_TTL%
        *REC(CATEGORY = %CGY_FORECAST%, TIME = %YEAR_TTL%)
      *ENDWHEN
    *ENDWHEN
    *COMMIT
    When i validate, it is error for statement : *IS %CGY_PLAN%.
    But if that statement i change into : *IS %YEAR_TTL%; it isn't error.
    Why is this happen ? How to correct it ?
    Thank you.

    Hi,
    You have 3 variables in your script - CGY_PLAN, CGY_FORECAST, and YEAR_TTL.
    Are you passing the values to these variables through DM package?

  • An error in Script Logic

    Hi Experts,
    I have a problem with one of the FXTranslation logicu2019s in one of my report can u please help me on that.
    The logic works fine for 2 reports out of 3, for the 3rd report I donu2019t know why itu2019s not doing the translation to USD. As far as the design of the report goes the 2 reports for which translation works fine comprises of 2 logics one for percentage allocation and other for translation from LC to USD, whereas the 3rd report needs only translation but doesnu2019t need the allocation logic to be run.
    The conversion for the 3rd report happens if I comment out the allocation logic. Both these logics are mapped to Default.LGF file. I am unable to figure out what could be the error.
    Below is the Script Logic for Aloocation and Translation:
    //Budget Allocation
    *SELECT(%CURR%,"[ID]","RPTCURRENCY","[CURRENCY_TYPE]='L' OR [CURRENCY_TYPE]='R'")
    *XDIM_MEMBERSET RPTCURRENCY=%CURR%
    *RUNALLOCATION
    *FACTOR=USING/1
    *DIM ACCOUNTB WHAT=[IS_ALLOC]='Y'; WHERE=<<<; USING=ALLOCPER
    *DIM PRODUCTM WHAT=NOPRODUCT; WHERE<>NOPRODUCT; USING=<<<
    *ENDALLOCATION
    *COMMIT
    // Currency Translation
    *SELECT(%REPORTING_CURRENCIES%, "[ID]", "RPTCURRENCY", "[REPORTING] = 'Y'")
    *SELECT(%FX_RATES%, "[ID]", "RATE", "[GROUP] = 'FX RATE'")
    // Load the rates from the RATE cube
    *LOOKUP RATE
                *DIM CATEGORY="BUDGET"
         *DIM RATEENTITY="GLOBAL"
         *DIM RATE=ACCOUNTB.RATETYPE
         *DIM SOURCECURR:INPUTCURRENCY=LEGALENTITY.CURRENCY
         *FOR %CURR%=%REPORTING_CURRENCIES%
              *DIM %CURR%:INPUTCURRENCY="%CURR%"
         *NEXT
    *ENDLOOKUP
    //  define the translation rule
    *WHEN ACCOUNTB.RATETYPE
    *IS "NOTRANS"
         // skip
    *IS %FX_RATES%
               // translate
         *FOR %CURR%=%REPORTING_CURRENCIES%
              *REC(FACTOR=LOOKUP(%CURR%)/LOOKUP(SOURCECURR),RPTCURRENCY="%CURR%")
         *NEXT
    *IS "COPYLC"
         // take as is
         *FOR %CURR%=%REPORTING_CURRENCIES%
              *REC(RPTCURRENCY="%CURR%")
         *NEXT
    *ENDWHEN
    *COMMIT
    // Default
    // FX Translation
    *include FXTranslation.lgf
    // Budget Allocation
    *include BudgetAllocation.lgf

    Hi Naresh,
    One thing that helped me solve the problem was I needed to use different set of Dimension members/property in the Logic i.e What, Where and Using to trigger off the Curency Translation.
    But please make sure that you use try to understand a unique dimension (member/property) used and use that to trigger off the translation or anything for that matter. My other two translations were working fine as the parameters i used were unique for them whereas the remaining one needed alteration in the logic only in the parameters used in What, Where and Using, so had to add one more set of Translation Logic for this exclusively.
    Another point you need to check in your Rate Application is whether you have your Reporting Currency as value 1, say for eg USD is your reporting currency then the value in Rate Application for USD must be 1, if u by mistake cleared of this value when using the Clear Data Manager Package so the multiplication with 0 results in no conversion.
    These were the two points that helped me solve my issue. I hope it helps.
    Rgds,
    Rizwan
    Edited by: Rizwan Mustaffa on Jul 13, 2009 12:09 PM

  • Any Error in Script Logic

    Hi
    Pl. verify following code: I did not get any error but the result is not derived ,
    *WHEN ACCOUNT
    *IS "BS115"
    *WHEN CATEGORY
    *IS "Actual"
    *WHEN TIME
    *IS "2011.04"
    *REC(FACTOR = 1, ACCOUNT = "BS114",CATEGORY = "Actual",TIME = "2011.05")
    *ENDWHEN
    *ENDWHEN
    *ENDWHEN
    *COMMIT
    I want to copy from BS115 april to BS114 MAY ACTUAL
    pl. verify any mistake in the above code
    rgds
    srinath

    Hi
    My issue is resolved.
    Actuall the problem is once saved data is not displaying (after running  default script logic)
    But some time times result is displaying immd. after save without refresh.
    I refreshed & i got my result.
    Thanks
    Srinath

  • Error during script logic processing from UJKT tcode

    Hi,
    When I try to execute the script logic through UJKT tcode, it gives me the following exception:
    UJK_EXECUTION_EXCEPTION:Runtime error Duplicate recordMember (D_AUTO_UAE) of dimension (DIVISION) is not a valid member.
    Following is the script logic:
    *RUN_PROGRAM VALIDATION
       CATEGORY = %CATEGORY_SET%
       GROUP= %GROUPS_SET%
       TID_RA = %TIME_SET%
    *ENDRUN_PROGRAM
    BAdi used is BADI_UJ_CUSTOM_LOGIC
    Also the error log displays entire set of data records, instead I will like to see only the status of whether it went successful or not.
    Where can I check this setting?
    Please help.
    Thanks and Regards,
    Pankaj

    Hi Pankaj,
    I would request you to re-process the DIVISION deimension (preferrably all the dimensions). Then re-process and optimize the application. See, if you are getting any errors or not.
    Hope this helps.

  • Error Validating Script Logic

    Hello,
    I'm new to BPC, and so i'm having some problems in debugging this error.
    When i do validation script of this code
    *WHEN AMOUNTTYPE
    *IS "1"
      *REC (EXPRESSION= (%VALUE%)+200)
    *ENDWHEN
    *COMMIT
    "i get the follow message Invalid End/endWhen"
    I don't know what i'm doing wrong. Someone can help me.
    Regards,
    Gomes

    *WHEN ACCT_C.ID-- Dimention name is missing if you don't have xdim in the top.
    *IS "1"
    *REC(EXPRESSION= (%VALUE%)+200) -- Take out space after REC -- This will take out your when and end error. But new error will be shown because there is no dimention at the type.
    *ENDWHEN
    *COMMIT

  • Error in Script Logic

    Hi All,
    For the below code i am getting error.
    any alternate way to resolve this issue.
    *WHEN P_ACCT
    *IS "EXTSALES", "ICSALES"
    *REC(FACTOR=1.5,P_ACCT="UPSIDEFACTOR")
    *ENDWHEN
    *COMMIT
    Error
    LINE:3 multi-member specified for dimension "3" *IS
    How to resolve this issue.
    Regards,
    Phanikumar.

    Phanikumar, what you are trying to do does not make sense.
    The following will work ok because you are multiplying EXTSALES by 1.5 and storing this in UPSIDEFACTOR.
    *WHEN P_ACCT
    *IS "EXTSALES"
    *REC(FACTOR=1.5,P_ACCT="UPSIDEFACTOR")
    *ENDWHEN
    *COMMIT
    In your example, BPC does not know whether to multiply EXTSALES or ICSALES or the sum of both of these.
    I hope this helps.
    Sean

  • Validate my script logic: reference erro LOOKUP is not defined

    Dear all,
    i want write one script logic. It use LOOKUP using FOR/NEXT.
    But when i check stament in my script logic: messesage erro: reference erro LOOKUP is not defined.Can you help me?
    My script logic
    *XDIM_MEMBERSET ACCOUNT=BS221
    *XDIM_ADDMEMBERSET CATEGORY = Actual
    *XDIM_ADDMEMBERSET ENTITY = CSO
    *SELECT(%TIME%,"[ID]",TIME,"[ID]>=2006.01 AND [ID]<=2006.02")
    *XDIM_MEMBERSET TIME = %TIME%
    *LOOKUP Rates
    *DIM  CATEGORY ="Actual"
    *DIM R_ACCOUNT ="AVG"
    *DIM R_ENTITY ="Global"
    *DIM INPUTCURRENCY="USD"
    *DIM MEASURES ="PERIODIC"
    *FOR %T% = %TIME%
    *DIM RATE_%T%: TIME =%T%  
    *NEXT
    *ENDLOOKUP
    *WHEN ACCOUNT
    *IS "BS221"
    *FOR %T1% = %TIME%
    *REC(EXPRESSION=LOOKUP(RATE_%T1%),TIME=%T%)
    *NEXT
    *ENDWHEN
    *COMMIT
    Thanks,
    Hungth

    Dear Vadim,
    I want test LOOKUP statement using FOR/NEX, then get value per member for member in LOOKUP.
    in excel add-in of Rates Model:
    Actual - Actual
    Average Rate
    Global Entity
    2006.01 - Jan 2006
    31
    2006.02 - Feb 2006
    30
    2006.03 - Mar 2006
    30
    2006.Q1 - Q1 2006
    30
    I want run my script logic above to get value from Rates Model ( 2006.01: 31, 2006.02 : 30, 2006.03: 30 ) to current model , to calculate in crurrent model.
    BS221 - Long Term Debt
    2006.01 - Jan 2006
    2006.02 - Feb 2006
    2006.03 - Mar 2006
    Actual - Actual
    31
    30
    30
    How i can write my script logic? My script logic statements is correct??
    Thanks,
    hungth

  • Multiple Script Logics in Default Logic.. order of execution... Commit

    Hi,
    I have a situation where I need to perform two activities...
    i) Perform a multiplication operation on the data input by the user - Script Logic A
    ii) Send the data at a summary level to another application. - Script Logic B
    Both Script logics are in the Default Logic
    User opens an input template and makes changes to a few Products (more than 1). I want the script logicA to execute completely (i.e. for all the models) and THEN Script Logic B to execute since Script Logic B summarises the data
    It seems like this is not how the system works.. Rather it goes thru Script Logic A and Script LogicB for the 1st Product, then the 2nd Product and so on...
    I tried using a commit after Script Logic A / before Script logic B and a few other options but to no avail... Any suggestions ???
    The other option is not to put Script Logic B in the Default Logic but to execute it separately... Worse case situation I'll use that option..
    thanks

    Hi,
    Have you defined the scope of the product for the two logics independently.
    Try that by including commit after the first logic. This should work.
    *XDIM_MEMBERSET PRODUCT=BAS(ALL)
    Script 1
    *COMMIT
    *XDIM_MEMBERSET PRODUCT=BAS(ALL)
    Script 2
    *COMMIT
    Hope this helps,
    Regards,
    G.Vijaya Kumar

  • Script logic not working

    Hi all,
        we have been using this logic in versions 4.2 and 5.1.  just brought our apps over to  new 7.5  sql environment and the logic did not  work. Nothing changed in logic or in dimensionality. System seems to be ignoring any *WHEN IGNEDDATA   checks.
    It appears that evaluation of signeddata doesn't work in version 7.5 in  SQL. loaded multiple data templates and also run countless default  logic packages. Always fails to calculate the required accounts only when involving logic . Other script  logic packages work fine. 
    Regards,
    Srini

    Hi Srini,
    Can you please share the script, you are using?

  • Raise an ERROR message from Script logic

    Hi All
    Here i have developed a custom copy funtion im not using standard copy functionality.
    I am trying to copy from working version to another version ex: V01 to V02. I have scoped these two versoins in script logic.
    But when user runs DM package for a different version other than v01 and v02 then user has to get the error message.
    Can i achive this by including some code in the script logic. i dont want to use the security options on user level.
    is there any function to raise error??
    Please suggest thanks in advance.
    Regards
    AK

    Hi AK,
    As I understood from your question, you want to copy always from V01 to V02. No other versions will be used other than these 2. So, it will be better to have them hardcoded in your script logic, instead of keeping error messages for the user. Anyways, you dont want the user to enter anything other than V01 and V02.
    Hope this helps.

  • Script logic error - Invalid object name 'tblStatus'

    Hi all,
    Running BPC 5.1 SP5 on SQL 2005.
    Has anyone ever seen this error message before? I only get the error message when choosing the run-time option in the package, to honor work status settings. This problem just appeared in the last few days, and I believe that a month or two ago, users were running the same logic (with the same yes-honor-work-status option selected).
    We did recently upgrade from 5.1 SP3 to 5.1 SP5, and I'm wondering if this may be a cause? That's just a hypothesis though.
    Invalid object name 'tblStatus'. in:
    select distinct d.VERSION,d.ENTITY,d.TIMEID
    from #RESULT_333729 d  where signeddata<>0
    and exists (select * from tblStatus s where [APP]='CONSOL' and d.VERSION=s.CATEGORY and d.ENTITY=s.ENTITY and d.TIMEID=s.TIME and [STATUS]>0)
    I understand what it means, and of course there is no table in the appset database tblStatus. Work status locks are kept in tblConsolLock (where Consol is my app name). And in that table, the field name is StatusCode, not Status. So it appears that this is some vestige of code from an earlier version of BPC / O'soft.
    This error occurs in a piece of script logic, that includes both basic SQL WHEN/IS/*REC's and also a *RUNALLOCATION. The error is thrown within the RUNALLOCATION code block. The complete run-up to the error message is shown below.
    -- Calculate difference
    insert into #DIFF_333729 ([ACCOUNT],[AFFILIATE],[CURRENCY],[DATASRC],[ENTITY],[PRODHIER],[TIMEID],[VERSION],signeddata)
    select [ACCOUNT],[AFFILIATE],[CURRENCY],[DATASRC],[ENTITY],[PRODHIER],[TIMEID],[VERSION],amtWHERE as signeddata
    from #WHERE2_333729
    select [ACCOUNT],[AFFILIATE],[CURRENCY],[DATASRC],[ENTITY],[PRODHIER],[TIMEID],[VERSION],sum(signeddata) as signeddata
    into #RESULT_333729 from #DIFF_333729
    group by [ACCOUNT],[AFFILIATE],[CURRENCY],[DATASRC],[ENTITY],[PRODHIER],[TIMEID],[VERSION]
    --Time to calculate and count differences (45459 found):2.5 sec.
    select distinct d.VERSION,d.ENTITY,d.TIMEID
    from #RESULT_333729 d  where signeddata<>0
    and exists (select * from tblStatus s where [APP]='CONSOL' and d.VERSION=s.CATEGORY and d.ENTITY=s.ENTITY and d.TIMEID=s.TIME and [STATUS]>0)
    call 1 completed and data posted in 23.6 sec.
    Run completed in 23.7 sec.
    End time --->11:01:05 AM  -  Date:1/16/2009
    Invalid object name 'tblStatus'. in:
    select distinct d.VERSION,d.ENTITY,d.TIMEID
    from #RESULT_333729 d  where signeddata<>0
    and exists (select * from tblStatus s where [APP]='CONSOL' and d.VERSION=s.CATEGORY and d.ENTITY=s.ENTITY and d.TIMEID=s.TIME and [STATUS]>0)
    Here is the original script logic (from the LGX file -- the LGF file has a whole bunch of variables in it that would only confuse the matter more). It works just fine when the
    *RUN_ALLOCATION @A_1||
    USING/TOTAL|
    ACCOUNT WHAT=659210,659310,659320,659410,659510,659610,659620,659630,659710,659810,659820,659910; WHERE=<<<; USING=PCAYTD510000; TOTAL=<<<|
    PRODHIER WHAT=PRODHIERL1A;WHERE=[PRODHIERLEVEL]='5'; USING=<<<; TOTAL=<<<|
    DATASRC WHAT=PCAASSESSSTAGE1,PCAASSESSSTAGE2; WHERE=PCAASSESSALLOC1; USING=INPUTCONSOL; TOTAL=<<<|
    ENTITY WHAT=[COMPANYCODE]='7470' AND [PCAASSESSDRIVERBP]='PCAYTD510000' AND
      ([PCAASSESSMETHODBP] = 'ALLOCAUTO' OR  [PCAASSESSMETHODBP] = 'ALLOCMANUAL');WHERE=<<<;USING=7470.BASE;TOTAL=<<<|
    Anyone experience this same error message? I searched for SAP support notes and found nothing to do with tblStatus or similar.
    Thanks for your help,
    Tim

    Hi Sorin,
    Thanks, you've confirmed what I suspected.
    Yes, we always process & save apps & dims on any upgrade.
    We've reproduced the problem in all 3 of the environments with the customer's appset. I haven't yet reproduced in ApShell, but will do so & report it as a bug.
    And just out of curiousity -- was the other message you saw here in this EPM forum? Before I posted my question, I searched both here, and in the support notes, for "tblStatus" and a few other terms about work status lock errors, etc., and came up with 0 results.
    Thanks again,
    Tim

  • BPC Script Logic - XDIM_FILTER results in error

    I am writing a Script Logic in BPC and I need it to include all records where the DESTINATION dimension member has the Dimension Property of PLANDEST = "Y"
    This approach works:
    *SELECT(%DestinationMbrs%,"[ID]","Destination","[PlanDest] = 'Y'")
    *XDIM_MEMBERSET DESTINATION = %DestinationMbrs%
    This approach does not work:
    *XDIM_MEMBERSET DESTINATION = <ALL>
    *XDIM_FILTER DESTINATION=[DESTINATION].PROPERTIES("PlanDest")="Y"
    It results in the error message at runtime:
    Error in step 1 of QueryCubeAndDebug: -2147467259 Query (1,156) The PLANDEST dimension attribute was not found.
    The reason I would like to use the second approach is that the first approach relies on the SELECT statement.  The documentation on the SELECT statement says:
    The *SELECT statement is executed at the time the logic is validated, and the expanded result is
    written in the LGX file. This means that if the related dimension is modified, it may be necessary
    to re-validate the rules.
    So if I change the DESTINATION dimension members PLANDEST flags, I need to re-validate the script logic.  That is a maintenance nightmare and a problem waiting to happen.
    How do I solve this so that the dimension attribute is evaluated at runtime, not at logic validation time?

    As Yuan Said, if you are using MDX logic and want to use property, you should check Inapp at the 'manage property' menu of admin console.
    Usually, InApp sholud not be selected for better performance of MDX query. (SAP recommendation)
    But. Here are two cases that you should select.
    1. MDX logic in the logic script.
    2. Dimension formula.
    I hope it will make clear for all.
    James Lim

  • Script Logic Validation Error

    Hi experts.
    The Script Logic validation is returning an error for this sentence:
    .[#BUDGET]=[TIPO_DATO].[PREVISION]+.[AJUSTE]{/code}
    The error I'm receiving is:
    Member "" not exits
    The member BUDGET for TIPO_DATO dimension exits as well as member prevision
    ¿Any idea?
    Thanks a lot
    it0

    Hi,
    Can you process by removing the member and then add budget to dimension tipo_dato  and then validate the script logic.thnx.
    Sanjeev

Maybe you are looking for