CDS View Consumption in ABAP Open SQL - abap

As part of ABAP 7.50, SAP has imposed restriction on direct consumption of CDS view in ABAP OPEN SQL select query, through strict mode. So that, I am getting P3 Error in ATC checks.
I would like to know is there any other way to get data from CDS view in ABAP report?

use the select from SQL view created in #AbapCatalogue.sqlViewname.

Related

Autogenerate sql query from the Graphical calculation view?

I am trying to test a graphical calculation view in SAP- HANA but I can't edit it due to some production constraints. Is there any way to I Can get the query equivalent of the Calculation view without altering the data at the same time?
No, there is no direct calcview - SQL statement conversion available
Why don't you simply copy the calcview in question and modify the copy?

Stored Procedure usage in Azure SQL Database with Direct Query Mode

I have created stored procedures in Azure SQL Database and trying to use them power BI report with Direct Query mode. But getting the error like
"Microsoft SQL: Incorrect syntax near the keyword 'EXEC'. Incorrect syntax near ')'.
Another question is
how to set the connection string as global so that I can use the same connection string in multiple reports?
Please help me with the solution
I assume you are using Power BI Desktop. When it constructs a DirectQuery SQL query it does this:
Select column1
From (
YourQuery
) as t1
So it fails because you can't put EXEC in the from clause of a SELECT query.
Your options:
Stop using DirectQuery. Using a stored proc in cached mode will work because it just runs your query without any changes during refresh. Why would this not work for you?
Take the query out of the stored proc and put it inline into PBI Desktop. Then it should work with DirectQuery as long as it is a single statement simple select.
Regarding reusing the connection (and I assume you also mean reusing the model with calcs, relationships, etc) in another report. Turn on this new preview feature under PBI Desktop options and you can connect to a published dataset (the model/data/connection) in Power BI Service.

Teradata SQL & cognos. How can I customize Cognos to accept a customized & more efficiently performing SQL

RIght at the outset I'd like to say that I am NOT a Cognos Guy .So I have totally disconnected myself from developing cognos cubes / reports whatever you want to call it.
There are COGNOS queries auto generated - very badly written that will cause the Teradata ( DBS 15.1.x ) system to Hog on spool & CPU . I can tune them beautifully after I pull them out from DBQL. I want to know HOW can I implement Custom Queries that can be run periodically as batch reports instead of Cognos auto-generating these queries.
E.g. You create a cube - its writes code behind it and then you can open the code and write custom code that is equivalent to the original code but performs a lot better. Then when you open the cube again - it remembers there is a custom SQL and runs that instead of its own auto generated SQL . This is just how I imagine one way it can do it but again- I am not a cognos resource so pl dont flag me down for lack of knowledge. That is exactly what I am trying to get an idea about
Thanks for bearing with me
In Framework Manager you can create one Query Subject with complex query inside. Do not import tables etc. Just create QS in put your query inside.
You need to use stored procedure to return your expected data and add it to Model.
Then instead of using couple of tables in Cognos report studio (and joins), add one query and point it to your stored procedure. This way your Cognos report will execute the procedure instead of generating query (which may not be efficient in many cases)

How to retrieve system object code or definition in SQL Server?

Hi i am using SQL Server 2012. i would like to view the system objects code/definition. can we view the system objects definition/code in SQL Server any version ?
wanted to know when i execute this query SELECT MONTH(18/200), MONTH(200/18) i am getting output 1 for both just want to know internal code what is going on and how it is giving output 1 for MONTH(200/18) ? to understand this looking for MONTH() function code.
Use INFORMATION_SCHEMA
An information schema view is one of several methods SQL Server
provides for obtaining metadata.
Information schema views provide an
internal, system table-independent view of the SQL Server metadata.
Information schema views enable applications to work correctly
although significant changes have been made to the underlying system
tables.
The information schema views included in SQL Server comply
with the ISO standard definition for the INFORMATION_SCHEMA.
answer to SELECT MONTH(18/200), MONTH(200/18) is any integer to the MONTH() interprets 0 as January 1, 1900. that's whey it is returning 1 1 as output.

SQL View displaying incorrect data while the same sql code run in a query window gives correct data

One of my SQL view when opened and run in a design window gives incorrect data while the same underlying SQL code is run in a new Query window gives correct data. To be more specific, this view is pointing to a table where data changes on a daily basis. Why am I getting stale data in the design view while the same (same view underlying sql) code run in a Query Window gives current data. This has never happened before. There is a excel sheet that connects to this view to pull data into reports and this is getting the stale data into the report.
What should I be looking at to fix this issue.
And the server is SQL Server 2008 R2 (SP1)
Any help is appreciated. Thanks in advance.
You probably use * in your view to select all columns from some table
select * from table
when you add a new column to that table you'll need to re-run the view, then it'll work... select *, especially in view is generally considered a bad practice. In the case of a * metadata is not automatically updated when the tables (or schema for that matter) used in view are modified, therefore you'll need to alter the view
another way of refreshing it is running system stored proc:
EXEC sp_RefreshView vw_ViewName