Using Attribute views in Script based Calculation views

I am trying to create a view for analysis on a fact table which has measure name as a dimension as opposed to having multiple measures. Here is an example of what the data looks like.
#Customer, Product, Measure, Data
Customer1, Product1, ASP, 4.2
Customer1, Product1, Units, 100
Customer2, Product2, ASP, 4.4
Customer2, Product2, Units, 200
... and so on and so forth.
I had build Attribute views with hierarchies for both customer and product dimensions and build analytic views. However now I have the need to flatten the Measures dimension and have the resulting Fact view look like:
#Customer, Product, ASP, Units
Customer1, Product1, 4.2, 100
Customer2, Product2, 4.4, 200
... and so on and so forth.
Now I want to build analytic views on this flattened view of my Fact table.
I was able to create a calculation view using Script mode, on the fact table and write a SQL to flatten the Measure dimension. But I am not able to now join this calculation view with the attribute views. Is there a way to leverage the existing Attribute views and their hierarchies in this case?
The only way I can see for now is to use manual SQL to build out the entire view, including joining the attribute views and re-build the hierarchies in the definition of the calculation view. This essentially wastes work I have already done in the attribute views and forces me to build the entire thing using SQL.
Is there a better approach?

It's extremely annoying that the FLD() command isn't yet availlable in NW, unless it's coming with 7.5 or has been included in one of the more recent support packs.
As a an alternative you may be able to use the following MDX routine:
Returns the value of a property of the current member of a dimension
*function PRO(%DIMENSIONNAME%,%PROPERTYNAME%)
%DIMENSIONNAME%.Properties("%PROPERTYNAME%")
*endfunction
Unfortunately I've never been able to use this with a When statement, so you may have to ask an ABAP resource to develop a BADI to achieve your required results.

Similar Messages

  • Out of memory Error while querying SQL Script based Calculation View

    Hi All,
    I wanted to test the performance of Graphical and SQL Script based Calculation views.
    Created Graphical (CA_GRPH) and SQL Script (CA_SQL) Calculation views.
    Analytic View (AN_GRPH) for both Calculation views are the same which is Graphical based (90 Attributes and 5 Measures)
    In Analytic View data foundation I have a Fact table which has 1.5 Billion records and 9 Dimension Tables –collectively 500 million records (7 Attribute Views). 9 Referential joins with cardinality N:1 and 1 Referential join with cardinality N:N.
    I wanted to keep (CA_GRPH) and (CA_SQL) as a base Calculation views and leverage those to create various calculation views (Will be creating different Calc views for respective Business segments)
    In order to test this I have created below calc views on top of base calc views.
    Graphical Based: Created (CA_GRAPH_XYZ) by having CA_GRPH in projection with 30 Calculated Columns. – This retrieves data in 13 secs
    SQL Script Based: Created (CA_GRPH_ABC) by having CA_SQL in projection view with 30 calculated columns – This errors out after 1.50 mins.
    Could not execute 'SELECT "COLUMN_A","COLUMN _B"," COLUMN _C"," COLUMN _D", SUM("COLUMN _REVENUE") AS ...' in 1:50.480 minutes .
    SAP DBTech JDBC: [2048]: column store error:  [2048] column store error: search table error: [1000002] Error executing physical plan: exception 1000002:
    ltt/impl/memory.cpp:63
    Out of memory ; $size$=1507711; $name$=ihm; $type$=pool; $inuse_count$=170104; $allocated_size$=219215007925
    exception 1000002:
    Any suggestion / help in fixing this issue will be greatly appreciated.
    Regards,
    Av

    Hi Raj,
    Thanks for your time, please find edited snap hot of Analytic View (AN_GRPH) below,
    Calculation view(CA_SQL)
            /********* Begin Procedure Script ************/
    BEGIN
           var_out =
         SELECT
                "COLUMN_1"
                "COLUMN_2",
                "COLUMN_84",
                "COLUMN_85;",
                SUM("REVN") AS "REVN",
                SUM("MGN") AS "MGN",
                SUM("ORD_QTY") AS "ORD_QTY",
                SUM("SYS_QTY1") AS "SYS_QTY1",
                SUM("SYS_QTY") AS "SYS_QTY"
    FROM
          "_SYS_BIC"."XYZ/AN_GRPH"
    GROUP BY
                "COLUMN_1"
                "COLUMN_2",
                "COLUMN_84",
                "COLUMN_85";
    END
    /********* End Procedure Script ************/
    Later i have built one more Calculation view(CA_GRPH_ABC) using (CA_SQL)in projection. i have 30 calculated measures in this final calc view. this final calc view is throwing above mentioned error.
    Not sure if i can use SQL script based calc view in graphical based calc views?
    Regards,
    AV

  • Call a Graphical Calc view with input Parameters from a Script Based Calc View

    Hi All.
    I am trying to call a graphical calculation view with input parameters from a script based calculation view as below but getting syntax error:
    SESSION_SAMPLE = SELECT SESSION_CREATE_DATE,SHA256,CA_MEASURE
                                 FROM "_SYS_BIC"."WILDFIRE/CV_SESSION_SAMPLE"
                                 WITH PARAMETERS  ('PLACEHOLDER' = ('$$IP_START_DATE$$',:START_DATE),
                                     'PLACEHOLDER' = ('$$IP_END_DATE$$',:END_DATE));
    START_DATE  and END_DATE are input parameters of the script based calculation view.
    Can anyone please help me with the correct syntax for accomplishing this?
    Thanks,
    Goutham

    Hi Gautham,
    One more option  what i would like you to try is the below option , here i have just changed the order of passing nothing else.
    SESSION_SAMPLE = SELECT SESSION_CREATE_DATE,SHA256,CA_MEASURE
                                 FROM "_SYS_BIC"."WILDFIRE/CV_SESSION_SAMPLE"
                                   ('PLACEHOLDER' = ('$$IP_END_DATE$$','$$END_DATE$$'),
                                  'PLACEHOLDER' = ('$$IP_START_DATE$$','$$START_DATE$$'))
    Regards,
    Vinoth

  • Underlying SQL or SQL Script for Calculated Views Create Graphically

    Hello,
    Is it possible to view the SQL or SQL script generated for calculated views that are created graphically?

    Hi Mike,
    For your calculation view you will find the corresponding column view created in schema '_SYS_BIC'-->Column Tables->
    <packagename>/<Calculation view> --> Open Definition of this and check the 'create statement'.
    Note: This is a information modeler generated SQL script which will show the generated Calculation Scenario and the respective Column View.
    Regards, Rahul
    Seems the answer was already given by Murali while I typed
    Edited by: Rahul Pant on Mar 2, 2012 5:22 AM

  • Calculation view with input parameters

    Hello there.
    I got a calculation with that expects 2 input parameters.
    But now I have to created another calculation view that import this calculation view.
    How can I pass these 2 parameters using sqlscript?
      My script so far
      cv1 = CE_CALC_VIEW("_SYS_BIC"."calc_1",["CR"],'"COMPANY"=''7000''');
    I must pass 2 parameters in this  "_SYS_BIC"."calc_1" table

    Hi Tiago,
    as I am aware, you cannot pass input parameters to CE function.
    You can try using regular SQL syntax:
    SELECT "CR" FROM "_SYS_BIC"."calc_1"
    WHERE "COMPANY" = 7000
    (PLACEHOLDER."$$PARAM_1$$" => VALUE_1,
    PLACEHOLDER."$$PARAM_2$$" => VALUE_2)

  • Is there any way to revert back to the old Active X based Datasheet view?

    Hello,
    Is there a setting I can check to use the old Active X based Datasheet view from 2010? If not, then is there a way to have the new 2013 Datasheet view display more than 30 items per line? I clicked display all in the view settings and it displays 30
    items and gives me a little arrow at the bottom to get to the next set of 30. My list has close to 800 items and I want to edit them on one page without having to scroll to other pages. Its more user friendly that way

    > use the old Active X based Datasheet view from 2010
    No way I know of.
    But you can edit the view and set the item limit to a large number. One of my lists has 672 items and I can display them all in a single Quick Edit view.
    Mike Smith TechTrainingNotes.blogspot.com
    Books:
    SharePoint 2007 2010 Customization for the Site Owner,
    SharePoint 2010 Security for the Site Owner

  • Passing mandatory parameter within several calculation view

    Hi, I have syntax error when I try to pass parameter between several calculation view; let say:
    Calculation view A: has mandatory parameter called company;
    and
    Calculation view B: has mandatory parameter called company;
    What I want to achieve is to passing parameter from user from Calculation view B and then within Calculation view B, I called Calculation view A with user inputted parameter.
    I have try similar like this, but giving me error:
    var_out = SELECT ...
               FROM :CA_A a,
              "_SYS_BIC"."package-testing/CA_B" ('PLACEHOLDER' = ('$$COMPANY$$', COMPANY)) b
    SQL: sql syntax error: incorrect syntax near "COMPANY": line ...
    NB: COMPANY is mandatory parameter inside Calculated view B

    Got it.
    Actually, passing the parameters from one CA to the other should be the easiest part.
    Just do something like:
    lt_a = SELECT * FROM "_SYS_BIC"."package/CA_A" ( 'PLACEHOLDER' = ('$$COMPANY$$', :COMPANY) );
    Where "COMPANY" is the input parameter's name within both views.
    Basically, within the calc view's code, just use colon & the parameter's name to refer to the paramete, similar to how you do with a logical table (e.g. :lt_a in the aforementioned case). It would also be the same to refer to a parameter within a procedure.
    From your original code, the only difference is the colon you forgot before "COMPANY" parameter reference.
    Within CA_A's own code, it should be the same to refer to the parameter within the code (i.e. :IP_COMP in the above case).
    How to achieve what you're trying to is another story. But if you want help with the SQL itself, I'd ask it in another discussion thread.

  • Syntax error while creating Calculation view script based

    Hi Folks,
    I'm creating Calc view based on script and drafted a simple code but I'm getting syntax error.
    Its just fetching few coloumns from two tables products and purchaseorderitem.
    /********* Begin Procedure Script ************/
    BEGIN
      var_out = select productid , category, nameid, currency, grossamount, quantity
      FROM sap.hana.democontent.epm.data.products AS P , sap.hana.democontent.epm.data.purchaseorderitem AS B
      where P.productid = B.productid;
    END /********* End Procedure Script ************/
    Could you pls take a look and let me know what wrong I'm doing?
    Error logs are:-
    sap.hana..package.project.folder.mytest.CALCSCRIPTVIEWInternal deployment of object failed;Repository: Encountered an error in repository runtime extension;Internal Error:Deploy Calculation View: SQL: sql syntax error: incorrect syntax near "democontent": line 5 col 18 (at pos 439)nSet Schema DDL statement: set schema "SYSTEM"nType DDL: create type "_SYS_BIC"."sap.hana..package.project.folder.mytest/CALCSCRIPTVIEW/proc/tabletype/VAR_OUT" as table ("PRODUCTID" NVARCHAR(10), "CATEGORY" NVARCHAR(2), "NAMEID" NVARCHAR(10), "CURRENCY" NVARCHAR(5), "GROSSAMOUNT" DECIMAL(15,2), "QUANITYT" DECIMAL(13,3))nProcedure DDL: create procedure "_SYS_BIC"."sap.hana.package.project.folder.mytest/CALCSCRIPTVIEW/proc" ( OUT var_out "_SYS_BIC"."sap.hana.package.project.folder.mytest/CALCSCRIPTVIEW/proc/tabletype/VAR_OUT" ) language sqlscript sql security definer reads sql data as n /********* Begin Procedure Script ************/ n BEGIN n t var_out = select productid , category, nameid, currency, grossamount, quantityn t FROM sap.hana.democontent.epm.data.products AS P , sap.hana.democontent.epm.data.purchaseorderitem AS Bn t where P.productid = B.productid;nnEND /********* End Procedure Script ************/n

    Hi Rubane,
    I don't have EPM installed here but based on this Table User Defined Functions( Table UDF ) in HANA  you are not properly defining the source table.
    In your case missing 1) schema of EPM, 2) not using double quotes, 3) separation of package and view, 4) missing camel case on purchaseOrderItem:
    FROM sap.hana.democontent.epm.data.products AS P , sap.hana.democontent.epm.data.purchaseorderitem AS B
    On blog:
    from "SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::businessPartner" as a
    SAP_HANA_EPM_DEMO is the schema
    sap.hana.democontent.epm.data is the package
    businessPartner is the view
    Start simple... before the seletion try it out on Studio SQL.
    Regards, Fernando Da Rós

  • Writing an sql script to query a calculation view  and an attribute view inside a calculation view

    Hi,
    I was trying to query a calculation view with sql , and as one of the input parameters i was trying to give a query over an attribute view
    So my sql will look like this
    SELECT * FROM "MyApp.calculation_views::GET_CHECKLIST_FOR_ACCOUNT"('PLACEHOLDER' = ('$$ACCOUNT_ID$$', '1','$$CHECKLIST_ID$$',' SELECT CHECKLIST_ID FROM "MyApp"."CHECKLIST_PRODUCTS" WHERE PRODUCT_ID = 5'));
    So as an input to $$CHECKLIST_ID$$   i wanted to give an id selected from checklist products table where products id is passed as an input
    but this is not working, i am getting syntax error at the $$CHECKLIST_ID$$ there i can only pass values like  $$CHECKLIST_ID$$, '1'
    Please help me to figure out which  is the correct syntax  i tried putting the sql statement to get the checklist_id in '' but it too didnot work

    I'm not sure you'll be able to do a SELECT subquery directly in the placeholder definition, but you can create another calc view (scripted) as a wrapper to your original calc view and use a scalar variable to pass the parameter over.
    Try this as the base code for your second calc view:
    var_id VARCHAR(10);
    BEGIN
         SELECT CHECKLIST_ID INTO :var_id FROM "MyApp"."CHECKLIST_PRODUCTS" WHERE PRODUCT_ID = 5;
         var_out = SELECT * FROM "MyApp.calculation_views::GET_CHECKLIST_FOR_ACCOUNT"
              (PLACEHOLDER."$$ACOUNT_ID" => 1, PLACEHOLDER."$$CHECKLIST_ID$$" => :var_id);
    END
    You could even create input parameters in the second Calc View for the Account Id & Product Id (which are currently hard coded in your code below).
    Best,
    Henrique.
    PS: avoid using SELECT * for the var_out in the scripted calc view. It's better, from a code maintenance perspective, to explicitly define the columns you're outputting.

  • Errow with IF statement in Scripted Calculation view

    Hi Team,
    I am trying to use IF statement in Scripted Calculation view.
    My scenario is:-
    I need to create a restricted Key figure based on input date from user.
    While i am activating my view system gives "Internal deployment of object failed;Repository: Encountered an error in repository runtime extension;Internal Error:Deploy Calculation View: SQL: transaction rolled back by an internal error: Syntax Error for calculated Attribute: line 29 col 9 (at pos 1501)" error.
    Below is the code i have used in my CV.
    CE_CALC('IF((to_int("BUDAT") >= to_int(2013-01-01),"AMOUNT",'''')', DECIMAL(13,2)) AS "DTR"
    Here, "AMOUNT" is another calculated field created using CE_CALC.
    Without above IF statement my CV runs perfectly fine. The moment i include IF statement it does not activate.
    Kindly provide your inputs.
    Thanks & Regards,
    Anup

    Hi Lars,
    I am extremely sorry about the confusion.
    There was an extra parenthesis in the IF statement which was not allowing the CV to be activated. CV is now successfully activated.
    But my data is not getting restricted correctly.
    It is showing 0 against all the records.
    Below is the sql used for calling the CV.
    SELECT * FROM "_SYS_BIC"."A_123/CV_SCR_BSID_BSAD_ITEMS" ('PLACEHOLDER' = ('$$Currency$$', '''Local'''),'PLACEHOLDER' = ('$$Date_From$$','2014-01-01' ), 'PLACEHOLDER' = ('$$Date_To$$','2014-06-30' ));
    Below is my updated CE_CALC function :-
    CE_CALC('IF(date("BUDAT") >= date(:Date_From) and date("BUDAT") <= date(:Date_To),"AMOUNT",0)', DECIMAL(13,2)) AS "DTR"
    Is there any issue while passing values here?
    Regards,
    Anup

  • Calculation View computing 1 million net present values using BFL procedure

    Hi,
    i have around 1 Million financial positions in a position table and for each of them i want to calculate the net present value using SAP HANA BFL procedure _SYS_AFL.AFLBFL_NETPRESENTVALUE_PROC. The necessary cash flows, interests, etc. (used as input for the BFL procedure reside in a cash flow table
    To make it nice i would like to use a HANA calculation view, which provides the position table together with a calculated field NETPRESENTVALUE
    Now my question: How can i do this the fastest way? The challenge i see is, that the BFL procedure allows only the calculation of one net present value result at a time (based on the cash flows of one financial position).
    So i am afraid i have to use
      DECLARE CURSOR l_position_cursor ...
        FOR l_position_row as l_position_cursor DO
             CALL _SYS_AFL.AFLBFL_NETPRESENTVALUE_PROC ...;
        END FOR;
    Do you have any better / more performant ideas?
    Thanks for any idea,
    Gunther

    Does the ext directory have the php_oci8.dll? In the original steps the PHP dir is renamed. In the given php.in the extension_dir looks like it has been updated correctly. Since PHP distributes php_oci8.dll by default I reckon there would be a very good chance that the problem was somewhere else. Since this is an old thread I don't think we'll get much value from speculation.
    -- cj

  • Using K Means in a Calculation View

    Hi Experts,
    Can you please help me with the below scenario.
    I am trying to use K-Means function to perform clustering on customer data. I have the below columns:
    Attributes:
    Customer ID, Home Ownership Status
    Measures:
    Customers Debt to Income Ratio, Annual Income
    1. Is it possible to use multiple attributes given above to perform the clustering as i read that clustering can be only done using measures.
    2. I need to pass the number of clusters dynamically from report to the K-Means function to perform clustering. I tried to use calculation view to get this parameter from user at runtime and pass to the input parameter table of K-Means function. But the problem is, calculation views will not allow any kind of DDL statements like create/drop/insert/delete/update etc.
    3. Further i would like to understand how to use the results of the K-Means clustering delivered via two tables one having clusters, distance and other having clusters and remaining measures to build a scatter chart. How this can be achieved.
    Please help.
    Thanks and Regards,
    M.N.Adinarayanan

    Hello,
    Would you share your dataset maybe I can help.
    Kind regards.

  • Error while creating a BO Universe (using IDT) on top of SAP HANA Calculation View with Input Parameters

    Hi All..
          We are trying to create a Universe (using IDT-Version4.0) on top of the HANA Calculation view. The Calculation view has 4 input parameters, So
    in Universe side we have created the respective prompts. For the creation of derived table we have used the following code
    SELECT *
    FROM "_SYS_BIC"."<schema_name>.<CV_Calculation_View_test>"
    'PLACEHOLDER'=('$$IP_A$$','@Prompt(A)'),
    'PLACEHOLDER'=('$$IP_B$$','@Prompt(B)'),
    'PLACEHOLDER'=('$$IP_C$$','@Prompt(C)'),
    'PLACEHOLDER'=('$$IP_D$$','@Prompt(D)')
    While validating the above code we are getting an error.
    I have attached the snapshot of that error for your reference. Please find the attachment and help me in resolving it.
    Thanks in advance.

    Hello George,
    I don't have any personalization set on the info space. Also I am using mapped Account in BI to connect to HANA. The confusing part is that it is able to validate the infospace with the input parameters and index it. However query does not return any results. I even tried running the same query which explorer sends to HANA in the SQL editor and there too the same results,the query does not return anything. The model does return data when I do a data preview and if accessed from other tools like AAO.
    Also when I use SSO connection to HANA, indexing of the infospace fails. Where can I see the error log?
    Thanks,

  • Use case for showing records in report view BAM based on version number

    Hi,
    I have a use case to update records based on version no. Let say I have a table or data object in BAM called 'Notes'. The Notes dataobject has three fields Id, Version, Description. The Notes data is displayed in a BAM report. I need to just display the latest version of the Notes. Say two records with one with Id as '124' and Version '4' and another with Id as '124' and version as '5'. The record related to version 5 should be dispalyed to user. How will I introduce this check in BAM reports for the latest version?
    Thanks
    Edited by: user5108636 on 28/06/2010 16:47

    That you see you're prints only means that your method outta called. The code creates a new row, but never inserts the row into the rowset. Then you call execute query which loses any connection to the new route which is not part of the rowset.
    First action would never to call insertRow(r1) on the view object.
    If you change data this way, only the model layer knows about it, the ui can't know about this (one of the disadvantages of using plsql or this construct you try). You have to tell the view controller to update it's data to. For this you can execute the iterator in the binding layer and/or ppr the container showing your data.
    Then I don't see any complicated plsql called do I question if a programmatic co is necessary.
    Timo

  • Using Hierarchy in Calculation View

    Hi guys,
    Can any one let me know the importance of Hierachy in the Calculation View.
    I have created a Hierachy with the Hierachy type as Level Hierarchy and have set the elements manually in it.
    I dont see any changes in the resultant data. Preview of data is as such similar to that when i was not using the Hierachy level.
    Can any one guide me in this!!
    Thanks and regards
    Sanjay

    You wil not find any difference in the "Data Preview".
    Tools like Excel or Analysis office will help you to see the difference
    Regards,
    Krishna Tangudu

Maybe you are looking for

  • Can't delete library

    I deleted songs from several playlists without problem. Then I tried to delete songs from several other playlists. I have tried hitting the DELETE button. I have tried hitting EDIT and then DELETE. Nothing works. The DELETE selection is grayed out. I

  • Dreamweaver CS6 won't run on os x 10.6.8

    I ran an upgrade through application manager, restarted my computer and Dreamweaver acts like it is going to open, then hangs on a grey screen. The only option I have is to force quit. Dreamweaver cs 3 is working fine with no problems. For a few mont

  • DS 5.0 ReadOnly Replica Dies unexpectly

    Hi there: I am testing replication between a master and consumer using iplanet DS5.0. However the consumer always die unexpected after a while. The error message from the error log of the consumer server is: [10/Oct/2001:11:38:51 -0400] NSMMReplicati

  • Task initialization thorough serial com port

    I want to initiate a task by passing a string suppose "y" (from serial port) and it should remains active until vi doesn't receive another string suppose "n". Please tell me how can I do it? Attachments: smplserl.llb ‏29 KB

  • Form server not respond

    Hi, I just installed Oracle Application 11.5.10.2 with database 9.2.0.4. The I migrated database to 10.2. Initially I could log in and every thing seemed fine. But after I ran adautocfg.sh, I got some problems and couldn't login. After I fixed some p