This tutorial provides a clear and practical explanation of how exposed associations optimize performance through "join on demand" logic. It is an essential resource for developers looking to master efficient, resource-conscious data modeling in SAP HANA.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
100 - ABAP on HANA - CDS View - Types of Association - Exposed Association Part2Added:
Hello everyone, we will continue the topic back on HANA and currently we are covering CDS view and in the last few videos we started with the concept of association in CDS view. So as a part of that firstly we covered what is the need of the association. Yes. What is the significance of the association? We covered the syntax of the association.
And in the last video, we started with the association types and we started with exposed association. We covered each and every point of the exposed association. We covered the advantages of the exposed association. Now it's a turn to go for the practical part of the same. Whenever we will go for practical each and every point will make more more sense because we will go for the clarification from the practical perspective. Now what the example we will take? We will go for VBA and VBA.
VBAK and VBA. So far we all know how to create a CDS view using join. Suppose in case of join what the problem is?
Suppose you only require data from VBAK table. You do not require data from VBA table. But in that case there's no way to restrict the join. Yes, the join will surely surely trigger on VBAK and VBA.
Ideally what is the scenario? We are not taking anything from VBA table. So join should not trigger because we are only taking data from VBAK. So to overcome this SAP came up with the concept of join on demand that is association and you all know exposed association is join on demand itself. So we will go for VBAK and VBA and we will go for association.
So firstly I will show you whenever we will go for VBAK at that time join will not trigger at all but whenever we will go for VBAK and VBAs at that time the join will trigger because it is join on demand. So I will simply go to Eclipse ADT and we will go for the practical part of exposed association.
Now what I will do? I will go for Eclipse add right click on data definition new data definition.
I will give some name to the CDS view.
This is our 10th number CDS view.
I will give the description to display the sales order details.
I will go to next.
I will go to next. Yes, I will go to define view entity.
If you have old system, no problem. You can create DDIC based CDS view. At that time you will get this kind of popup. If I will show you, you will get this kind of popup. At that time you can choose define view with association. Yes.
Now I will write the logic. Now you all know yes this is our source. This is our source. So we will say it as source entity. So what is our data source?
VBAK. First data source VBAK.
Now previously yes you are joining it with VBAs.
Now we will not go for join. We will go for association. Now it is totally your wish you want to take alias or not.
Suppose we will take the alias.
It's your wish you want to take it or not.
So this is our alias for the source entity.
Now we will go for target entity. How we will associate this to the target entity? You all know in the syntax we covered what we need to write. We need to write association cardality to anyways cardality is optional. So I will write association.
Now here we are very much sure that for one sales order we have multiple records in VBA header and item. So it's good to propass the cardality. If you are not clear about the cardality no problem simply pass one. So I already explained at that point of time whenever you will go for one no data loss nothing it will work in each and every scenario. So SAP clearly mentioned if you are not clear what the cardality you need to pass no problem just simply put one here I'm sure that the relationship is one is too many so I'll go for one is to star association one is to star yes now I will go for two you all know we have two followed by the target entity what is our target entity vap AP we are not going for join we are going for association it is join on demand source entity target entity yes now we'll go for optional alias it's good we'll take alias as now I will go for B now I will go for important point here yes now SAP is saying yes whenever you will go for alias this is Our target entity we are going for alias or we can simply say this is our target association we are providing a alias to the target association and we are exposing it. So whenever you are going for this always always use underscore before that it is just a recommendation from SAP and if you are not using underscore no problem at all now what SAP is saying I will just repeat this where you have this target entity you will simply simply expose this this is our target association we will simply expose this and we are going for the alias of the same. So at that time what SAP is saying the recommendation is use underscore before that. In the next video I will show you one thing also at that time SAP is by default giving underscore before the association name and this is a recommendation. If you are not using no problem at all it will work as it is.
Now we'll come on to next part. After that what it is written in the syntax followed by target entity with optional alias. Yes, we provided the alias and on condition because it is just like a join only but it is join on demand. So I will go for on.
So now a dot vb ln is equal to yes. Now what is the alias or we can say association name of the target entity or target association? It is underscoreb dot what is the column name? Vbln.
This is vbn.
Now we will go for the selection list and the first most important prerequisite we covered at that time I told you also yes the interviewer might ask this question in the interview you are going for exposed association just tell what is the prerequisite the key field which we used to associate this is the key field which we are using to associate with target entity What is the key field? BB Eln. It must be in the selection list. So I need to take in the selection list.
A dot VBN.
Suppose I will go for another column.
A dot. Now suppose I will go for another column. Suppose ER deck I will go for E R Z.
Now I will go for A. ER now.
So I provided four columns from VB AK table.
Now we are going for exposed association. Yes, we will simply simply expose this target association. This target association. What is the alias for the same underscoreb. And what is the definition of exposed association?
Entire association is added as a single element into the element list. This is our element list. The entire association is added as a single element. I added the entire association. Entire target association. Target association means VBA. And what is the alias for the same_b.
So now I will just go for the activation. I'll just see but the warning is okay. I have not provided the key. Yes, this is key.
I'll just check the warning here. Search help assignment. It's okay. Now I will go for syntax check and I will go for activation.
Now if I'm not taking this, if I'm not taking this, system will simply give me the error. Yes. Sorry.
If I'm not taking system will give me the error. Yes. A dobbn must be in the selection list.
Now I will go for activation.
Now just in this particular scenario whenever I'm running this particular CDS view. Yes, we have the columns from VBAK. Yes, as of now we are not going for any VBA. Yes, I expose this association after that. Yes, whenever I will go for VBA at that time only the join will trigger. Just see at this point of time whenever I'm selecting and I will go for show SQL create statement. What is the SQL create statement?
You can see there's no join at all. Yes, because we have this VBA AK. Yes. And we have used association. Yes. So we have only only for VBA AK. Not for VBA. We have not there's no join at all. Yes.
Now I will run I will go for simply run as a BAP application.
Now you can see we have that data only from for only we have the data only from VBAK. So at that time join did not trigger at all nothing just see we are not taking data from VBA we are only only taking data from BB AK then why join should trigger so that's why we have used association but if there is a join yes if you are taking data from VBA still still the join will trigger now I covered one point in the previous video the Best part of this particular exposed association is in add itself we can navigate to association. Now from here itself if you want to navigate to association association means if you want to navigate to VBA yes because we simply simply did the association with VBAP. So what I will do? I will simply right click. I will go for follow association.
I will go for okay.
Now at this point of time join will trigger because joins I'll say it's a join on demand. Firstly, we simply displayed the data from VBAK at that time join did not trigger because we used association. But when I simply went for the association at that time join on demand trigger. So what is the summary of this particular video? In this video we started with the practical part of exposed association. the entire entity will be added as a single element into the selection list. So we started with the practical part. We simply took two tables VBA VBA rather than join will go for association because if I require data from only from VBA AK in a particular scenario why the join will trigger on VBA. So as a part of that we created the CDS view. We have VBAK table. We provided the alias. We have written association to we provided the cardality because we are very short.
That's why I passed. If in in lots of scenarios we are not clear about the cardality. Cardinality means number of records in one table corresponds to how many number of records in second table.
At that time we'll simply simply use one. After that for the target entity I used this particular alias. Now what SAP is saying whenever because this particular association or we can say this particular this alias we are going for exposing. So what SAP is saying?
Yes, recommendation is use underscore before that. It's a recommendation and in the future I will show you one template also there SAP is providing underscore before association name but it's a recommendation. If you are not following no problem at all. After that we provided the on condition source entity what is the column VBN target entity what is the column BBN. So you can say this is our target entity. This is our source entity. This is the alias of the source entity. This is the alias of the target entity. This is our target association. Yes. And this is our element list. I provided the columns.
Yes. Then I simply simply exposed this association. I will write this comment also. Exposed the association because entire association is added as a single element into the element list. Do not forget to take VBEN VB ak VBN in the element list because the prerequisite is this only the key field which we use to associate this key field we are using to associate with VBA. So it must be the part of your selection list. After that I simply run that particular CDS view and whenever we are running at that time the data is only from BB AK table. At that time join will not trigger at all nothing. And I showed you SQL create statement also there is no join at all.
But yes in Eclipse add we have a feature of navigating to association also. So when I run yes and we have right click on any sales order it is navigating to the data of BBA it means we are navigating to association target association data. Yes at that time join on demand association will trigger and that is join on demand. Now in the next video I will simply use this in the ABAB program. Whenever I will go for ABAB program. Firstly I will go for VBAK.
Then I will go for VBAK and VBA both I will open the I will activate the SQL trace and at that time I will give you the clear understanding.
In first scenario, yes, you will be only able to see VBAK and in the second scenario, you will be able to see VBA AK and VBA both in the trace. That's why it is called as join on demand. So that's it in this video. Thank you.
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Introduction to Problem Solving Part - 1 | Lecture 1 | Intermediate DSA
ascensionix
107 views•2026-05-29
🚀 BCS613C Compiler Design | Module 1 to 5 Schema Evaluation 🔥 | VTU 6th Sem 💯 #VTU #bcs613c #exam
Pranavaa-y4y
104 views•2026-06-02











