<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>joins &#8211; SAP EWM Help</title>
	<atom:link href="https://www.sapewmhelp.com/question-tag/joins/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sapewmhelp.com</link>
	<description>SAP EWM questions answered by experts — ABAP, S/4HANA, warehouse management</description>
	<lastBuildDate>Tue, 05 Aug 2025 19:11:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>
	<item>
		<title>Join VS For all Entries</title>
		<link>https://www.sapewmhelp.com/question/join-vs-for-all-entries/</link>
					<comments>https://www.sapewmhelp.com/question/join-vs-for-all-entries/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Tue, 05 Aug 2025 19:11:51 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=join-vs-for-all-entries</guid>

					<description><![CDATA[Joins combine rows from two or more tables based on a related column, usually a key field. ABAP supports various join types (INNER JOIN, LEFT OUTER JOIN, etc.) mostly used inside Open SQL queries. How to Use Joins: SELECT a~vbeln, a~erdat, b~posnr, b~matnr   FROM vbak AS a   INNER JOIN vbap AS b ON [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Joins</strong></p>
<p>combine rows from two or more tables based on a related column, usually a key field. ABAP supports various join types (INNER JOIN, LEFT OUTER JOIN, etc.) mostly used inside <strong>Open SQL</strong> queries.</p>
<h4><strong>How to Use Joins:</strong></h4>
<p>SELECT a~vbeln, a~erdat, b~posnr, b~matnr<span><br />
</span>  FROM vbak AS a<span><br />
</span>  INNER JOIN vbap AS b ON a~vbeln = b~vbeln<span><br />
</span>  INTO TABLE @DATA(result).<span></p>
<p></span></p>
<ul>
<li>Here, sales order header (vbak) is joined with sales order items (vbap) on the sales order number (vbeln).</li>
<li>Result is fetched in one go, improving performance by reducing database calls.</li>
</ul>
<p><strong>FOR ALL ENTRIES</strong></p>
<p>is a clause in ABAP that allows you to select records from a table where a field matches any entry in an internal table, acting like an “IN” condition.</p>
<h4><strong>How to Use FOR ALL ENTRIES:</strong></h4>
<p>DATA: lt_vbak TYPE TABLE OF vbak,<span><br />
</span>      lt_vbap TYPE TABLE OF vbap.<span></p>
<p></span>&#8221; First select sales orders into internal table<span><br />
</span>SELECT vbeln erdat vkorg kunnr FROM vbak<span><br />
</span>  INTO TABLE lt_vbak<span><br />
</span>  WHERE vkorg = &#8216;1000&#8217;.<span></p>
<p></span>&#8221; Use FOR ALL ENTRIES to select matching items<span><br />
</span>IF lt_vbak IS NOT INITIAL.<span><br />
</span>  SELECT vbeln posnr matnr FROM vbap<span><br />
</span>    INTO TABLE lt_vbap<span><br />
</span>    FOR ALL ENTRIES IN lt_vbak<span><br />
</span>    WHERE vbeln = lt_vbak-vbeln.<span><br />
</span>ENDIF.<span></p>
<p></span></p>
<ul>
<li>The first SELECT fetches sales orders for a sales org.</li>
<li>The second SELECT fetches all items related to these orders.</li>
<li>This reduces database hits compared to looping with multiple selects.</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/join-vs-for-all-entries/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is the difference between association vs Joins in CDS ?</title>
		<link>https://www.sapewmhelp.com/question/what-is-the-difference-between-association-vs-joins-in-cds/</link>
					<comments>https://www.sapewmhelp.com/question/what-is-the-difference-between-association-vs-joins-in-cds/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Tue, 05 Aug 2025 18:30:22 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=what-is-the-difference-between-association-vs-join-in-cds</guid>

					<description><![CDATA[Association An association is a declarative relationship between CDS entities (like foreign keys), defined using the association keyword. Key Characteristics: Lazy/Evaluated-on-demand: Data from the association is not fetched unless it is explicitly accessed using a path expression (like to_customer.name). Navigation-style access: You can access associated data using dot (.) notation. Defined once, reused many times: [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Association</strong> An association is a declarative relationship between CDS entities (like foreign keys), defined using the association keyword. <strong>Key Characteristics:</strong> Lazy/Evaluated-on-demand: Data from the association is not fetched unless it is explicitly accessed using a path expression (like to_customer.name). Navigation-style access: You can access associated data using dot (.) notation. Defined once, reused many times: Associations can be defined once and used in multiple views or queries. Cardinality can be defined: e.g. [0..1], [1..*].</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>define view ZSalesOrder as select from sales_order
association [0..1] to customer as _Customer on $projection.customer_id = _Customer.id
{
key sales_order_id,
customer_id,
_Customer.name
}
</code></pre>
<p>Here, _Customer is an association. It won&#8217;t trigger a join unless _Customer.name is accessed.</p></div>
<div class="hcb_wrap"><strong>Join</strong></div>
<div class="hcb_wrap">A join is an explicit operation in CDS to combine two data sources based on a condition, much like in SQL. <strong>Key Characteristics:</strong> Eager execution: The join happens immediately during view evaluation. More control: You control the type of join (INNER, LEFT OUTER, etc.). Typically used when data from both tables is always needed.</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>define view ZSalesOrderJoin as select from sales_order
inner join customer on sales_order.customer_id = customer.id
{
sales_order.id,
customer.name
}</code></pre>
<p>Here, a real-time INNER JOIN is performed.</p></div>
<h5><strong>When to Use What?</strong></h5>
<p><strong>Use Association:</strong></p>
<ul>
<li>When modeling data relationships.</li>
<li>When you want flexibility and better performance for optional fields.</li>
<li>When the associated data isn’t always needed.</li>
</ul>
<p><strong>Use Join:</strong></p>
<ul>
<li>When you always need data from both sources.</li>
<li>When performing aggregations or filters based on joined fields.</li>
<li>When doing complex multi-joins with specific types (e.g. inner join).</li>
</ul>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/what-is-the-difference-between-association-vs-joins-in-cds/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
