Spotlight on ABAP CDS View Extensions
Hi everyone!
here we go with another “Spotlight on …” blog! 🙂
This time I would like to put the light on the modification-free enhancement of ABAP Core Data Services (CDS) views which is supported starting with AS ABAP 7.4 SP8.
The modification-free enhancement of development objects is necessary, in order to avoid conflicts when a new release of the related application program is to be imported into a system. To avoid such conflicts in the context of ABAP CDS views, developers now have the possibility to create so-called CDS view extensions which allow the extension of the existing SELECT list in modification-free manner.
One or more view extensions can be created for a CDS view, with each of them having its own CDS source code. The SELECT list of the view extension can have all elements of a SELECT list with the exception of input parameters, path expressions, and aggregate expressions. A field cannot be defined as key field using the keyword KEY in the view extensions.
Watch the compact video tutorial below and learn how to create CDS view enhancements and call the enhanced CDS views in ABAP.
Note that currently following views cannot be enhanced using CDS view extensions:
- CDS views with an explicit name list
- CDS views with a GROUP BY clause
- CDS views with a UNION clause for union sets
Find more detailed information on this topic in the ABAP Keyword Documentation.
Hello
When I try to activate a CDS extension view I get the cryptic message in Eclipse "An internal exception was raised, view definition and extend do".
I have to say the error messages in Eclipse are even more obscure than the ones in the SE80 editor.
How do I go about finding out what that means?
I was trying to extend view CDS_KNA1_NAME1, adding some Z fields from KNA1 on the end. Something is wrong with the standard view I had chosen, maybe it cannot be extended for some reason (it does not seem to have any of the three special cases mentioned above) but the system does not want to tell me what.
Cheersy Cheers
Paul
Hi Paul,
you always have to read the activation log. You can access it easily via the dropdown menu in Eclipse. The collegues really try to improve the error messages though.
Can you post a screenshot of the error message for my collegues to analyze.
Best regards,
Kilian.
Hello,
I managed to call up the activation log as you suggested. Sadly it was not as much help as I might have wished for.
Hi Paul,
please click on the link:
"See log HARDY..."
This is the long log. The short log is not useful.
Best regards,
Kilian.
Sorry, I tried to click on the blue link but nothing happened. I trued again just now, and discovered you have to have the control key pressed down and then click on the blue link and the extended log appears. I imagine the clue is somewhere in the success/information messages before the error message.
The error message itself is no more or less detailed than before.
Cheersy Cheers
Paul
Hi Paul,
can you please open a ticket? I know that it is more cumbersome than writing an SCN entry, but without a "working" example it is very hard to reproduce and track these issues. Many people are not satisfied with many error messages, but without tickets, nothing will ever change. Our developers don't have the time to read SCN regulary. But with a ticket, you get a feedback and we can track these issues internally.
It would be good, if the ticket contained a copy of the view / extend.
Best reagards,
Kilian.
Hi,
Did get solution to above problem? I am also getting same error. Please. let me know the solution if you got any input
Thanks & Regards
Rajesh
Hi Paul,
I have the same problem. Do you remember what the solution was? I did not find a note with "view definition and extend do not fit together".
Best regards,
Edo
Solved. However, we do not know exactly what helped, but it might have been a simple name mismatch.
The problem was with table T012K, which has as CDS compatibility view. There are several CDS with similar names like V_T012K_BAM, V_T012K_DDL and V_T012K_BAM_DDL for choice.
(We also used method CL_FCLM_CDS_GENERATE=>GENERATE_HBACC with RESET=X and and then RESET='' - see note 2884977 - Dump DBSQL_REDIRECT_INCONSISTENCY when accessing the table T012K - SAP ONE Support Launchpad )
Hi Paul,
Mr. OZCELEBI's blog post will also be useful .
Detaysoft
Regards,
BAS
Hello,
Thanks for the demo.
Here I have one question is, I see it uses SELECT * to get enhanced fields, but SELECT * may not be always good to performance. e.g. in some cases I need enhanced fields but not good in performance to fetch all standard columns(with big standard view).
Is there any other syntax in ABAP SQL support to get enhanced CDS fields but not *? Or any other hints?
Best regards,
Ben
What about the SAP enhancement framework? I've always used BAPI for external integration such as using Java or dotnet application. BAPI contains SAP enhancements so we don't have to worry about it; even for reading SAP objects for reporting, we should use BAPI. Within the CDS view, we should add way to call BAPI to validate results, update and so on.
i have a requirement where i need to disable the field in the standard CDS View 'C_PurchaseReqnItem' and as per the below it is displaying the Field PurReqCreationDate in the "Manage Purchase Requisition Professional" Fiori App.
@UI: { fieldGroup: { qualifier: 'QuantityDate02', position: 20, importance: #HIGH } }
Document.PurReqCreationDate,
Now My Requirement i need to disable the field as i had to use annotation
@ObjectModel.readOnly: true
i had done the below code
@AbapCatalog.sqlViewAppendName: 'ZCPURREQNITM'
@EndUserText.label: '${ddl_source_description}'
extend view C_PurchaseReqnItem with zC_PurchaseReqnItem {
@ObjectModel.readOnly: true
Document.PurReqCreationDate }
But I am getting error "View field PURREQCREATIONDATE-C_PURCHASEREQNITEM already exists in parent object (DDL source )" could you please help how to handle this situation.