Calc Previous YTD periods in SQL script logic

Hi, experts!
I need help in writing SQL script logic. I want to calculate such logic
(Account = Acc3, TIME = 2009.FEB ) = (Account = Acc1, SUM(TIME = (2009.JAN; 2009.FEB))) - (Account = Acc2, SUM(TIME = (2009.JAN)))
(Account = Acc3, TIME = 2009.MAR ) = (Account = Acc1, SUM(TIME = (2009.JAN; 2009.FEB; 2009.MAR))) - (Account = Acc2, SUM(TIME = (2009.JAN; 2009.FEB)))
..... and so on
Thanks all for help.

Hi Petar,
Thanks for your advice.
Legalapp in my Apshell do not have any account transformation rules. But looking at the account transformation table, I can see it requires dimension type datasrc and subtable for datasource and flow fields. But currently my application is similar to the Finance application from Apshell and do not have these dimension types.
Still I created a rule in account transformation table by having these fields blank and the validation was successful. Then I used SPRUNCALCACCOUNT in default.LGL file to trigger this rule but I don't see this working.
Can you help me on below questions:
1. Is it necessary to have datasrc and subtable dimensions to create account transformation rule?
2. Will SPRUNCALCACCOUNT write the values to WB table or should I use COMMIT or any other command along with his to have the values written?
3. Is there any way/place where I can get the examples of Account Transformation rules ?
Thanks
Sharath

Similar Messages

  • Proper formatting for dimension properties in SQL script logic

    Hi all,
    I'm trying to pass the time member from a property in account dimension. (Post recognized revenue by looking at deferred revenue accounts.)  The dimension ACCTREV has a property called DATENAME.  DATENAME refers to a valid TIME member.  In 4.2 this logic worked fine.  In 5.1sp3 it's not passing the correct time period (formula log indicates null value for time member).
    For example:  ACCTREV = 4101Billing_2008.JUN    DATENAME = 2008.JUN     (DATENAME is a property of ACCTREV)
    Here's the logic:  *REC(EXPRESSION=%VALUE%,TIME=ACCTREV.DATENAME,ACCTREV=ACCTREV.ACCT)     
    I've read the other post indicating brackets are required by SQL when passing parameters that contain delimiters like "." but it doesn't say how to do it!
    I've tried TIME=ACCTREV.DATENAME  resulting in null time members.
    I've tried TIME=ACCTREV.DATENAME  resulting in null time members. 
    I've updated the property value to 2008.JUN with TIME=ACCTREV.DATENAME resulting in null time members.
    Also how do you post a thread using a bracket without turning it into a hyperlink? 
    Any help would be greatly appreciated.
    Edited by: Ara Toroyan on Aug 5, 2008 2:24 AM

    Thanks Kranthi,
    It's still not working.
    I believe the problem is SQL 2005 related and the DATENAME "2008.JUN." 
    ACCT is a property of ACCTREV and the properties refer to valid ACCTREV members.
    DATENAME is a property of ACCTREV and refers to valid TIME members-- not TimeID or UserTimeID
    The formula log reveals the correct ACCTs but no TIME (null values). The problem is with DATENAME.  Closer inspection of the formula log below shows that Query1 doesn't load DATENAME.  (Not sure why but this could be because of improper formatting.)
    I've validated the existence of all property values with =EVPRO.  The values are part of the dimension tables.
    Here's the forumula log:  (I've deleted some of the product and time members in the log for brevity.)
    Number of logic calls:1
    Call no. 1, logic:D:\BPC\Data\WebFolders\SecondTry\REVENUE
    ..\AdminApp\REVENUE\RevRec.LGX
    Building sub-query 1
    Query Type:0
    Max members:
    Region:
    DIMENSION:ACCTREV
    4101BILLING_2008.JUN,4201BILLING_2008.JUN,4206BILLING_2008.JUN,4207BILLING_2008.JUN,4208BILLING_2008.JUN
    DIMENSION:CATEGORY
    ACTUAL
    DIMENSION:PRODUCT
    0000,0001,0005,0010,0011,0012,0013,0020,0024,0030,0031,0040,0050,0059,0065,0066,0067,0070,0071,0075,0078,0079,0080,0099,0140,0145
    DIMENSION:REVDATA
    REV_AMOUNT
    DIMENSION:TIME
    2001.JAN,2001.FEB,2001.MAR,2001.APR,2001.MAY,2001.JUN,2001.JUL,2001.AUG,2001.SEP,2001.OCT,2001.NOV,2001.DEC,2002.JAN,2002.FEB,2002.MAR,2002.APR,2002.MAY,2002.JUN,2002.JUL,2002.AUG,2002.SEP,2002.OCT,2002.NOV,2002.DEC,2003.JAN,2003.FEB,2003.MAR,2003.APR,2003.MAY,2003.JUN,2003.JUL,2003.AUG,2003.SEP,2003.OCT,2003.NOV,2003.DEC,2004.JAN,2004.FEB,2004.MAR,2004.APR,2004.MAY,2004.JUN,2004.JUL,2004.AUG,2004.SEP,2004.OCT,2004.NOV,2004.DEC,2005.JAN,2005.FEB,2005.MAR,2005.APR,2005.MAY,2005.JUN,2005.JUL,2005.AUG,2005.SEP,2005.OCT,2005.NOV,2005.DEC,2006.JAN,2006.FEB,2006.MAR,2006.APR,2006.MAY,2006.JUN,2006.JUL,2006.AUG,2006.SEP,2006.OCT,2006.NOV,2006.DEC,2007.JAN,2007.FEB,2007.MAR,2007.APR,2007.MAY,2007.JUN,2007.JUL,2007.AUG,2007.SEP,2007.OCT,2007.NOV,2007.DEC,2008.JAN,2008.FEB,2008.MAR,2008.APR,2008.MAY,2008.JUN,2008.JUL,2008.AUG,2008.SEP,2008.OCT,2008.NOV,2008.DEC,2009.JAN,2009.FEB,2009.MAR,2009.APR,2009.MAY,2009.JUN,2009.JUL,2009.AUG,2009.SEP,2009.OCT,2009.NOV,2009.DEC
    Loading ACCTREV.DATEID,ACCT
    Loading TIME.TIMEID
    Time to load properties:0.0 sec.
    select ACCTREV,PRODUCT,TIMEID,COMPANY,CUSTOMER,DATASRC,LOCATION,MEDIAID,PRODTYPE,TRANSID,SIGNEDDATA
    into #tblTempLogic_349866
    from tblFactREVENUE
    WHERE  ACCTREV in (N'4101BILLING_2008.JUN',N'4201BILLING_2008.JUN',N'4206BILLING_2008.JUN',N'4207BILLING_2008.JUN',N'4208BILLING_2008.JUN') AND  CATEGORY=N'ACTUAL' AND  PRODUCT in (N'0000',N'0001',N'0005',N'0010',N'0011',N'0012',N'0013',N'0020',N'0024',N'0030',N'0031',N'0040',N'0050',N'0059',N'0065',N'0066',N'0067',N'0070',N'0071',N'0075',N'0078',N'0079',N'0080',N'0099',N'0140',N'0145',N'0154',N'0155',N'0156',N'0157',N'0161',N'0162',N'0163',N'0164',N'0165',N'0171',N'0175') AND  TIMEID in (N'20010100',N'20010200',N'20010300',N'20010400',N'20010500',N'20010600',N'20010700',N'20010800',N'20010900',N'20011000',N'20011100',N'20011200',N'20020100',N'20020200',N'20020300',N'20020400',N'20020500',N'20020600',N'20020700',N'20020800',N'20020900',N'20021000',N'20021100',N'20021200',N'20030100',N'20030200',N'20030300',N'20030400',N'20030500',N'20030600',N'20030700',N'20030800',N'20030900',N'20031000',N'20031100',N'20031200',N'20040100',N'20040200',N'20040300',N'20040400',N'20040500',N'20040600',N'20040700',N'20040800',N'20040900',N'20041000') AND  REVDATA=N'REV_AMOUNT'
    insert into #tblTempLogic_349866 (ACCTREV,PRODUCT,TIMEID,COMPANY,CUSTOMER,DATASRC,LOCATION,MEDIAID,PRODTYPE,TRANSID,SIGNEDDATA)
    select ACCTREV,PRODUCT,TIMEID,COMPANY,CUSTOMER,DATASRC,LOCATION,MEDIAID,PRODTYPE,TRANSID,SIGNEDDATA
    from tblFactWBREVENUE
    WHERE  ACCTREV in (N'4101BILLING_2008.JUN',N'4201BILLING_2008.JUN',N'4206BILLING_2008.JUN',N'4207BILLING_2008.JUN',N'4208BILLING_2008.JUN') AND  CATEGORY=N'ACTUAL' AND  PRODUCT in (N'0000',N'0001',N'0005',N'0010',N'0011',N'0012',N'0013',N'0020',N'0024',N'0030',N'0031',N'0040',N'0050',N'0059',N'0065',N'0066',N'0067',N'0070',N'0071',N'0075',N'0078',N'0079',N'0080',N'0099',N'0140',N'0145',N'0154',N'0155',N'0156',N'0157',N'0161',N'0162',N'0163',N'0164',N'0165',N'0171',N'0175',N'0181',N'0182',N'0183',N'0185',N'0190',N'0200',N'0201',N'0210',N'0251',N'0275',N'0302',N'0305',N'0310',N'0802',N'1000',N'1002',N'1012',N'1016',N'1017',N'1026',N'1030',N'1033',N'1035',N'1041',N'1042',N'1054',N'1055',N'1059',N'1061',N'1062',N'1063',N'1065',N'1069',N'1073',N'1080',N'1082',N'1093',N'1100',N'1111',N'1120',N'1172',N'1210',N'1300',N'1700',N'1701',N'1800',N'1900',N'2082',N'2092',N'2110',N'2115',N'2118',N'2120',N'2121',N'2123',N'2124',N'2126',N'2136',N'2140',N'2150',N'2160',N'2170',N'2200',N'2201',N'2220',N'2225',N'2300',N'2500',N'2600',N'2611',N'2700',N'2701',N'2712',N'2715') AND  TIMEID in (N'20010100',N'20010200',N'20010300',N'20010400',N'20010500',N'20010600',N'20010700',N'20010800',N'20010900',N'20011000',N'20011100',N'20011200',N'20020100',N'20020200',N'20020300',N'20020400',N'20020500',N'20020600',N'20020700',N'20020800',N'20020900',N'20021000',N'20021100',N'20021200',N'20030100',N'20030200',N'20030300',N'20030400',N'20030500',N'20030600',N'20030700',N'20030800',N'20030900',N'20031000',N'20031100',N'20031200',N'20040100',N'20040200',N'20040300',N'20040400',N'20040500',N'20040600',N'20040700',N'20040800',N'20040900',N'20041000',N'20041100',N'20041200',N'20050100',N'20050200',N'20050300',N'20050400',N'20050500',N'20050600',N'20050700',N'20050800',N'20050900',N'20051000',N'20051100',N'20051200',N'20060100',) AND  REVDATA=N'REV_AMOUNT'
    and SOURCE = 0
    insert into #tblTempLogic_349866 (ACCTREV,PRODUCT,TIMEID,COMPANY,CUSTOMER,DATASRC,LOCATION,MEDIAID,PRODTYPE,TRANSID,SIGNEDDATA)
    select ACCTREV,PRODUCT,TIMEID,COMPANY,CUSTOMER,DATASRC,LOCATION,MEDIAID,PRODTYPE,TRANSID,SIGNEDDATA
    from tblFAC2REVENUE
    WHERE  ACCTREV in (N'4101BILLING_2008.JUN',N'4201BILLING_2008.JUN',N'4206BILLING_2008.JUN',N'4207BILLING_2008.JUN',N'4208BILLING_2008.JUN') AND  CATEGORY=N'ACTUAL' AND  PRODUCT in (N'0000',N'0001',N'0005',N'0010',N'0011',N'0012',N'0013',N'0020',N'0024',N'0030',N'0031',N'0040',N'0050',N'0059',N'0065',N'0066',N'0067',N'0070',N'0071',N'0075',N'0078',N'0079',N'0080',N'0099',N'0140',N'0145',N'0154',N'0155',N'0156',N'0157',N'0161',N'0162',N'0163',N'0164',N'0165',N'0171',N'0175',N'0181',N'0182',N'0183',N'0185',N'0190',N'0200',N'0201',N'0210',N'0251',N'0275',N'0302',N'0305',N'0310',N'0802',N'1000',N'1002',N'1012',N'1016',N'1017',N'1026',N'1030',N'1033',N'1035',N'1041',N'1042',N'1054',N'1055',N'1059',N'1061',N'1062',N'1063',N'1065',N'1069',N'1073',N'1080',N'1082',N'1093') AND  TIMEID in (N'20010100',N'20010200',N'20010300',N'20010400',N'20010500',N'20010600',N'20010700',N'20010800',N'20010900',N'20011000',N'20011100',N'20011200',N'20020100',N'20020200',N'20020300',N'20020400',N'20020500',N'20020600',N'20020700',N'20020800',N'20020900',N'20021000',N'20021100',N'20021200',N'20030100',N'20030200',N'20030300',N'20030400',N'20030500',N'20030600',N'20030700',N'20030800',N'20030900',N'20031000',N'20031100',N'20031200',N'20040100',N'20040200',N'20040300',N'20040400',N'20040500',N'20040600',N'20040700',N'20040800',N'20040900',N'20041000',N'20041100',N'20041200',N'20050100',N'20050200',N'20050300',N'20050400',N'20050500',N'20050600',N'20050700',N'20050800',N'20050900',N'20051000',N'20051100',N'20051200',N'20060100') AND  REVDATA=N'REV_AMOUNT'
    select tmpTable.ACCTREV,tmpTable.PRODUCT,tmpTable.TIMEID,tmpTable.COMPANY,tmpTable.CUSTOMER,tmpTable.DATASRC,tmpTable.LOCATION,tmpTable.MEDIAID,tmpTable.PRODTYPE,tmpTable.TRANSID,sum(SIGNEDDATA) as SIGNEDDATA
    from #tblTempLogic_349866 as tmpTable
    group by tmpTable.ACCTREV,tmpTable.PRODUCT,tmpTable.TIMEID,tmpTable.COMPANY,tmpTable.CUSTOMER,tmpTable.DATASRC,tmpTable.LOCATION,tmpTable.MEDIAID,tmpTable.PRODTYPE,tmpTable.TRANSID
    drop table #tblTempLogic_349866
    Time to load Source data:2.6 sec.
    29123 records to process
    Time to Prepare data process:0.0 sec.
    Time to initialize destination:0.0 sec.
    Time to get source data:0.0 sec.
    29123 scanned records
    0 skipped records
    29123 processed records
    29123 records generated
    Time to Scan data:5.5 sec.
    Time to get output data:0.1 sec.
    Time to prepare final strings:0.3
    Total processing time:5.9
    App: REVENUE - Records to be posted are 29119  (calc diff = 0)
    CATEGORY,REVDATA,ACCTREV,PRODUCT,TIME,COMPANY,CUSTOMER,DATASRC,LOCATION,MEDIAID,PRODTYPE,TRANSID,SIGNEDDATA
    ACTUAL,REV_AMOUNT,4101,0001,,03,2282436,INPUT,00,ZZ,NONE,MANUAL_TRANSBASED,-208.5
    ACTUAL,REV_AMOUNT,4101,0010,,03,1000105,INPUT,00,20,CURR,TRANSACTION_BASED,-88
    ACTUAL,REV_AMOUNT,4101,0010,,03,1000105,INPUT,00,20,HIST,TRANSACTION_BASED,-60

  • SQL functions in Script Logic

    I want to build a script logic but the dimensions that I am testing do not have the fields I want in the format I want. In my case I would like to test the "Start" property in the Employee dimension. The property represents the employee start date but is a var char in the format dd.mm.yyyy rather thna a date field. I want to test whether it is five years prior to the date being processed.
    My time dimension has a year property and a monthnum property. Each of these are varchar. I can write SQL that would convert these to a date and compare them with the start property on the employee dimension.
    Can I  do iinsert SQL functions in the When statement. An example would be
    *When convert(datetime, substring(employee.start,4,2) + '/' + substring(employee.start,1,2) + '/' + substring(employee.start,7,4))
    Can I use  SQL functions in the Is statement? An example would be
    *Is <DateAdd(YY,-5 , convert(datetime, Time.Monthnum + '/01/'' + time.year)
    Finally when I use such techniques and look at the log by using "show log" in the logic debugger I see no reference to the SQL I used. It is as if the generated SQL has not made use of my functions. Instead all I seee are the extract statements from the three fact tables. Is this normal? Is there a way to see what SQL is really being generated and run?
    At the moment it seems my only option is to make changes, try running it and hope I get an output. If no records are written I can't be sure whether it is because embedding SQL function is not supported or because I have made some other error.

    No, the "BPC SQL" script logic doesn't allow for this extensive use of real SQL within the scripting syntax. As a concept, it's best to think of "BPC SQL" script logic as, "this unique BPC logic syntax will generate real SQL code when it's executed."
    There's very little real SQL that you can use within the syntax itself, and definitely not within the WHEN or IF statements.  Nothing like cast, convert, substring, etc. (Except you CAN use these, a little bit, in a *SELECT statement. But I don't see how that will solve your current problem.)
    Plus, when you consider how the logic engine processes a set of data, it's helpful to think of it in terms of selects & reading through a recordset. So in that regard, a SQL background can be helpful, in understanding the concepts. (Sort of helpful, except when it confuses you, or frustrates you since you don't have all the power you want.)
    Anyway, to solve your problem, you might be able to restate the problem, and then use something like this code, which is valid syntax:
    *WHEN TIME.TIMEID
    *IS >= VERSION.FirstPlanMonthTimeID
    In this case, FirstPlanMonthTimeID is set up in the version dimension as, for example, 20090400 (representing 2009.APR). This timeID is set by BPC automatically when processing the time dimension, and I need to ensure that my Version property value is set to match it.
    A key point is that in BPC fact tables, the time dimension is stored as TIMEID (not ID, unlike all the other dimensions), and can be used for comparative evaluation in script logic WHEN/IF. The comparison property needs to be stored as an 8-digit integer value. If your time dimension has days in it (along with months), check the TIMEID after processing, and you should see the pattern for assigning values to TIMEID for days and months, etc.
    Normally, TIMEID is assigned pretty sensible and stable values. If it doesn't meet your logic requirements, you can create another property (be careful of USERTIMEID, since that has a specific purpose in the system which I've never fully understood) and assign that whatever (integer) values make sense.

  • Script Logic choice SQL or MDX in NW release?

    Hi experts,
    I have encountered some opposite arguments in forum. Please can you clarify NW release script logic choice should be as MS release?
    In [Script Logic BPC MS (SQL) vs. NW (ABAP); Tim Klem states
    - "Write the logic using BPC SQL script logic syntax (not MDX) for performance reasons" but this opinion based on MS version. How about NW release is it really smarter to select SQL Script rather than MDX.
    There is another statement in [Re: BPC 7 NW; Deppak mentions that:
    - "In BPC 5.1 the script formula approach suggests to use SQL based logic instead of MDX.
    Whereas in Teched,08, I learnt that MDX & ABAP (using BADIs) would be used for it. Thats why I am slightly confused...."
    But second statement is far beyond NW relase date and I am sure this is not true but I would like you to confirm that.
    If you were a project responsible and want that all scripts will be held in one language, what would you choose??
    Thanks in advance,
    ergin ozturk

    Hi Ergin,
    I can understand your approach not to use ABAP hence you miss the skills witin your project team.
    However, you (or you client) has chosen the NetWeaver version for whatever reason. I'm sure a thorough decisions process has lead to this decision. In choosing the NetWeaver version with SAP BI you will sooner or later come to the point that you will have to use ABAP if you like it or not. Especially when you start using further capabilities within NetWeaver and the BI solutions. So from my point of view ABAP knowledge is an essential skill you need in a project based on SAP NetWeaver anyway.
    Additionally I heared some statements that MDX is causing some performance issues on the NetWeaver version. This may have been fixed in the meantime with some SPs.
    As the SQL within the NetWeaver verison does not have the full functionality than it has in MS Version SQL is not an option for me.
    I do also not see the cost impact hence someone need to do the support anyway. In case of MDX you need an MDX developer, in case of ABAP and ABAP developer. Or a technical BPC consultant able to do the development (which I would recommend you should have in your project team anyway).
    So coming back to your original question, I would recommend to do as much as possible using ABAP BADIs.
    Cheers,
    Steffen

  • How to read saved data in BPC 7 Nw Script Logic

    Hi all,
       I am trying to write the logic for Price*Quantity Calculation. This logic should be executed whenever user saves the data for either Quantity or Price.
    For this i created a Implementation on BADI "UJ_CUSTOM_LOGIC". But i am struck on how to read the data from InfoCube ,Like if user saves "Quantity",logic should read "Price" from the cube and calculate the result, Which is equivalent to GET(------) statement in SQL script Logic. Which method should i call to read the saved data in cube.
    Appreciate if someone can help me on this.
    Thanks&Regards,
    Ashok Kumar.

    Hi,
       You can use the LOOKUP instruction like:
    *LOOKUP RATE
    *DIM ENTITY2="DEFAULT"
    *DIM SOURCECURR:INPUTCURRENCY=ENTITY.CURR
    *DIM DESTCURR1:INPUTCURRENCY="USD"
    *DIM DESTCURR2:INPUTCURRENCY="EURO"
    *DIM RATE=ACCOUNT.RATETYPE
    *ENDLOOKUP
    Best regards,
    Mihaela

  • P & L report for current period,YTD and previous YTD

    I am trying to create a P & L report with the columns for current period,YTD and previous YTD,  I have include the measures as the key of columns, which by using period or YTD we can retrieve the current period and YTD column, is there as easy way to get the previous YTD? although I can get it  by using evtim to het every month and calculate the previous YTD.

    resolved, just need to bring both time and measures in the columns

  • Evaluation of SignedData in Script Logic v7.5 SQL

    Hello everyone,
    I'm noticing a problem in script logic at a client trying to upgrade to version 7.5 SQL.  This client has used its logic for around 5 years now through versions 4 and 5 but is now having a problem moving to version 7.5 and using this logic.
    It appears that evaluation of signeddata doesn't work in version 7.5 in SQL.  For example, a statement like:
    *WHEN ACCOUNT
    *IS 1000
    *WHEN SIGNEDDATA
    *IS <>0
    *REC...
    *ENDWHEN
    *ENDWHEN
    *COMMIT
    Doesn't appear to be working.  It's also possible that a reference to the TIMEID property is not working in something like:
    *WHEN ACCONT
    *IS 1000
    *WHEN SIGNEDDATA
    *IS >TIME.TIMEID
    *REC...
    *ENDWHEN
    *ENDWHEN
    *COMMIT
    Does anyone have any experience using SIGNEDDATA references in logic in version 7.5?
    Thank you,
    Grant

    Hello everyone,
    I'm noticing a problem in script logic at a client trying to upgrade to version 7.5 SQL.  This client has used its logic for around 5 years now through versions 4 and 5 but is now having a problem moving to version 7.5 and using this logic.
    It appears that evaluation of signeddata doesn't work in version 7.5 in SQL.  For example, a statement like:
    *WHEN ACCOUNT
    *IS 1000
    *WHEN SIGNEDDATA
    *IS <>0
    *REC...
    *ENDWHEN
    *ENDWHEN
    *COMMIT
    Doesn't appear to be working.  It's also possible that a reference to the TIMEID property is not working in something like:
    *WHEN ACCONT
    *IS 1000
    *WHEN SIGNEDDATA
    *IS >TIME.TIMEID
    *REC...
    *ENDWHEN
    *ENDWHEN
    *COMMIT
    Does anyone have any experience using SIGNEDDATA references in logic in version 7.5?
    Thank you,
    Grant

  • Referring to SQL comment table in Script Logic

    Dear all,
      If i have the following combination of dimensions, i.e. "DimA, DimB and DimC", and they will point to a comment in the comment table in SQL, how do i grab the [Comment] from the comment table to be used in my script logic.
      I was adviced to use *select statement, but i can't seem to get it to work.
      Any help is much appreciated.
    Cheers,
    Lip Chean

    Hi,
    *Select allows you to retrieve a list of elements from a dimension or table and save it in a user-defined variable for later use anywhere else in the logic.
    For example, with this instruction:
    *SELECT(%REPORTING_CURRENCIES%, u201CIDu201D, u201CCURRENCYu201D, u201C[GROUP] = 'REP'u201D)
    In this case, you retrieve the ID of all members in the CURRENCY dimension where the property GROUP has the value REP. Running this example fills the variable %REPORTING_CURRENCIES% with the list of reporting currencies defined in the current application.
    Important information
    xxx The SELECT statement generates a SQL query, and NOT an MDX query. This implies that it can be executed against any SQL table existing in the application set database, and not just against the properties of a dimension in the cube. The prefix "mbr" is automatically added to any name entered in the table parameter. Otherwise, the name of the table is taken as is. If
    you want to select a list of elements from a dimension using an MDX query use *MEMBERSET statement.
    xxx In case any parameter contains embedded commas the entire parameter must be enclosed in an extra set of double quotes.
    xxx 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 logic.
    xxx Statements returning no members do not necessarily cause the validation of the logic to fail. In this case a warning is entered in the validation log.
    xxx These instructions are not specific to a given logic section, but they can be written once anywhere in the logic and used across multiple commit sections.
    Hope this helps.
    Badrish

  • How to calc accumulate rate in a script logic?

    Hi experts,
    We are trying to generate a monthly accumulate rate in a script logic. We have a Unit rate in 12 months and we want UnitAccum rate (like YTD) in the same 12 months
    Finally, we need to use this new rate in a multiplication.
    How can we do it with a script logic? Any idea out there?
    Kind regards
    Albert Mas

    Hi Ethan,
    You are understanding ok
    We are working on SAP BPC NW version 7.0, SP05, and at the moment, it's impossible to update to SP08.
    We have done all the following tests, trying to find some solution, under these conditions (we knew that some tests weren't going to work well, but anyway, we had to try them):
    - always for only one product (*XDIM_MEMBERSET PRODUCT=Product1)
    - UNITS and UNITACCUM are ACCOUNT base members
    - UCostVtaAcumDimFor is an ACCOUNT Formula Base Member ([ACCOUNT].[UNITS],[MEASURES].[FYTD])
    - FYTD is a Measures base member for Fiscal Year To Date (we use it because we want to see as Year to Date (YTD) as Fiscal Year To Date (first month of the year is September and the last one is August) (it works well)) (We have also tested on YTD instead of FYTD, with the same results)
    (1)
    *XDIM_MEMBERSET TIEMPO=2010.FEB
    [ACCOUNT].[#UNITACCUM] = ([ACCOUNT].[UNITS],[MEASURES].[FYTD])
    *COMMIT
    Result: MEASURES not specified. Failed
    (2)
    *XDIM_MEMBERSET TIEMPO=2010.FEB
    *WHEN ACCOUNT
    *IS UNITS
    *REC(EXPRESSION=([ACCOUNT].[UNITS],[MEASURES].[FYTD]), ACCOUNT=UNITACCUM)
    *ENDWHEN
    *COMMIT
    Result: MEASURES not specified. Failed
    (3)
    *XDIM_MEMBERSET TIEMPO=2010.FEB
    *WHEN ACCOUNT
    *IS UNITS
    *REC(ACCOUNT=UNITACCUM,MEASURES=FYTD,FACTOR=1)
    *ENDWHEN
    *COMMIT
    Result: Unknown Dimension Name in Keyword "MEASURES". Failed
    (4)
    *XDIM_MEMBERSET TIEMPO=2010.FEB
    *WHEN ACCOUNT
    *IS UNITS
    *REC(ACCOUNT=UNITACCUM,TIEMPO=TIEMPO.NEXTMONTH,FACTOR=1)
    *ENDWHEN
    *COMMIT
    Result: it takes too much time (more than five minutes) without ending the process --> We stop this test
    (for 2010.FEB, TIEMPO.NEXTMONTH=2010.MAR)
    (5)
    *XDIM_MEMBERSET TIEMPO=2010.FEB
    *WHEN ACCOUNT
    *IS UNITS
    *REC(ACCOUNT=UNITACCUM,TIEMPO=TIEMPO.PREVMONTH,FACTOR=1)
    *ENDWHEN
    *COMMIT
    Result: it takes too much time (more than ten minutes) without ending the process --> We stop this test
    (for 2010.FEB, TIEMPO.PREVMONTH=2010.JAN)
    (6)
    *XDIM_MEMBERSET TIEMPO=2010.FEB
    *WHEN ACCOUNT
    *IS UNITS
    *REC(ACCOUNT=UNITACCUM,FACTOR=1)
    *ENDWHEN
    *COMMIT
    Result: Cancelled
    (7)
    *XDIM_MEMBERSET TIEMPO=2010.FEB
    [ACCOUNT].[#UNITACCUM] = [ACCOUNT].[UCostVtaAcumDimFor]
    *COMMIT
    (UCostVtaAcumDimFor is a Formula Base Member ([ACCOUNT].[UNITS],[MEASURES].[FYTD]))
    Result: Cancelled
    Some more ideas?
    Thanks in advance,
    Albert Mas

  • Reference a value of previous year in a Script Logic

    Hi,
    I need to reference a value of previous year to that I have in a Script Logic.
    I've tried it with "%YEAR% (-1)", but "%YEAR%" refers to the current year and doesn't refer to the year that I have in the Script Logic, that is, if I pass "2006.DEC " to Script Logic, the system returns me in "%YEAR%" the value "2010".
    What syntax should I use?
    Regards,
    Miguel.

    Hi
    The  Damien's suggestion is the correct one for BPC 7.0 NW to get the offset of the passed-in Time's member.
    So you have properties in your Time dimension that store the prior year of current member or the next year of current member or next 2 years of current member and etc.
    Then reference them in you logic something right this
    ID : 2008.JAN
    NEXT: 2009.JAN
    PRIOR: 2007.JAN
    *WHEN TIME
    *IS %TIME_SET%
    *REC(FACTOR=1, TIME=TIME.PRIOR)
    *ENDWHEN
    Additional information,
    %YEAR% in BPC NW reflects the time on the server which is different from the BPC MS.
    BPC 7.5 NW has a better function to handle this: TVML.
    Halomoan

  • *Prior statement in script logic

    Hi,
    I'm getting started with script logic and I'm trying to create a record that will be the result of the current amount in a specific account minus the amount for the same account in the previous period.
    I was thinking to use a "prior" statement, but not really sure how to do that. Do somebody could write me an example that would sbustract my current amount minus the amount from the previous period where the account is the same in a sql logic?
    Thanks
    Martin

    Hi,
    This should do the trick.
    *INCLUDE SYSTEM_CONSTANTS.LGL
    *XDIM_MEMBERSET TIMEDIM=PRIOR,%TIME_SET%
    *XDIM_Member DataSrc=INput
    *WHEN *
    *IS *
    *REC(EXPRESSION=GET(DATASRC="INPUTSAP",TIME=PRIOR)-GET(DATASRC="INPUTSAP"),NOADD,DATASRC="Movement")
    *ENDWHEN
    *commit
    Cheers,
    AvdB
    Edited by: Gert Andries van den Berg on Aug 12, 2009 9:14 AM

  • SAP BPC 5.1 Script Logic Issue

    Hi Guys,
    I have a problem with Inventory Days script logic at the moment. Basically what the logic should do is:
    1. Copy the required data across to a calculation category (SQL)
    2. Calculate the last 12 months Cost of Sales for every entity in the selection for 3 years (MDX)
    3. Use the Cost of Sales number and multiply it with the inventory days number (SQL)
    The calc works fine for some of my smaller brands (200 - 500 entities),  but when i run the logic for my big brand (2000 entities) the last step doesn't calculate correctly. I have done the following to try and fix the problem.
    1. Every step has it's own COMMIT
    2. I clear the data before writing anything
    3. I use XDIM_MAXMEMBERS Entity = 500
    Any ideas why the logic is acting like this? I don't know if I am allowed to post my code here, but if it will help i will
    Regards,
    Andries van den Berg

    Hi,
    I only sent you the step that is giving me a problem at the moment. I broke the logic up into different packages to check where the problem lies and narrowed it down to this one.
    It seems like the code didn't copy across correctly, it is supposed to be when EXTRAP.BRAND "<>" "". I'll just paste the code again, just so that we are all on the same page.
    Regarding the FAC2, the client was running the code a lot of times and the WB table was getting huge. So, i started posting the records to the FAC2 table and processing it in the SSIS package. And i did confirm that they are posting there.
    I just tried to run the script for half of the entities and it didn't work. I then tried to run is for 25 entities and it worked. Could the *XDIM_MaxMembers Entity =  50 be giving me the problem? This is all i get over and over in the formula log:
    RPTCURRENCY,ACCOUNT,CATEGORY,DATASRC,ENTITY,INTCO,TIME,SIGNEDDATA
    LC,80500,BUDGET,INPUT,P71559,NON_INTERCO,2010.AUG, 0
    The other thing that bugs me is that i have similar script that never gives me issues for the same client.
    Regards,
    AvdB
    //Step 4 -- Calculate the Inventory per month for all the entities selected
    *SELECT(%BUDGET_YEAR1%,"[BUDGET_YEAR1]","CATEGORY","[ID]='BUDGET'")
    *SELECT(%BUDGET_TIME_SET1%,"[ID]","TIME","[YEAR]=%BUDGET_YEAR1% AND [CALC] = 'N'")
    *SELECT(%BUDGET_YEAR2%,"[BUDGET_YEAR2]","CATEGORY","[ID]='BUDGET'")
    *SELECT(%BUDGET_TIME_SET2%,"[ID]","TIME","[YEAR]=%BUDGET_YEAR2% AND [CALC] = 'N'")
    *SELECT(%BUDGET_YEAR3%,"[BUDGET_YEAR3]","CATEGORY","[ID]='BUDGET'")
    *SELECT(%BUDGET_TIME_SET3%,"[ID]","TIME","[YEAR]=%BUDGET_YEAR3% AND [CALC] = 'N'")
    *XDIM_Memberset Time = %BUDGET_TIME_SET1%,%BUDGET_TIME_SET2%,%BUDGET_TIME_SET3%
    *XDIM_Memberset Category = TOPDOWN, BUDGET
    *XDIM_Memberset Entity = %Entity_Set%
    *XDIM_MaxMembers Entity =  50
    *XDIM_ADDMemberset ENTITY = CLKS,MUS,BS // Add global entities
    *XDIM_Memberset ACCOUNT = Last12FSCoS,Last12DispCoS, InventoryFSDays, InventoryDispDays  //Add the caculated CoS account from the previous step and the Global Driver for days
    *WHEN ENTITY.EXTRAP_BRAND
    *IS <> ""
    *WHEN CATEGORY
    *IS TOPDOWN
                       *REC(EXPRESSION=(GET(ACCOUNT="Last12FSCoS",CATEGORY="TOPDOWN")*GET(ACCOUNT="InventoryFSDays",ENTITY=ENTITY.EXTRAP_BRAND,CATEGORY="BUDGET")/365)*-1,NOADD,ACCOUNT="80500",CATEGORY="BUDGET")
                       *REC(EXPRESSION=(GET(ACCOUNT="Last12DispCoS",CATEGORY="TOPDOWN")*GET(ACCOUNT="InventoryDispDays",ENTITY=ENTITY.EXTRAP_BRAND,CATEGORY="BUDGET")/365)*-1,NOADD,ACCOUNT="80510",CATEGORY="BUDGET")
    *ENDWHEN
    *ENDWHEN
    *WRITE_TO_FAC2
    *COMMIT

  • Please help me resolve the Lync server 2013 deployment error: "An error occurred while applying SQL script for the feature BackendStore."

    I am getting an error in "Step 2 - Setup or Remove Lync Server Components" of "Install or Update Lync Server System" step.
    "An error occured while applying SQL script for the feature BackendStore. For details, see the log file...."
    Additionally, all previous steps such as: Prepare Active Directory, Prepare first Standard Edition server, Install Administrative Tools, Create and publish topology are done without any errors. The user that I used to setup the Lync server is member of:
    Administrators
    CSAdministrator
    Domain Admins
    Domain Users
    Enterprise Admins
    Group Policy Creator Owners
    RTCComponentUniversalServices
    RTCHSUniversalServices
    RTCUniversalConfigReplicator
    RTCUniversalServerAdmins
    Schema Admins
    I have tried to re-install all the things and started to setup a new one many times but the same error still occurred. Please see the log below and give me any ideas/solutions to tackle this problem.
    ****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.BlobStore'****
    Initializing DbSetupBase
    Parsing parameters...
    Found Parameter: SqlServer Value lync.lctbu.com\rtc.
    Found Parameter: SqlFilePath Value C:\Program Files\Common Files\Microsoft Lync Server 2013\DbSetup.
    Found Parameter: Publisheracct Value LCTBU\RTCHSUniversalServices;RTC Server Local Group;RTC Local Administrators;LCTBU\RTCUniversalServerAdmins.
    Found Parameter: Replicatoracct Value LCTBU\RTCHSUniversalServices;RTC Server Local Group.
    Found Parameter: Consumeracct Value LCTBU\RTCHSUniversalServices;RTC Server Local Group;RTC Local Read-only Administrators;LCTBU\RTCUniversalReadOnlyAdmins.
    Found Parameter: DbPath Value D:\CsData\BackendStore\rtc\DbPath.
    Found Parameter: LogPath Value D:\CsData\BackendStore\rtc\LogPath.
    Found Parameter: Role Value master.
    Trying to connect to Sql Server lync.lctbu.com\rtc. using windows authentication...
    Sql version: Major: 11, Minor: 0, Build 2100.
    Sql version is acceptable.
    Validating parameters...
    DbName rtcxds validated.
    SqlFilePath C:\Program Files\Common Files\Microsoft Lync Server 2013\DbSetup validated.
    DbFileBase rtcxds validated.
    DbPath D:\CsData\BackendStore\rtc\DbPath validated.
    Effective database Path: \\lync.lctbu.com\D$\CsData\BackendStore\rtc\DbPath.
    LogPath D:\CsData\BackendStore\rtc\LogPath validated.
    Effective Log Path: \\lync.lctbu.com\D$\CsData\BackendStore\rtc\LogPath.
    Checking state for database rtcxds.
    Checking state for database rtcxds.
    State of database rtcxds is detached.
    Attaching database rtcxds from Data Path \\lync.lctbu.com\D$\CsData\BackendStore\rtc\DbPath, Log Path \\lync.lctbu.com\D$\CsData\BackendStore\rtc\LogPath.
    The operation failed because of missing file '\\lync.lctbu.com\D$\CsData\BackendStore\rtc\DbPath\rtcxds.mdf'
    Attaching database failed because one of the files not found. The database will be created.
    State of database rtcxds is DbState_DoesNotExist.
    Creating database rtcxds from scratch. Data File Path = D:\CsData\BackendStore\rtc\DbPath, Log File Path= D:\CsData\BackendStore\rtc\LogPath.
    Clean installing database rtcxds.
    Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
    ****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.RtcSharedDatabase'****
    Initializing DbSetupBase
    Parsing parameters...
    Found Parameter: SqlServer Value lync.lctbu.com\rtc.
    Found Parameter: SqlFilePath Value C:\Program Files\Common Files\Microsoft Lync Server 2013\DbSetup.
    Found Parameter: Serveracct Value LCTBU\RTCHSUniversalServices;RTC Server Local Group.
    Found Parameter: DbPath Value D:\CsData\BackendStore\rtc\DbPath.
    Found Parameter: LogPath Value D:\CsData\BackendStore\rtc\LogPath.
    Trying to connect to Sql Server lync.lctbu.com\rtc. using windows authentication...
    Sql version: Major: 11, Minor: 0, Build 2100.
    Sql version is acceptable.
    Validating parameters...
    DbName rtcshared validated.
    SqlFilePath C:\Program Files\Common Files\Microsoft Lync Server 2013\DbSetup validated.
    DbFileBase rtcshared validated.
    DbPath D:\CsData\BackendStore\rtc\DbPath validated.
    Effective database Path: \\lync.lctbu.com\D$\CsData\BackendStore\rtc\DbPath.
    LogPath D:\CsData\BackendStore\rtc\LogPath validated.
    Effective Log Path: \\lync.lctbu.com\D$\CsData\BackendStore\rtc\LogPath.
    Checking state for database rtcshared.
    Reading database version for database rtcshared.
    Database version for database rtcshared - Schema Version5, Sproc Version 0, Update Version 1.
    Thanks and Regards,
    Thanh Le

    Thanks Lạc
    Phạm 2
    I Had similar issue i end up uninstalling and reinstallting but same issue, then i change the drive but same issue. It was I/O issue. After adjusting my I/O it fix our issue and installation went on without any issue. 
    If any one using KVM here is detail article 
    We just  give this option cache=‘writeback
    using this article http://www.ducea.com/2011/07/06/howto-improve-io-performance-for-kvm-guests/ and http://itscblog.tamu.edu/improve-disk-io-performance-in-kvm/ this fix my issue thanks 

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

  • Custom Measure in Script logic

    Hi,
    We have a custom measure created which is more or less the same as the YTD, but it starts not at the beginning of the year, but instead it starts at a given month.
    The measure creation was ok and we can use it perfectly well in reports and input shedules and the cumulation of data is ok.
    However, if we want to use this measure in a script logic it does not work.
    - Validating the script in the admin console goes fine
    - Executing the script gives the error:
             - Root element is missing
    - validating in UJKT gives the erro:
            - UJK_VALIDATION_EXCEPTION:Invalid Measures value: "T_232"
    The script we try to use is below. If we change the LTD (our custom measure) by YTD it works perfectly fine:
    *XDIM_MEMBERSET BUILDSTATE=NABS
    *XDIM_MEMBERSET BUSAREA=V1
    *XDIM_MEMBERSET CATEGORY=FCSTCUR
    *XDIM_MEMBERSET DATASRC=INPUT
    *XDIM_MEMBERSET ENTITY=201
    *XDIM_MEMBERSET MARKSEGM=NAMS
    *XDIM_MEMBERSET ORIGIN=OBOOK
    *XDIM_MEMBERSET PRODUCT=ELEVATORS
    *XDIM_MEMBERSET PROFCENT=201251
    *XDIM_MEMBERSET RPTCURRENCY=LC
    *XDIM_MEMBERSET SALESORG=SO_201
    *XDIM_MEMBERSET TECHPLATF=NATP
    *XDIM_MEMBERSET TIME=2010.OCT
    *XDIM_MEMBERSET TYPE=T_PLAN0
    *XDIM_MEMBERSET NEBACCOUNT =BAS(T_232)
    *XDIM_MEMBERSET MEASURES=PERIODIC
    [NEBACCOUNT].[#A232]=([MEASURES].[LTD],[NEBACCOUNT].[T_232])
    *COMMIT
    Thanks for any input on this. We want to avoid going via a BADI!
    Kind regards,
    Christophe Posson

    Hi Christophe,
    I'm in a similar position to you and wish to avoid use of a BAdI if we can - despite the MDX parser engine being pretty pathetic at handling YTD or custom measures.
    Did you get a resolution to this? If so, could you please share it with everyone?
    As much information as possible would be apprecaited. Our next move is to contact SAP for confirmation that there is no possibility of using custom measures in Script Logic.
    Many thanks,
    Nick

Maybe you are looking for