Query on CDS Views and AMDPs

Hello,
I have few basic questions on CDS views and AMDPs:
1. How do we identify the potential candidates in existing code where CDS views or AMDPs can/should be used for code-push down? Are there any recommendations?
2. Should CDS views or AMDPs be used only for cases where we have data intensive calculations or they can be used as alternative to performance optimization techniques like to replace scenarios where multiple SELECTs or JOINs are used etc.?
3. A CDS view internally can also contains a SELECT statement with JOINs. How does this help improve performance? I can just write the same SELECT in a CDS view and it will improve performance because the processing is at DB level? Is that a valid argument?
Best Regards,
Mohit

Dear Mohit,
as mentioned by Thomas: "There is no difference in performance between Open SQL and CDS views". The decision whether you want to use a CDS views instead of Open SQL is mainly based upon the question how you want to structure your coding. For instance, if a specific select appears multiple times in your coding you may decide to wrap it into a class-method and then call this class-method instead. Then in your coding there would be only a single instance of this select. Another option would be to wrap this select into a CDS-view and then select from this view instead of calling the class-method. The single instance of your select would then be stored in the CDS-view. If it comes to testing the view might have some additional advantages, e.g. you may use SE16 to browse its data. All this is not related to performance.
Regards, Christian

Similar Messages

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

  • Query on Materialized view and materialized view log

    I am creating a materialized view something like this.but getting following error:
    ERROR at line 1:
    ORA-12032: cannot use rowid column from materialized view log on "SCOTT"."EMP"
    SQL> create snapshot log on scott.emp;
    Materialized view log created.
    SQL> create materialized view scott_emp refresh fast on demand as select deptno,sum(sal) sum_sal from scott.emp group by deptno;
    ERROR at line 1:
    ORA-12032: cannot use rowid column from materialized view log on "SCOTT"."EMP"
    Note when i have my query in materialized view as "select * from emp;" in place of
    "select deptno,sum(sal) sum_sal from scott.emp group by deptno;" This code works fine.
    How do i have a materialized with with a group by clause.
    Thanks in Advance

    Got the answer myself.
    I wasnt adding all the required columns.
    CREATE MATERIALIZED VIEW LOG ON scott.emp
    WITH SEQUENCE, ROWID (<all the required columns>)
    INCLUDING NEW VALUES;
    Anyways,
    Thanks guys...

  • Posted a query got 296 views and no help :(

    reposting.... and praying for help/guidance/anything....
    Hi All,
    In the process of moving and BT Wholesale checker has now told me from ETA of Sept 30th to "At this time we cant provide a delivery date for this cabinet.."  for my new house (which is about 1 mile away but obviously a different cab)
    Checking Where and When website I get "UR" which means cabinet is "Under Review"
    As [email protected] doesnt work/exist anymore (?) I tried the fall back of roadworks.org and got this for what "appears" to be my local cabinet but I have no idea if it is "cabinet 40") or not :
    "Description : Replace 1 jointbox frame and cover(s) (915mm x 445mm) in Footway"  for Oct 1st - Oct 3rd
    Does anyone know if this is potential related ? ie. a good sign infinity is coming or standard maintence?
    Can anyone help with what else I can do to progress finding out what the UR is all about? General Slippage? Planning permisson? etc.
    Postcode is SM6 8BT
    All help is greatly appericated,
    frank.
    ps. output from checker :
    Solved!
    Go to Solution.

    from the checker results it does not appear your cabinet is included in the current openreach rollout - no FTTC.  you can try BDUK website
    if under review that could mean considering is it viable or is there a power supply or planning permission.
    the roudas sound like openreach are replacing the shell of the existing cabinet
    If you like a post, or want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side of the post.
    If someone answers your question correctly please let other members know by clicking on ’Mark as Accepted Solution’.

  • Questions on CDS Views with input parameters

    Dear Experts,
    1. Can we call a CDS View (or generated database view) with input parameters inside an AMDP? I am looking for something similar to the feature in HANA where we can consume calculation view with filters inside SQL Script?
    2. I understand we can next CDS Views, but how we can next (call) a CDS View with input parameters inside another CDS View?
    Thanks,
    Giri

    Hi Thomas,
    I get the below error that the CDS View's generated table function cannot take field from AMDP.
    I have a requirement to query the CDS View using 2 timestamps (start & end). So, in AMDP I have used the TIME_STAMP and try to pass it to the CDS View
    View code:
    define view Z_Ngi_Cag_A
    with parameters start_ts:abap.dec( 15, 0 ) , end_ts:abap.dec( 15, 0 )
    as select from table {
    resource_key
    where
    (begtstmp > $parameters.start_ts or endtstmp > $parameters.start_ts )
    and
    (begtstmp < $parameters.end_ts or endtstmp < $parameters.end_ts )
    I am calling using the below AMDP:
    DECLARE iv_start_date TIMESTAMP;
    DECLARE iv_end_date TIMESTAMP;
    SELECT CURRENT_TIMESTAMP INTO iv_start_date from dummy;
    SELECT ADD_DAYS(CURRENT_TIMESTAMP, 30) INTO iv_end_date from dummy;
    et_data =      SELECT * FROM ZMR_H_CA ( start_ts => iv_start_date, end_ts =>  iv_end_date );
    What could be wrong ? Is this not supported?
    Thanks,
    Giri

  • Concat function or equivalent for CDS view?

    Trying to create a CDS view and looking to combine multiple character fields (e.g. first_name + last_name) and am wondering if this is possible? Am on CRM NW 7.4 SP5 on HANA.
    Using the arithmetic function gives me the following.
    Data type CHAR is currently not supported in an arithmetic expression
    Looking at the official documentation here, it doesn't appear to be included?
    ABAP Keyword Documentation
    I can always create a AMDP or even a HANA native view, just wondering if anyone has come across the same issue and found a solution within CDS view?
    Thanks in advance,
    Sean.

    Hi Sean,
    there's no concatenate function as of 7.4 SP5.
    A workaround in OpenSQL (if that's the combination you use), you could use the columns of your choice in the projection list like (I use literals in the example for simplicity):
    'a' as a,
    'b' as b
    and concatenate later by means of OpenSQL:
    select a && b from <cds_view> into ….
    However, if you want to use the view in an ALV this does not help you, I know…
    Cheers,
      Jasmin

  • Snowflake dimension: named query vs. database view

    A test question features a Product table with a Product Size code; Product Size description is taken from ProductSize table. As far as I can tell, the question asks me to choose between (a) setting up a database view joining Product and ProductSize, and
    (b) doing the join in a data-source-view named query. I don't see a clear winner. (My thinking is as follows.  Yes, he view would speed up the processing, even if not materialized. On the other hand, with a small dataset, the performance gain would be
    minor in absolute terms. Do I want to have an extra database object in the picture?) Yet the question's author does. Can anyone advise please?  

    Hi Demyan,
    According to your description, you want to know which is better, using named query in datasource view or using database view, right?
    Based on my research, there is no performance differences between using named query in datasource view and using database view because they both result in SQL query being sent to the source system. Here is a blog which discuss this issue.
    Consistency: If you already have logic in database views, I would continue to use them. As long as you know that you go to one spot to view/change the logic. Putting the logic in 2 different spots could lead to confusion.
    Security Permissions: often you may not have permission to alter the source databases, in this case you have no choice but to setup named queries in the dsv.
    Reference
    http://geekswithblogs.net/darrengosbell/archive/2006/09/05/90278.aspx
    http://bennyaustin.wordpress.com/2013/07/16/dbview/
    Regards,
    Charlie Liao
    TechNet Community Support

  • Accessing tables from different schema in CDS and AMDP

    Hi All,
    We are working on a HANA system which has several schema replicated from SAP R/3/Non SAP systems. We have BW 7.4 SP9 deployed on the same system and accessing the HANA views using latest BW virtual objects such as Open ODS , Composite providers etc.
    We are also using the BW system for few ABAP based data processing developments. We are currently accessing HANA views in ABAP programs by creating dictionary views based on external HANA views.
    We would like to however use recent possibilities of CDS and AMDP for better life cycle management of ABAP based solutions. The open SAP course on this subject was of very good help. Thanks a lot "open SAP team" for that. I would however have few open questions,
    As I understand AMDP gives us full flexibility of writing sql procedures within ABAP development environment, but can we access tables from different schema into AMDP code. If yes, then sample code would help.
    If the answer of first question is yes, then how do we manage transports between development and production systems where the schema names would be different. Currently in open HANA developments, such transport is manged using Schema mapping.
    Can I also use different schema tables in CDS views.
    We are updating few tables in ABAP dictionary after applying processing logic in ABAP program as detailed in step 1. With the new approach using AMDP, can we directly update database schema tables which will give us an optimization advantage.
    New ABAP HANA program interfaces are quite promising and we would like to use them to optimize many data intensive applications.
    Thanks & Regards,
    Anil

    Hi Anil,
    I can only answer 1. and 2. (and would be interested into 3. as well):
    1.
    Yes you can access tables from a different schema and also HANA views. In this case no 'using' is needed.
    Examples:
        RESULT = SELECT
        FROM
              "SAP_ECC"."T441V" AS t,
              "_SYS_BIC"."tmp.package/AFPO" AS a.
        WHERE ...
    2. In this case, if you need schema mapping: You could use HANA (projection) views which just forward to a different schema, also see example.
    Best regards,
    Christoph

  • Query using Materalized view in oracle 9i and 10g

    Hello
    There are snapshots (materialized view) used in my application. We have recently migrated from 9i to 10g release 2 database.
    After migration i have observed explain plan of query which is using materialized view and i found in 9i oracle treating materalized view as table. In 10g oracle is considerting it as MVIEW only (MAT_VIEW ACCESS BY INDEX ROWID). However in 10g cost of query which is using materialized view is much higher than 9i. And execution time is also random.
    Can anbody pls. expalin diff. of materalized view access in oracle 9i and 10g.
    Thanks

    can you post your query with explain plan for both 9i version and 10g version.
    Thanks,
    karthick.

  • When to go for generic extraction using view and infoset query?

    Hi,
                        Can anyone clarify me when we should go for generic extraction using view and when we should go for generic extraction using infoset query....
    Also what is the difference between view and infoset?
    I tried but could not find out....
    Regards,
    Kalyani.

    Hi Kalyani,
    We normally go for View or infoset when the data to be fetched in BW is distributed in different tables in SAP R/3.
    Had the data been available in one table we can easily build our datasource on that table but if there are more tables then its not possible to do it without Views or Infosets. You can use Function Modules to build your datasource in case it involves complex logic to figure out the data from various tables.
    Depending upon the table relationships we create view and include various fields from these tables in that view. Same is with the Infosets, you can have more flexible options like Outer Join, left outer Join etc.
    Regards,
    Pratap Sone

  • Generic Extractors for HR Reports using views and Infoset Query

    Hi Friends... I am working to come out with the HR reports in BW for the HR reports which are already there in R/3. The HR reports in R/3 are created based on Infoset Query.I could not find any standard business content cubes which can give me these reports.
    1)So please can anyone give me step by step approach so to create a generic extractors based on Infoset Query.
    2)And also how to populate the data into the fields of the generic extractor which is created by Infoset Query( Please provide any sample ABAP code if available)
    3)can anyone give me step by step approach so to create a generic extractors based on View/Table.
    4)And also how to populate the data into the fields of the generic extractor which is created by View/Table( Please provide any sample ABAP code if available)
    Thanks

    Hi Kalyani,
    We normally go for View or infoset when the data to be fetched in BW is distributed in different tables in SAP R/3.
    Had the data been available in one table we can easily build our datasource on that table but if there are more tables then its not possible to do it without Views or Infosets. You can use Function Modules to build your datasource in case it involves complex logic to figure out the data from various tables.
    Depending upon the table relationships we create view and include various fields from these tables in that view. Same is with the Infosets, you can have more flexible options like Outer Join, left outer Join etc.
    Regards,
    Pratap Sone

  • View and Navigate through PDF´s on a DB2 SQL Query

    Hello,
    We need to create a windows forms application in .Net to view and navigate through pdf´s that are located on a DB2 Express SQL database using the Acrobat SDK or PDF Library.
    The idea would be to query the SQL table and the result we should be able to view and navigate through by using the viewer procedures from the SDK without having to send the PDF files to a temporary folder on the hard drive.
    So for example, if the query returned 20 pdf´s, we should be able to navigate and view these pdf´s on a windows form connecting directly to the query via streams or a data source.
    We assume that what we need is some sort of procedure to connect the viewer to the query through a data source.
    Please help us to research about this and determine if this is possible.
    Thanks.

    Hello lrosenth and thanks for your reply.
    Our goal is to develop a Windows Form in .Net where we could view the pdf without launching Acrobat.
    I guess you mean that we should develop a plugin in C/C++ for Acrobat, but that is not what we intend.
    Is there a way to develop a function in .Net that will allow a Windows Form to read a stream with a pdf using Adobe ´s SDK or PDF´s library?
    If so, would you be so kind as to point us to some reading material?
    Regards

  • Difference btn View and a Query

    Hello there,
    I am having difficulty conceptualizing the difference btn a view and a query.
    I searched the forum but did not get very useful information.
    Can someone explain in plain language how a view is different from a query?
    Thank you.

    Hi Kara,
    Have you seen this thread:
    Re: What is view
    And also this one:
    Re: Difference: query- report- view- workbook
    Hope this helps...
    Message was edited by: Bhanu Gupta
    Thanks for pointing that out. I have changed them, plese try again.

  • Diff Between Saved Query Views and Work Books

    Hi..
    Can some one explain me the diff betwen Saved Query views and Workbooks interms of their use, and operation..
    thanks..
    kishore

    hi kishore,
    We use workbooks for excel formating,like font changes, lay out changes etc...
    Workbooks into which queries are inserted are no different in appearance than other Excel workbooks.
    They can be saved as files, copied, sent and (using Excel functions) edited however you like and even supplemented with other data.
    Views are primarily used for BW Web Reports, it is similar to the concept of workbooks is for BEx.A local view can be accessed only within a workbook in which it was saved, where as a global view can be accessed globally in the system, it is not attached to a workbook. Only Global view can be used in BW Web Templates.
    u can seee the help doc for more details:
    http://help.sap.com/saphelp_nw04s/helpdata/en/0d/af12403dbedd5fe10000000a155106/content.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/3a/89883989676778e10000000a11402f/content.htm
    bye
    shameem

  • Generic Extraction - query view and infoset query difference

    Hi Guys,
    I want to know the Generic datasource difference between Extraction from view and Extraction from Query .I have read some threads and documents, still i am not getting the exact difference.
    My understanding :
    Views: combination of tables to view the end result , we use views.
    Infoset query also with help of SQ01, 02, 03  : we combine tables to see the result.
    both use primary key to select the data.
    Please help me.
    Thanks ,
    Nithi.

    Hi Nithi ,
    When we build the datasource on the View
    View is basically a table in which you can take data from many table combniation  .
    in view you can specify the table join condtion and selection condtion
    View data gets updated as the data in the source table gets updated
    When we build the datasource on the Infoset
    Data source str gets filled from the infoset query .you need to use SQ01 and Sq02 transaction for this
    in infoset you can define the tables from which you want to read the date .There is also facilty to write ABAP code which will process the data and fill the the data source str using infoset query
    infoset query read the data from infoset and transfer to data structure
    Thanks
    Rajendra

Maybe you are looking for

  • Content of my Apps isn't backed up

    I recently had the horrific experience of losing EVERYTHING on my iPhone because my battery just died. When I restored from my backups, none of the content in my apps was saved. The apps themselves were there, but I use a lot of organizing apps and n

  • CC 17.1 runs slow!!

    Hi All, After installing an update to Illustrator 17.1 from the Cloud a few days ago I've noticed there is a significant hit in the performance. It runs really slow!! Even with simple documents with just a few layers. I opened more complex ones and i

  • How to uninstall and reinstall network drivers on a Samsung 580?

    Hi. During the summer, I got a new laptop. It was all fine and dandy when I was at home, using a dial up connection, but when I went to school, I immediately had problems. Neither the cable connection nor the wireless worked. I've got the wireless to

  • [GeForce 6] SLI mode and Geforce 6600 GT

    Hello all, I have one single question.  Would a SLI capable graphics card work in a non-SLI motherboard given that I have no desire to actually take advantage of the SLI capability? Meaning, I will have just one graphics card in my computer. Cause ye

  • Firefox 5.0.1 will not open, I just upgraded to it.

    Firefox will not open. I have been to the task manager over and over and stopped the already running firefox, no help. I just upgraded to the new 5.x.x, and now it will not open ever.