Script Logic Syntax Help

Hello,
Like for example I have two dimension like P_ACCT ve PRODUCT.
In P_ACCT dimension I have two members like ACCOUNT1 and ACCOUNT2, and in PRODUCT dimension I have a one members called PER_1100.
I want to update PRODUCT.PER_1100 with ACCOUNT1 / ACCOUNT2 * 100 value. 
Example =
ACCOUNT1 = 50
ACCOUNT2 = 200
PRODUCT.PER_1100 = ACCOUNT1 / ACCOUNT2 * 100 = 50 / 200 * 100 = 25
I wrote a script like below but it doesn't work.
*WHEN P_ACCT
*IS ACCOUNT1
    *REC(FACTOR=[P_ACCT].[ACCOUNT2]*0.01,PRODUCT="PER_1100")
*ENDWHEN
*COMMIT
Regards,
Burak

Hello,
I didn't face any problem about this script logic. It works fine. You can use it. I developed this script.
*WHEN P_ACCT
*IS KFNETCIRO
    *WHEN PRODUCT
    *IS TOT_BUD_10
    *REC(EXPRESSION=%VALUE%*0.01*([P_ACCT].[KFORANLAR],[PRODUCT].[NC_1101]),P_ACCT="KFNETCIRO",PRODUCT="1101")
    *REC(EXPRESSION=%VALUE%*0.01*([P_ACCT].[KFORANLAR],[PRODUCT].[NC_1102]),P_ACCT="KFNETCIRO",PRODUCT="1102")
    *REC(EXPRESSION=%VALUE%*0.01*([P_ACCT].[KFORANLAR],[PRODUCT].[NC_1103]),P_ACCT="KFNETCIRO",PRODUCT="1103")
    *REC(EXPRESSION=%VALUE%*0.01*([P_ACCT].[KFORANLAR],[PRODUCT].[NC_1104]),P_ACCT="KFNETCIRO",PRODUCT="1104")
    *REC(EXPRESSION=%VALUE%*0.01*([P_ACCT].[KFORANLAR],[PRODUCT].[NC_1105]),P_ACCT="KFNETCIRO",PRODUCT="1105")
    *REC(EXPRESSION=%VALUE%*0.01*([P_ACCT].[KFORANLAR],[PRODUCT].[NC_1106]),P_ACCT="KFNETCIRO",PRODUCT="1106")
    *REC(EXPRESSION=%VALUE%*0.01*([P_ACCT].[KFORANLAR],[PRODUCT].[NC_1107]),P_ACCT="KFNETCIRO",PRODUCT="1107")
    *REC(EXPRESSION=%VALUE%*0.01*([P_ACCT].[KFORANLAR],[PRODUCT].[NC_1108]),P_ACCT="KFNETCIRO",PRODUCT="1108")
    *REC(EXPRESSION=%VALUE%*0.01*([P_ACCT].[KFORANLAR],[PRODUCT].[NC_1109]),P_ACCT="KFNETCIRO",PRODUCT="1109")
    *REC(EXPRESSION=%VALUE%*0.01*([P_ACCT].[KFORANLAR],[PRODUCT].[NC_9900]),P_ACCT="KFNETCIRO",PRODUCT="9900")
    *ENDWHEN
*ENDWHEN
*COMMIT
[#KFBRUTKAR] = [KFNETCIRO] - [KFSMM]
[#KFURBRKAR] = [KFNETCIRO] - [KFSMM] - [KFISKARTA]
[#KFMAGBRKAR] = [KFNETCIRO] - [KFSMM] - [KFISKARTA] - [KFAMBALAJ]
*COMMIT
I hope it helps to you.
Regards,
Burak

Similar Messages

  • 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

  • Syntax in script logic

    Hi Friends,
    I have input schedule in below format.
    Product   Rate/2011.INP  Packing/2011.INP QTY/2011.APR AMOUNT/2011.APR QTY/2011.MAY AMOUNT/2011.MAY
    PM         3                 3              3               27            4         36
    PN        5            2          2          20     3  30
    Here Amount= Rate*Packing*QTY. Pls correct below script logic and make it generic for all months.
    *XDIMMEMBERSET TIME=2011.APR,2011.MAY,2011.INP
    *XDIMMEMBERSET ACCT=QTY,RATE,PACK,AMOUNT
    *WHEN ACCT
    *IS QTY
    *WHEN TIME
    *IS 2011.APR,2011.MAY,2011.INP
    *REC(EXPRESSION=%VALUE% * ([ACCT].[RATE],[TIME].[2011.INP])
                             * ([ACCT].[PACK],[TIME].[2011.INP]),
                                 [ACCT]=AMOUNT,[TIME].[2011.APR])
    *ENDWHEN
    *ENDWHEN
    *COMMIT
    Thanks,
    Naresh

    Hi,
    You can simply write this using MDX formula,
    [ACCT].[#AMOUNT]=[ACCT].[PACK]*([ACCT].[RATE],[TIME].[2011.INP])*([ACCT].[QTY],[TIME].[2011.INP])
    Run this code with required months from DM package it gets executed for defined time periods.
    Hope this helps,
    Regards,
    G.Vijaya Kumar

  • Help in script logic

    Hi Experts,
    We are using SAP BPC 7.5 NW Version SP08. We are using a script logic that calculates the opening value of inventory(ASSTCAINVAMO) for each month except the 1st month of financial year for which the value is entered from an input schedule. The opening value of inventory of each subsequent months are calculated when the parameters for production(e.g. OSDA) are entered from a separate input schedule. The following script logic is written for the calculation:
    *FOR %TIM_MEM%=%TIME_SET%
    *XDIM_MEMBERSET TIME =%TIM_MEM%
    *WHEN P_ACCT2
    *IS "OSDA",
    REC(EXPRESSION=[P_ACCT2].[ASSTCAINVAMO]+[P_ACCT2].[RDPA][P_ACCT2].[EFFA][P_ACCT2].[OSDA]-[P_ACCT2].[CONVAMUR][P_ACCT2].[RDPU][P_ACCT2].[EFFU][P_ACCT2].[OSDU]-([P_ACCT2].[SALQAMBC]+[P_ACCT2].[SALQAMM]),P_ACCT2="ASSTCAINVAMO",TIME=TIME.NEXT)
    *ENDWHEN
    *COMMIT
    *NEXT
    The loop works fine, but it seems the list of time values are not coming in proper sequence. For example, the loop is running for 2011.NOV before it iterates for 2011.OCT. So when it iterates for 2011.NOV, it is not getting the opening value for the month and consequently 2011.DEC's opening value is calculated assuming 2011.NOV's opening value to be 0. In the input schedule the months are in proper sequence.
    Is there any way out so that the months come in proper sequence in the logic as well?
    Thanks in advance for any help.

    We had similar issue . we changed TIME members from Monthnames to numbers . i.e  changed 2011.JAN to 2011.01 . Then you get correct result  as you are expecting . Issue when using month names in combination of TMVL is that  , instead of getting 2011. MAY for TMVL(1,2011.APR) , it gets 2011.FEB . TMVL function some how takes alphabetical order instead of taking month order . Not sure if this behavior is with service pack . But never saw any thread reporting this issue .
    Anyways ,you can wait for other responses  as i am too curious to know if any one faced this issue and how did they resolve.

  • How can i write this syntax in script logic....

    hi all
    i need to write below syntax in bpc script logic..
    If Headcount = 0, then Salary = 0 Else:
    If Month <> March and Month <> September:
    Salary = Salaryprevious month1 + [(Headcountcurrent month - Headcountprevious month1) * (Band Rate + Band Salary Factor)]
    If Month = March:
    Salary = [Salaryprevious month1 + [(Headcountcurrent month - Headcountprevious month1) * (Band Rate + Band Salary Factor)]  ] * (100% + Band Annual Increase + Band Annual Increase Factor)
    in the above code headcount,salary,bandrate etc all got ids.
    thanks guys

    Hi,
    In your query, when you say that headcount = 0, do you mean the signed data? In this case, it will difficult to do. When you have a signed data as 0 in SQL, once you optimize the application or compress it, that particular record will go and your logic will not work.
    If I look at your logic,
    If Headcount = 0, then Salary = 0 Else:
    If Month March and Month September:
    Salary = Salaryprevious month1 + (Headcountcurrent month - Headcountprevious month1) * (Band Rate + Band Salary Factor)
    If Month = March:
    Salary = [Salaryprevious month1 + (Headcountcurrent month - Headcountprevious month1) * (Band Rate + Band Salary Factor)] * (100% + Band Annual Increase + Band Annual Increase Factor)
    If the application has been compressed or optimized, it will not get any record for that particular headcount and will directly go into the "else" loop. Though, its not correct.
    I hope you got my point.

  • Help in script logic - problem in FOR loop

    Hi Experts,
    We are using BPC 7.5 SP08. I have written a FOR loop in script logic default.lgf which is as follows:
    *FOR %TIM_MEM%=%TIME_SET%
    *XDIM_MEMBERSET TIME =%TIM_MEM%
    *WHEN P_ACCT2
    *IS "OSDU"
    REC(EXPRESSION=[P_ACCT2].[ASSTCAINVURO][P_ACCT2].[COGSUPRVIPSA]/[P_ACCT2].[ASSTUPRVTAQTY],P_ACCT2="COGSUIPSAO")
    *ENDWHEN
    *COMMIT
    *NEXT
    As per my requirement, all this members: [ASSTCAINVURO], [COGSUPRVIPSA], [ASSTUPRVTAQTY] exists for months September to next year's August. But in my input schedule, the months are from August to next year's July(which is the company's fiscal year). Consequently the loop runs for month August to next year's July while I need to run the loop 1 month late(i.e. September to next year's August). This was achieved earlier by hard-coding the time members which we cannot afford as this requires to update these hard-coded member IDs every year.
    We have also tried using the "NEXT" property of TIME dimension as follows:
    *XDIM_MEMBERSET TIME =%TIM_MEM%.NEXT
    but %TIM_MEM%.NEXT doesn't get the month in 'NEXT'.
    Please suggest if there is any way out to solve this problem.
    Thanks in advance.

    Hi Appu,
    Even if you restrict the scope using the XDIM statement, your script will just run the number of times as per the for loop. Actually, in reality, the same calculation is happening again and again, in your code; since your calculation is not based on the time member.
    To use the for loop effectively, you need to incorporate the time member in your calculation.
    Please look at the below sample code:
    *XDIM_MEMBERSET TIME = %TIME_SET%
    *FOR %TIM_MEM%=%TIME_SET%
       *WHEN P_ACCT2
       *IS "OSDU"
          *REC(EXPRESSION=<CALCULATION>,P_ACCT2="COGSUIPSAO")
       *ENDWHEN
    *NEXT
    And in your calculation, you can use statements like
    ([P_ACCT2].[ASSTCAINVURO],TMVL(1, [TIME].[%TIM_MEM%]))
    This will ensure that everytime (as per the for loop), the calculation works on separate set of data.
    Hope you got the idea.

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

  • MEASURES in script logic

    Hi All!
    How can I use YTD measures in script logic? My aplication is PERIODIC ( YTDInput set to No) and I need in my script logic to use YTD values for some calculation. I tried following syntax
    *REC(EXPRESSION=([C_ACCT].[PLM],[MEASURES].[YTD]))
    but after validation error appears
    http://screencast.com/t/q2gChPrqbVXy.
    Please help, how to use measures dim in script logic??
    Regards,
    Justyna

    Full script not it is working fine after change *XDIM_MEMBERSET MEASURES=YTD to *XDIM_MEMBERSET MEASURES=PERIODIC
    *XDIM_MEMBERSET C_ACCT = VALCON_EN020
    *XDIM_MEMBERSET MEASURES=PERIODIC
    *WHEN_REF_DATA = MASTER_DATA
    *WHEN C_ACCT
    *IS VALCON_EN020
    *REC(EXPRESSION=([C_ACCT].[PLM],[MEASURES].[YTD]))
    *ENDWHEN
    *COMMIT

  • Use of Variable in Script Logic

    Dear All,
    We are working on a BPC Script Logic involving depreciation calculation, which calls an implementation of the BAdI BADI_UJ_CUSTOM_LOGIC. We are passing some parameters from the script logic to the BAdI. There are two parameters to be passed: an account number (Account in which the posting will happen), and the rate (rate with which depreciation will be affected). The parameters are stored in the Dimension member of the account dimension and need to be fetched from there. We are using the following piece of code to achieve this:
    *INCLUDE FUNCTIONS.LGF
    [#PERC] = PRO([%ACCOUNT_DIM%].CURRENTMEMBER,DEP_PERCENTAGE)
    [#DEPACCOUNT] = PRO([%ACCOUNT_DIM%].CURRENTMEMBER,DEP_ACCT)
    *START_BADI DEPR
    QUERY = ON
    WRITE = ON
    DEPACCT = [#DEPACCOUNT]
    PERCENTAGE = [#PERC]
    *END_BADI
    Here, FUCNTIONS.LGF contains the PRO function, which fetches the account and percentage properties from the account dimension member. Problem is, when we refer to the temporary variables within our code using the variables [#DEPACCOUNT] and [#PERC], we encounter a short dump for CX_SY_CONVERSION_NO_NUMBER. We suspect that instead of passing the parameter values, the logic is passing the variable name as the value. How do we rectify this? What is the correct syntax for passing such a parameter to the BAdI? Any ideas?
    Thanks in Advance,
    Sid

    Hi Ethan,
    Thanks for the answer. Unfortunately, even after trying out your solution with K2 variables, we are getting the same dump, this time the log says:
    An exception with the type CX_SY_CONVERSION_NO_NUMBER occurred, but was neither handled locally, nor declared in a raising clause
    The argument '%PERC%' cannot be interpreted as a number
    We are starting to think that maybe only substitution variables can be passed as parameter to the BAdI call, because whenever we use a local variable, we end up in passing the variable name to the BAdI, and not the variable value. We digged through the SAP Help, following is the excerpt from there:
    Run the following instruction to call custom ABAP programs: where filter_value_of_your_BADI_implementation is the name of the filter you provided during the BADI implementation of UJ_CUSTOM_LOGIC BADI.
    *START_BADI <filter_value_of_your_BADI_implementation>
    <key1> = <value1>
    <key2> = <value2>
    *END_BADI
    where filter_value_of_your_BADI_implementation is the name of the filter you provided during the BADI implementation of UJ_CUSTOM_LOGIC BADI.
    Does this mean we can only pass <key>:<value> pairs, and not <key>:<variable> pairs? Is there any instance / documentation which points to this (or the contrary)?
    Awaiting answers.
    Thanks and Regards,
    Sid

  • Script logic : determine the content of a variable according to a IF test

    Hello experts,
    I have the following need in a script logic
    determine the content of a variable according to a IF test
    For example I tried :
    *WHEN %ENTITY%
    *IS "CH20","CH30","ES10"
    *SELECT(%ENTITYPBPD%, "[ID]", "ENTITYCC", "[ID] = '%ENTITYCC_SET%_PBPD'")
    *ENDWHEN
    Syntax is correct but I get a query execution error (Error in WHEN/ENDWHEN structure)
    I guess it's because this when don't have any REC instructions.
    In other words, if the user selection at the package prompt step are CH20, CH30 or ES10
    the variable has to be selection_PBPD
    if another member is selected
    the variable has to take other value
    Hope I've made my need clear, and thanks in advance.
    G.

    Hi G,
    Will the *TEST_WHEN() statement work for this case?
    The way that it works is that if the condition evaluates to TRUE, then the subsequent WHEN...ENDWHEN is processed, else it is not.
    Have a look at Page 66 of "How To Use BPC Scripting Logic, Version 1.00, April 21, 2006" (It's a bit old but I use it a lot on our MS7.0 SP9 installation).
    Hope this helps.
    Regards
    Nick

  • Pull script logic

    Hi all,
    need some help on writing the script logic.
    Here's the condition:
    We have 2 applications (apps A with 10 dimension and apps B with 6 dimension)
    I'm trying to write a script logic that run at apps A referring data from apps B. Actually i've tried using *LOOKUP and *XDIM_GETINPUTSET syntax. When checking the debuglogic file, source values are doing fine but somehow I couldn't manage to write them into apps A due to dimension difference (i've tried using *DESTINATION_APP and *ADD_DIM, too).
    Thanks.

    Hi Nilanjan,
    Here's the script logic:
    *LOOKUP APP_B
    *DIM RPTCURRENCY="LC"
    *DIM DATASRC="INPUT"
    *DIM INTCO="NON_INTERCO"
    *DIM CATEGORY="BUDGET"
    *DIM SUBACCOUNT="NON_SUBACCOUNT"
    *DIM AAA:ACCOUNT="LCS"
    *ENDLOOKUP
    *XDIM_MEMBERSET ACCOUNT = LCS
    *XDIM_MEMBERSET TIME = 2010.JAN
    *DESTINATION_APP = APP_A
    *ADD_DIM= NON_DIM7,NON_DIM8,NON_DIM9,NON_DIM10
    *WHEN TIME
    *IS 2010.JAN
         *WHEN ACCOUNT
         *IS "LCS"
              *REC(EXPRESSION=LOOKUP(AAA),ACCOUNT="LCS",DIM7="NON_DIM7",DIM8="NON_DIM8",DIM9="NON_DIM9",DIM10="NON_DIM10")
         *ENDWHEN
    *ENDWHEN
    *COMMIT
    I add the *DESTINATION_APP and *ADD_DIM because when running the logic debugger without them it only shows "No record to process".
    I've managed to find the workaround using *RUNLOGIC now.
    Thanks again for your attention.

  • Error Script Logic FXTrans

    Hi All,
    Under script logic section under my application, I have maintain
    *RUN_STORED_PROCEDURE=SPRUNCONVERSION('%APP%','%CATEGORY_SET%','','GLOBAL','%SCOPETABLE%','%LOGTABLE%')
    and added below it the following
    *INCLUDE SYSTEM_CONSTANTS.LGL
    *INCLUDE SYSTEM_LIBRARY.LGL
    *SYSLIB MULTICURRENCYTRANS.LGF
    I receive the following error, " Application: FINANCE
    Logic file: FXTrans.LGF
    Validation status of executable file: Failed
    - missing file:D:\PC_MS\DATA\WebFolders\BSB\AdminApp\FINANCE\SYSTEM_LIBRARY.LGL
    Validation status of syntax: Failed
    - Invalid syntax found; see statements in red"
    The Red ones are
    - SYSTEM_LIBRARY.LGL
    - MULTICURRENCYTRANS.LGF
    Could anyone advise me how do go about on this
    Thanks
    Zan

    Hi,
    I'd like to clarify first that SPRUNCONVERNSION and MULTICURRENCYTRANS.LGL do the same thing using different methods. The first requires you to maintain appropriate business rule table called Currency Conversion and the latter is Script Logic-based functinality. Typically you do not need to maintain bot as SPRUNCONVERSION is pretty robust and should fulfil all your needs unless you have to do some truly exotic variation of the business calculation.
    So to conclude you probably only need the following in your script logic:
    *RUN_STORED_PROCEDURE=SPRUNCONVERSION('%APP%','%CATEGORY_SET%','','GLOBAL','%SCOPETABLE%','%LOGTABLE%')
    *COMMIT
    and also maintain rates in the rate application. Please refer to user guide section Business Rule Management for further details: [http://help.sap.com/saphelp_bpc75/helpdata/en/b1/f5839e6ba74a22aa4ce9470179c854/content.htm]
    In order to use script logic you will need to write the logic yourself or to use the one supplied with the system (in the SYSTEM_LIBRARY).
    The logic library is stored in the file on the server %APPSET%\System Library\Logic Library\SYSTEM_LIBRARY.LGL
    IN your script logic you need to include the library to use in your logic:
    *SYSLIB SYSTEM_LIBRARY.LGL (SYSLIB tells the system to look at the specific place in the appset folder and LGL is the extension for appset-level logic files)
    After this you need to call appropriate subprogram from that library and pass some parameters to it:
    RunFX(%APP%,%CATERGORY_SET%)
    *COMMIT
    for example.
    Hope this helps,
    Madis

  • Script Logic - Scoping Statement Challenge

    Dear Friends,
    I have a requirement where I need to write a script logic to calculate the net of all Balance Sheet accounts which are under a Hierarchy node (say: BALANCESHEET) and post the reversal to another Account (say: 9999999) which is also located under the hierarchy node: BALANCESHEET
    Now the tricky bit is to exlcude the posting account (9999999) when I am reading the Accounts under the hierarchy node: BALANCESHEET.
    Anyone knows how to do it ?
    Below is my code which only works when the Account: 9999999 is located outside of the hier node: BALANCESHEET
         *XDIM_MEMBERSET ACCOUNT = BAS(BALANCESHEET)
         *XDIM_MEMBERSET TIME = 2014.APR
         *WHEN TIME
         *IS 2014.APR
         *REC(FACTOR = -1, ACCOUNT=9999999)
         *ENDWHEN
    The scoping statement I wish that would work is:
         *XDIM_MEMBERSET ACCOUNT = BAS(BALANCESHEET), BUT EXCLUDE 9999999
    Appreciate any response on this.
    Thanks,

    Hi Vadim,
    I was hoping you would respond.
    Your code worked like a charm!!
    I never know until now that we could use the below statement prior to *SELECT statement and use that variable within succeeding *SELECT statement.
    *XDIM_MEMBERSET ACCOUNT AS %ACCT% = BAS(BALANCESHEET)
    Because before I tried below with no luck but never knew about above statement.
    *SELECT(%ALLBSEXIMBAL%,"[ID]",GL_ACCOUNT,"[ID]=BAS(CBS) AND [ID]<>2199999")
    Even the SAP Help doesn't have the above syntax in their documentation, how did you know about it??
    You are a genius.
    Thanks very much for helping out
    Cheers!

  • Script Logic based on %value% of the Account

    Hi All
    Hope everyone is doing great. This blog has been really helpful.
    Version: BPC NW - 10, sp12
    I have a situation where I am using an account as FLAG01 and based upon the flag value input by the user, I would like the calculation to be executed.
    I have written the basic algorithm which I am looking forward to resolve:
    When FLAG01 = 0
         Do Nothing
    When FLAG01 = 1
           [ACCOUNT].[B] = [ACCOUNT].[A] * (-1)          and goes into ENTITY = "US_ELIM"
    When FLAG01 = 2
           [ACCOUNT].[B] = [ACCOUNT].[A] * (-1)          and goes into ENTITY = "NA_ELIM"
    I have written the script logic, but guess missing the syntax somewhere.
    eg:
    *WHEN "FLAG01"
    *REC(EXPRESSION = %VALUE% = 1 ? ((-1)*([ACCOUNT].[A]), 0 , ACCOUNT = "B", P_ENTITY = "US_ELIM")
    *REC(EXPRESSION = %VALUE% = 2 ? ((-1)*([ACCOUNT].[A]), 0 , ACCOUNT = "B", P_ENTITY = "NA_ELIM")
    *ENDWHEN
    Any insights are appreciated.
    Thanks
    AJ

    Worked like a charm, just had to make minor tweaks based upon details to test it and it worked.
    *WHEN ACCOUNT
    *IS EL05
    *REC(EXPRESSION = ([ACCOUNT].[EL05])==1? (-1)*([ACCOUNT].[FN-COS.1.4.1]):0, ACCOUNT = "FN-REV.1.1.3.5", P_ENTITY = "A")
    *REC(EXPRESSION = ([ACCOUNT].[EL05])==2? (-1)*([ACCOUNT].[FN-COS.1.4.1]):0, ACCOUNT = "FN-REV.1.1.3.5", P_ENTITY = "B")
    *ENDWHEN
    Really glad how the results came out in 3-4 hit and trials.
    Thanks Vadim, appreciate your help on this.
    Thanks to all who helped.
    Regards
    AJ

  • Script Logic: Using a property in MDX *REC statement (BPC NW)

    Hi,
    Is it possible to use a Property in an MDX statement without using  *LOOKUP() function? I have script successfully working but it takes 15 minutes to execute and would like to speed it up.
    I understand that [DIMENSION].[MEMBER].Property is not valid syntax, and do not believe NW has any other functions to resolve the issue, except *LOOKUP which takes a long time.
    Specific Example is below:
    I have a piece of script that successfully splits JV Expense by customers. A Profit Share planning driver determines the percentage that each customer is entitled to. Typically this will be 100%, but could be 50% between two customers.
    The PROFIT SHARE planning drivers records, and PARTNER_INCOME transactional records are below:
    ACCOUNT
    ENTITY
    PARTNER
    SIGNED DATA
    PROFIT_SHARE
    UK_001
    PARTNER_A
    0.5
    PROFIT_SHARE
    UK_001
    PARTNER_B
    0.5
    PROFIT_SHARE
    UK_002_PLANNING_DRIVERS
    PARTNER_B
    1.00
    PARTNER_INCOME
    UK_001
    NO_PARTNER
    $5,000
    PARTNER_INCOME
    UK_002
    NO_PARTNER
    $5,000
    UK_001 has two partners that are each entitled to 50% of the $5,000 NET PROFIT.
    For UK_002, one one single Partner is entitled to 100% of the $5,000 NET PROFIT.
    Using script logic, you can scope the Profit Share account (PROFIT_SHARE) - , and use a *REC statement to multiply this by the driver. It would look like:
    *XDIM_MEMBERSET ACCOUNT = PROFIT_SHARE
    *WHEN ACCOUNT
    IS *
    *REC (EXPRESSION = %VALUE% * ([ACCOUNT].[PROFIT_SHARE],[PARTNER].[NO_PARTNER]), ACCOUNT = PARTNER_PROFIT_SHARE)
    *ENDWHEN
    This wouldn't be a problem if the Planning Driver is always stored on the same Entity that the Income is stored on, but for UK_002, the planning driver is stored on another Entity - which is stored in a the PLAN_DRIVER_REF property of the entity. It should use UK_002_PLAN_DRIVERS
    ID (Entity)
    PLAN_DRIVER_REF
    UK_001
    UK_002
    UK_002_PLAN_DRIVERS
    UK_002_PLANNING_DRIVERS
    In this scenario, we need to switch out the Entity used in the MDX, however I do not believe you can use a property in MDX - can anyone confirm?
    I have currently implemented the *LOOKUP functionality to loop through, changing each *LOOKUP partner for each loop.
    Lookup:
    *LOOKUP PLANNING_JV_US
    *FOR %LOOP_ASLS% = %ASL_LOOKUP_LOOP_VARIABLE%        
      *DIM LOOK_%LOOP_PARTNERS%:ACCOUNT = "PROFIT_SHARE"
      *DIM LOOK_%LOOP_PARTNERS%:PARTNER= %LOOP_PARTNERS%
    *NEXT
    *DIM ENTITY = ENTITY.PLAN_DRIVER_REF                   //   Use PLAN_DRIVER_REF Property of Entity
    *ENDLOOKUP
    Scope and *REC:
    *XDIM_MEMBERSET ACCOUNT = PROFIT_SHARE
    *WHEN ACCOUNT
    IS *
    *FOR %LOOP_PARTNERS% = %PARTNER_LOOKUP_LOOP_VARIABLE%      // 1000 Partners
    *REC(EXPRESSION = %VALUE% * LOOKUP(LOOK_%LOOP_PARTNERS%), PARTNER= %LOOP_PARTNERS%, ACCOUNT = TCOJVSHAR_CALC, AUDIT_ID = PP_EXPENSE_BY_PARTNER)
    *NEXT
    *ENDWHEN
    The problem with the above, is that because the Lookup is being generated for every single Partner, there are significant numbers of loops.
    Does anyone know of another way this can be implemented in Script Logic? Otherwise we'll need to explore BAdI route.
    Thanks,
    Nick

    Hi Nick,
    Use property in LOOKUP - will dramatically speed up the calculation without FOR/NEXT.
    Vadim

Maybe you are looking for

  • JspSmartUpload Copy and Paste HTML ' and " null Error

    I have this trouble with SmartUpload... my system has no problem with inputtin text information manually with the ' or " character, but if i copy and paste some text from a website page with the ' or " characters, the SmartUpload will prompt with the

  • Interview related Question to Reports

    Hi Friends, I am pleased with the respone John got for Forms. So i decided to share the questions i faced in the interviews in reports 6i. Q. Order in which reports trigger executed? A. 1.Before Report 2.Before Parameter Form 3.After Parameter Form 4

  • Multi vlaued attribute in IDM Schema Configuration

    The IdM docs - states Optionally, an IDMAttributeConfiguration can specify whether the attribute is multivalued, and can provide a display name (currently not used), and a description.http://docs.sun.com/source/820-2961/A_edit_configObjects.html#wp19

  • Transfer ownership of iPad

    My husband purchased an iPad 2. I will now have his original iPad. Is it all right to simply Erase All Content and Settings under the Reset option in the Settings on the iPad, so that I can connect it to my iTunes account (on a separate computer) and

  • Where do we assign ITEM CATEGORY USAGE to a material?

    Hi all,   I have understood the calculation of ITEM CATEGORY based upon ITEM CATEGORY USAGE and three values. Can someody tell me where do we link this ITEM CATEGORY USAGE and the Material? Where do we assign this ITEM CATEGORY USAGE to a Material? T