This breakdown exposes the performance trap of ad-hoc associations, which trade the efficiency of on-demand fetching for immediate SQL joins. It is a vital reality check for developers who mistake all CDS associations for optimized, lazy-loading structures.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
102 - ABAP on HANA - CDS View - Types of Association - Ad-Hoc Association Part1Added:
Hello everyone. We will continue that topic about 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 understood the need of association. We covered the syntax of association then we started with the types of association and as a part of that we covered the exposed association so far. Now we will move on to our next type of association that is ad hoc association.
So we will understand the meaning of ad hoc association then we will go for the practical part of the same and after covering this ad hoc association we will go for the full comparison of exposed and the ad hoc association also. So what is ad hoc association?
In case of ad hoc association the specific field from the target entity are added to the element list. If you remembered in case of exposed association yes the entire entity the entire association is added into the element list as a single element. The entire association is added as a single element into the element list but in case of ad hoc association the specific fields will be added to the element list, the specific fields of the target entity will be added to the element list. Suppose, if I will show you the their code as of now, anyways, we will do the practical. You can see we have this CDS view. We all know this is our source entity. This is our target entity. And this is the alias of that target entity. Here, we are adding the specific fields of that target entity.
You can see we added p Previously, we added the entire association into the element list. Now, we are adding the individual elements, or we can say specific elements, or specific fields into the element list.
Now, we will come on to the next point.
In case of ad hoc association, the SQL create statement immediately create that join. If you remember, in case of exposed association, when I showed you the SQL create statement, at that time there was no join at all. Yes, but here, whenever I will show you the SQL create statement, we will be able to see that join immediately. Suppose, if I will simply select and show you the SQL create statement, we will be able to see that join.
You can see we have a join here. Yes.
Now, that's why it is not called as join on demand. And when we started with that topic, I put so much stress at that point of time. But suppose interviewer is asking, "Okay, what is association?"
Then you will say association is join on demand. Then immediately the interviewer ask the question, "Which type of association is join on demand?" Exposed association is join on demand. Ad-hoc association is not join on demand at all. Anyways, when the practical part will proceed, you will automatically understand. So, what is ad-hoc association? In case of ad-hoc association, the specific fields of the target entity will be added to the element list. Yes, whenever we will go for SQL create statement, we will be able to see the join immediately. So, it is not join on demand at all. Whereas, exposed association is join on demand.
Anyways, at the last we'll go for full comparison of both type of association, then you will be able to cover all these points.
Now, we will go for the practical part of the same same to same requirement we will take. We'll go for VBAK and VBAP.
rather than going for exposing the complete association entire association, we will take the specific field of the target association. So, I will create a CDS view.
I'm deleting this because we'll go sequence wise. I will go for 11 number.
Because we already did it till 10.
Now, I will go for 11th. For the practice purpose I did. Now, I will go by the same sequence. Yes.
Now, I will create a CDS.
And from the starting itself I told you from these six to seven videos itself, you might face lots of question during that interview. Yes.
So, I will write ZCDSView11 table.
Now, we will go for description.
To display the sales order details. I will go for next.
Yes, I will go for next.
View entity, I will go for finish.
Now, we will go for logic part. Yes, what is our first data source? We'll go for VBEK as A.
This is our source entity, yes, and this is the alias.
Now, you all know what is the syntax of the association. I will write association.
I will pass the cardinality. Here, I'm very sure, yes, it's one is to many, so I'm going for the same.
If you are not clear at all, SAP is clearly saying go for one. There will not be any data loss. It works in all the condition.
Association two.
Now, we will go for target entity or we can say target association.
VBAP as Now, this is our alias. And what SAP is recommending, put underscore before that, yes.
underscore P. So, this is our association name or you can say target association name. Yes, this is our target entity, target association. Yes.
Now, we will simply simply go for on condition.
You all know, yes? We will specify the common fields. In case of join also, you are doing the same to same thing. So, we will write a.
What is vbeln?
Is equal to we will write underscore b.
vbeln.
Here, we are not exposing the entire association. We are going for specific fields, whatever the fields required.
Now, I will take few columns of vbak and few columns of vbaps.
You all know, yes? vbeln is key.
So, I will go for a. vbeln.
Now, I will go for a. Suppose, erdat.
Suppose, I will go for a. erzdt.
a. erdat.
Now, I will specify the specific fields, yes? This is the first difference which you can told to the interviewer. In case of exposed association, yes? Entire association is adding as a single element into the element list. Here, we are going for individual, or we can say specific fields of the target association. This is our target association. This is our target entity, yes?
So, I will write underscore b.
Now, I will go for posnr, suppose.
And I will go for matena.
underscore b.
I will go for mat.
So, I took six columns, yes?
Four from this VBAK and two from this VBAP. VBAP we can say our target entity, target association, yes?
I will simply check the syntax and I will go for activation.
Now, I will show you the SQL create statement. Whenever I will show you the SQL create statement, yes, it will show the join immediately. It is not join on demand at all.
Suppose, if I'm going for this and I will right-click and I will go for show SQL create statement.
Now, you can see it is a join as the system is immediately creating a join itself. Now, if I will run this particular CDS view I will go for run as I will go for a back application.
You can see, yes?
We have that data of VBAK VBAP both, yes?
Previously, what we have? We passed the complete association into the element list as a single element. Whenever you are clicking and you are going for association then it is showing you the elements of VBAP because it is join on demand. It is not join on demand. Suppose, if here I'm selecting and if I will go for follow association, it will not follow at all.
Nothing. No association is defined because whatever is required we displayed at the first time itself. Join executed at this point of time itself.
Yes. So, what is the summary of this particular video? Into this particular video, we started with the second type of association, that is ad hoc association. Yes. In case of ad hoc association, the specific fields are added to the selection list, your element list. In case of exposed, the entire association is added to the element list through single element.
Now, whenever you are going for individual element, yes, SQL create statement immediately create the join.
So, never say that ad hoc association is join on demand. Ad hoc association is never never join on demand. After that, when I simply executed this, I created a particular CDS view. Yes.
We have first data source, second data source. And you all know, whenever you are going for alias or association name of the target entity, SAP is recommending use underscore before that.
We pass the common element, yes, through on condition. And into the element list, we took the individual fields of the target association or target entity. And after that, when I executed this particular CDS view, we are able to see the elements of VBAK, VBAP. And whenever I right click and I just did the follow association, nothing happened at that point of time, because it is not join on demand. It is completely completely a join itself. Now, in the next video, I will simply simply go for SAP GUI. I will go for SAP GUI. I will write the query. Firstly, I will go for VBAK columns only. Still, join will be there.
If I will go for VBAP, still join will be there because it is not join on demand. It is just like a join itself.
Then, after that, we will go for the full comparison of this exposed association and this particular ad-hoc association. Now, people have one question in mind. Yes, in case of exposed association, what is the prerequisite?
That key field which we used to associate must be the part of selection.
You all know, when we did the exposed association, VBELN, because this is we used to associate must be the part of your element list. But, people have a question in mind here. If we are going for ad-hoc association, the same prerequisite is applicable here? No, it's not applicable here at all.
Suppose, if I'm commenting this, no problem at all. Yes, this prerequisite is not applicable. Yes, this prerequisite is not applicable.
Now, why I hold this particular point?
Because, whenever I will go for a complete comparison of ad-hoc association and this exposed association, then I will cover this particular point, also. So, in the next video, we will simply simply firstly finish the ad-hoc association, then we will go for the a comparison of the same. 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











