In my last article, I tried to show the limitation of Open SQL with respect to SQL Script. Today, I would like to point out the limitation in CDS and a simple tweak to overcome it. ABAP CDS Views have a problem in that you cannot join tables together with mismatched GUIDs, that is to say where one GUID is defined as RAW and the other is defined as CHAR.
BUT000 has PARTNER_GUID defined as RAW(16) and CRMD_PARTNER has PARTNER_NO defined as CHAR(32). When you try to join these two tables together in an ABAP CDS View, it will give an error and the view will not activate due to the join fields being mismatched. This is a restriction imposed by HANA SQL query language used for ABAP CDS Views.
We have taken GUID for our demonstration. The issue can be with any field with data type mismatch. And our tweak would be applicable for all.
The simple solution to bypass this issue is to create another TYPE of View to handle the join. The type of view I am referring to is an ABAP Dictionary View. Yes, normal ABAP Dictionary View can come to the rescue of the CDS View.
Unlike ABAP CDS views, Dictionary Views use Native SQL, which allows joining of mismatched data types for GUIDs.
Dictionary views are created within the SAP GUI editor (ABAP Perspective of HANA Studio or in normal GUI), require no source code entries, so no DDL source file is associated with them.
Also Take – End to End Video Course on How to Consume HANA Models in ABAP?
Some limitations of dictionary views:
- Only tables can be joined.
- They can only be joined using INNER JOIN.
- You cannot alias table names, so each table can only be used once in the view.
- No calculations or grouping is possible.
As you can tell from the above limitations, these views need to be kept basic, and this is fine for the purpose we have, which is simply to create a linking view between two tables which can then be combined with other more complex ABAP CDS views.
Dictionary views are created in SAP HANA Development Studio under the ABAP perspective or directly in the SAP GUI using transaction code SE11.
If creating in SAP HANA Development Studio, follow the steps below:
- Go to ABAP perspective
- Open the package to which the view is to be added
- Open the Dictionary >> Views folder.
- Right click on the “Views” folder name
- Select New Dictionary View
Or alternatively
- Go to ABAP perspective
- Right click on the package to add the view to
- Click New and select “Other ABAP repository object”
- Open the Dictionary folder
- Select Dictionary view and Next
Next
6. The following screen will be displayed.

There are two types of view you can create; Dictionary View and External View. In our case we are only interested in Dictionary Views.
Also Take – End to End Video Course on ABAP 7.4 New Syntax & Features
7. Enter the view name desired and select Dictionary View
8. The maintenance screen for transaction code SE11 is displayed, under which you can then select appropriate tabs to add tables, join criteria, the fields to output and the selection criteria to use.
Alternatively, the view can be created directly within the SAP GUI using the following steps.
- Enter transaction code SE11
- Enter the view name and click create


3. Enter a description, then define the tables and join conditions required.

4. Enter the basic fields required, for a link table these should simply be the CLIENT and the two GUIDs used in the join.
You can add further fields if desired but bear in mind, this view is primarily being created as a linking table, so keeping it simple is best.
5. Once all entries are made, save, activate and assign to a transport.
6. The activation log will give the following warnings, showing the type mismatch between the GUIDs.

We can ignore the warning. Our database view is ready.
Also Read: End to End SAP ABAP on HANA Tutorials.
7. Now we have a view that can be used for joining CRMD_PARTNER with BUT000 within and ABAP CDS view as follows:
<code>SELECT FROM CRMD_PARTNER AS PART INNER JOIN ZVW_PARTNER_LINK AS LINK ON LINK.CLIENT = PART.CLIENT AND LINK.PARTNER_NO = PART.PARTNER_NO INNER JOIN BUT000 AS B000 ON B000.CLIENT = LINK.CLIENT AND B000.PARTNER_GUID = LINK.PARTNER_GUID { <desired fields> }</code>
Look at the database view closely in the above snippet. The database view has become the connecting link between the two CDS Views and has effectively overcome the problem of joining CRMD_PARTNER direct with BUT000 with GUID mismatch (data element mismatch). And because it is used in a CDS View, this enables use of LEFT OUTER JOIN between the tables if needed.
This is simple trick which we have used in our real project. There can be better way which I am not aware of. If you know of a better solution, please put it in the comments section. Together we can learn better and provide optimized solutions to our clients.
In my next article, I would share the different reporting in SAP viz BI Reporting, Operational Reporting and reporting tools like KPI modeller, Crystal Reports, Lumina etc. So, please stay tuned.
We have a very active Telegram (App) SAP Technical Group with more than 5000+ SAP Technical Practitioners from 6 Continents of the SAP World. Please join it using below link.
Telegram SAP Technical Discuss Group. You need to install the Telegram App first on your mobile device. Once you have it on your mobile, you can join the group and also access it from the Web on your computer and laptop.
Please SUBSCRIBE to SAPYard’s Youtube Channel for Free End to End SAP Video Course and Training.
Free Step by Step Core Data Services Exercises
- CDS Part 1. Core Data Services – Introduction
- CDS Part 2. Core Data Services – Deep Dive
- ABAP on SAP HANA. Part XII. Open SQL, CDS or AMDP, which Code to Data Technique to use?
- CDS Part 3. Expose CDS Views as OData Service through Annotation
- CDS Part 4. Data Access in S/4HANA Cloud – CDS View Introduction
- CDS Part 5. ABAP CDS Views With Authorization
- CDS Part 6. Basic Expressions & Operations Available for CDS View – I
- CDS Part 7. Basic Expressions & Operations Available for CDS View – II
- CDS Part 8. Usage of Built-In Functions in CDS – I
- CDS Part 9. Usage of Built-In Functions in CDS – II
- CDS Part 10. Usage of Built-In Functions in CDS – III
- CDS Part 11. How to Consume CDS View in Smart Business Service KPI Fiori Apps?
- CDS Part 12. Useful 6 CDS Related Tools in ADT
- CDS Part 13. Key Definition in CDS Views
- CDS Part 14. ABAP Annotations for Translatable Texts in CDS Views
- CDS Part 15. Associations in CDS Views – I
- OData Service from CDS Annotation Not Working in Browser Mode
- CDS Part 16. Usage of Built-In Functions in CDS – IV
- CDS Part 17. How to Overcome GUID Mismatch Linking Problem in ABAP CDS?