I have the requirement to extend a sap cds view to add one field.
The cds view have a group by clause, therefore I'm getting the following error:
Parent I_SRVCENTRSHTPURORDITMVH has aggregate function or group by;
extension not possible
I found a possible solution in the ABAP Keyword Documentation by adding the annotation
#AbapCatalog.viewEnhancementCategory: [#PROJECTION_LIST,#GROUP_BY]
but I don't want to change sap default cds views.
Is there another way to extend this cds?
Related
I have a CDS view ZCDS_XXX :
define view ZCDS_XXX
as select distinct from XXX
association [1..*] to ZCDS_YYY as _YYY ...
{
key a,
_YYY
} ...
I have a DCL ZDCL_XXX :
define role ZDCL_XXX{
grant
select
on
ZCDS_XXX
where
( _YYY.ProfitCenter ) = aspect pfcg_auth( K_PCAR_REP, PRCTR );
}
The goal is to return the entries of the CDS ZCDS_XXX
for which the user has at least one authorization from a list of associated profit centers .
Okay everything is working fine ...
BUT, when the DCL is active, The CDS view ZCDS_XXX view returns me duplicate keys
despite the DISTINCT (removes duplicates from the results list).
As if the DCL does the processing after the selection and
changed the cardinality of my result >(
I would like to know if there is a solution directly in the DCL or the CDS view to avoid having duplicates and avoid doing a SELECT DISTINCT in oSQL or delete duplicates for example if I use the CDS view in a search help.
And also if you have a link that describes its behavior or the SQL syntax in the DCL, I can't find much in the docs...
Thanks you a lot for your help !
Probably you need a left outer to one join in the CDS definition, please give it a try.
At SQL run time of a CDS selection, cardinality plays a important role if using a field from associated entity. Please read this blog for the general explanation https://blogs.sap.com/2018/08/20/cardinality-of-association-in-cds-view/
Given a view or a table, how can I list views and scheduled queries having a reference to it within a project?
I understand from the documentation that I can do check reference within a dataset with below query, but I'd like to check reference within a project all at once.
SELECT *
FROM your_dataset_name.INFORMATION_SCHEMA.VIEWS
WHERE REGEXP_CONTAINS(view_definition, 'your_dataset_name.your_table_name')
I am creating a view for generating the DDLs for the tables. I am stuck at a point where I am unable to find how the SORTKEY is defined like SORTKEY AUTO or SORTKEY(columns).
I saw there is a column "attsortkeyord" in the pg_attribute table but it gives numerical values which only tell the order of columns defined in sort keys.
There is a system view named "svv_table_info" which has column "sortkey1". This actually tells what exactly I required like AUTO(EVEN) or AUTO(ALL) but this view I am unable to use with other queries inside my main view.
Whenever I use "svv_table_info" I get an error "Function not supported" for almost all functions like text, format_type, etc.
Can anyone please help me either how to get details from catalog tables or how to deal with this error while using "svv_table_info"?
I created a custom field called Commission in the product form (POS module). Its technical name is x_commission.
I want to be able to group by "Commission" in the POS > Reporting > Orders menu.
Is there a way to access that field from another view?
Thanks in advance.
You can use this field on other views of product.product model.
Create the field in a module since as I remember the fields used for group by in read_group method are filtered to be real fields
I want to create a one-column hierarchy from multiple columns using mdx. I got this result:
from the Sales cube with this mdx:
SELECT
{ {[Measures].[Amount]} } ON COLUMNS,
{ [Customers].[Geography].firstNotAllLevel().allmembers }*{ [Product].[Product].[Category].allmembers }*{ [Time].[Quarter].firstNotAllLevel().allmembers } ON ROWS
FROM [Sales]
I want the first three columns to form a hierarchy that looks like this:
Is this possible in icCube using mdx? If it is, can you show me how?
Using standard MDX you can't solve the problem as you can not navigate across hierarchies on a single MDX statement.
What we're looking for is to define our own hierarchy for navigation. Using icCube you've two different ways :
1) You can use Categories to define at will a new hierarchy. Check documentation (categories-howto, categories-doc and categories-example ). Bear in mind that for the new hierarchy the parent / child relation is just visual and not data related (e.g. parent is the sum of his children)
2) You can define your navigation logic using the reporting tool. But this has his limitations in the current version 5.1 (most probably we will fix for 5.1.1)