<?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>CDS Views &#8211; SAP EWM Help</title>
	<atom:link href="https://www.sapewmhelp.com/question-category/cdsviews/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>Fri, 31 Oct 2025 17:49:29 +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>What is the difference between @AbapCatalog.sqlViewName and CDS view name?</title>
		<link>https://www.sapewmhelp.com/question/what-is-the-difference-between-abapcatalog-sqlviewname-and-cds-view-name/</link>
					<comments>https://www.sapewmhelp.com/question/what-is-the-difference-between-abapcatalog-sqlviewname-and-cds-view-name/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Fri, 31 Oct 2025 17:49:29 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=what-is-the-difference-between-abapcatalog-sqlviewname-and-cds-view-name</guid>

					<description><![CDATA[In SAP CDS (Core Data Services), when you create a CDS view in ABAP, two different names are involved: the CDS view name (the logical name in the ABAP layer) and the @AbapCatalog.sqlViewName (the technical name of the corresponding SQL view in the database). The CDS view name is the ABAP-level name used within the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In SAP CDS (Core Data Services), when you create a CDS view in ABAP, two different names are involved: the <strong>CDS view name</strong> (the logical name in the ABAP layer) and the <strong><code>@AbapCatalog.sqlViewName</code></strong> (the technical name of the corresponding SQL view in the database).</p>
<p>The <strong>CDS view name</strong> is the <strong>ABAP-level name</strong> used within the ABAP environment. It’s the name you use to reference the CDS view in ABAP programs, in other CDS views, or in tools like ADT (Eclipse). It represents the <strong>semantic model</strong> and is part of the <strong>ABAP repository</strong>.</p>
<p>On the other hand, <strong><code>@AbapCatalog.sqlViewName</code></strong> defines the <strong>technical name of the SQL view</strong> that gets created in the underlying database when you activate the CDS view. This SQL view acts as a bridge between the ABAP dictionary and the actual database. The SQL view is stored in the database and can be accessed using standard SQL statements if needed.</p>
<p>In simple terms:</p>
<ul>
<li>
<p>The <strong>CDS view name</strong> = used in the <strong>ABAP layer</strong> (semantic name for CDS).</p>
</li>
<li>
<p>The <strong><code>sqlViewName</code></strong> = used in the <strong>database layer</strong> (technical name for DB view).</p>
</li>
</ul>
<p>For example:</p>
<p>@AbapCatalog.sqlViewName: &#8216;ZEMP_SQL&#8217;<br />
@EndUserText.label: &#8216;Employee CDS View&#8217;<br />
define view ZCDS_Employee as select from zemployee {<br />
key emp_id,<br />
emp_name,<br />
emp_dept<br />
}</p>
<p>Here, <strong><code>ZCDS_Employee</code></strong> is the <strong>CDS view name</strong> (used in ABAP), while <strong><code>ZEMP_SQL</code></strong> is the <strong>SQL view name</strong> (created in the database).</p>
<h3 data-start="1581" data-end="1611">Key Differences Summary</h3>
<div class="_tableContainer_1rjym_1">
<div class="group _tableWrapper_1rjym_13 flex w-fit flex-col-reverse">
<table data-start="1613" data-end="2086">
<thead>
<tr>
<th data-start="1613" data-end="1622" data-col-size="sm">Aspect</th>
<th data-start="1622" data-end="1651" data-col-size="md"><code>@AbapCatalog.sqlViewName</code></th>
<th data-start="1651" data-end="1668" data-col-size="sm">CDS View Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>Layer</td>
<td>Database layer</td>
<td>ABAP layer</td>
</tr>
<tr>
<td>Purpose</td>
<td>Technical representation of CDS view in DB</td>
<td>Logical/semantic name in ABAP</td>
</tr>
<tr>
<td>Naming rule</td>
<td>Max 16 characters</td>
<td>Up to 30 characters</td>
</tr>
<tr>
<td>Created in</td>
<td>Database</td>
<td>ABAP Dictionary</td>
</tr>
<tr>
<td>Usage</td>
<td>Used in SQL tools or DB access</td>
<td>Used in ABAP programs or other CDS views</td>
</tr>
<tr>
<td>Example</td>
<td><code>ZEMP_SQL</code></td>
<td><code>ZCDS_Employee</code></td>
</tr>
</tbody>
</table>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/what-is-the-difference-between-abapcatalog-sqlviewname-and-cds-view-name/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What are DCLs in CDS?</title>
		<link>https://www.sapewmhelp.com/question/what-are-dcls-in-cds/</link>
					<comments>https://www.sapewmhelp.com/question/what-are-dcls-in-cds/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Fri, 31 Oct 2025 17:42:02 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=what-are-dcls-in-cds</guid>

					<description><![CDATA[DCL (Data Control Language) in CDS is used to define and control data authorizations for CDS views.In other words, it allows you to restrict access to specific data records based on user roles, so that users can only see data they are authorized to see. DCLs are written using the DEFINE ROLE syntax and stored [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>DCL (Data Control Language)</strong> in CDS is used to <strong>define and control data authorizations</strong> for CDS views.<br />In other words, it allows you to <strong>restrict access to specific data records</strong> based on user roles, so that users can only see data they are authorized to see.</p>
<p>DCLs are written using the <strong><code>DEFINE ROLE</code></strong> syntax and stored as <strong>authorization objects</strong> in the ABAP Dictionary.<br />They work in combination with <strong>authorization checks</strong> performed automatically at runtime by the ABAP system — when the CDS view is queried through ABAP, OData, or analytical tools.</p>
<p><strong>Purpose of DCL</strong></p>
<ul>
<li>
<p>To <strong>control access</strong> to data at the CDS view level (not in ABAP code).</p>
</li>
<li>
<p>To ensure <strong>data security</strong> and <strong>compliance</strong> with organizational policies.</p>
</li>
<li>
<p>To <strong>centralize authorization logic</strong> so it’s reusable and not hardcoded in multiple reports or services.</p>
</li>
</ul>
<p>In simple terms:</p>
<blockquote data-start="1081" data-end="1136">
<p>DCL defines <em>who can access what data</em> in a CDS view.</p>
</blockquote>
<p><strong>How DCL Works</strong></p>
<ol>
<li>
<p>A CDS view is defined with an authorization check annotation:</p>
<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary">
<div class="sticky top-9">
<div class="absolute end-0 bottom-0 flex h-9 items-center pe-2">
<div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs">@AccessControl.authorizationCheck: #CHECK<br />
define view ZCDS_Employee as select from zemployee { &#8230; }</div>
<div></div>
<div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs">2. A DCL (authorization rule) is created using <code>DEFINE ROLE</code>.</div>
</div>
</div>
</div>
<p>It specifies the conditions under which a user can access the data At runtime, when a user executes the CDS view (via report, OData, or Fiori app),<br />the system automatically filters data according to the DCL rule.</li>
</ol>
<p><strong>PFCG Authorization Object Link</strong></p>
<p>The function <code>aspect pfcg_auth('AUTH_OBJECT', 'FIELD')</code> links the DCL to a PFCG (Profile Generator) authorization object.<br />This ensures integration between CDS-level security and SAP’s standard role-based security.</p>
<p>Example authorization object definition:</p>
<ul>
<li>
<p>Authorization object: <code>ZEMP_AUTH_OBJ</code></p>
</li>
<li>
<p>Field: <code>DEPT</code></p>
</li>
<li>
<p>Values assigned in user role (e.g., user only has DEPT = ‘HR’)</p>
</li>
</ul>
<p>Then when user runs the view:</p>
<ul>
<li>
<p>They will only see rows where <code>department = 'HR'</code>.</p>
</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/what-are-dcls-in-cds/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to create API to download an Excel sheet</title>
		<link>https://www.sapewmhelp.com/question/how-to-create-api-to-download-an-excel-sheet/</link>
					<comments>https://www.sapewmhelp.com/question/how-to-create-api-to-download-an-excel-sheet/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Sat, 06 Sep 2025 21:04:06 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=how-to-create-api-to-download-an-excel-sheet</guid>

					<description><![CDATA[create a CDS view custom Entity: @EndUserText.label: &#8216;template Download&#8217; @ObjectModel: { query: { implementedBy: &#8216;ABAP: ZCL_DOWN_TEMPLATE&#8217; } } define root custom entity ZCHM__TMP_DWN { key docnum : abap.char(10); comp_code : abap.char(4); sales_org : abap.char(4); distr_chn : abap.char(2); division : abap.char(2); ref_doc : abap.char(20); currency : abap.char(8); ref_item : abap.char(10); material : abap.char(40); matl_group : abap.char(9); [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>create a CDS view</p>
<p>custom Entity:</p>
<p style="margin: 0"><span style="color: #a99c8c">@EndUserText.label:</span> <span style="color: #a99c8c">&#8216;template Download&#8217;</span></p>
<p style="margin: 0"><span style="color: #a99c8c">@ObjectModel:</span> <span style="color: #a99c8c">{</span></p>
<p style="margin: 0"><span style="color: #a99c8c">query:</span> <span style="color: #a99c8c">{</span></p>
<p style="margin: 0"><span style="color: #a99c8c">implementedBy:</span> <span style="color: #a99c8c">&#8216;ABAP: ZCL_DOWN_TEMPLATE&#8217;</span></p>
<p style="margin: 0"><span style="color: #a99c8c">}</span></p>
<p style="margin: 0"><span style="color: #a99c8c">}</span></p>
<p style="margin: 0"><span style="color: #cc7832;font-weight: bold">define</span> <span style="color: #cc7832;font-weight: bold">root</span> <span style="color: #cc7832;font-weight: bold">custom</span> <span style="color: #cc7832;font-weight: bold">entity</span> Z<span style="color: #cccccc">CHM__TMP_DWN</span></p>
<p style="margin: 0"><span style="color: #cc7832;font-weight: bold">{</span></p>
<p style="margin: 0"><span style="color: #cc7832;font-weight: bold">key</span> <span style="color: #cccccc">docnum</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">10</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">comp_code</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">4</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">sales_org</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">4</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">distr_chn</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">2</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">division</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">2</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">ref_doc</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">20</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">currency</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">8</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">ref_item</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">10</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">material</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">40</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">matl_group</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">9</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">net_amount</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">40</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">gross</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">15</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">quantity</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">13</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">price_unit</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">5</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc">bill_unit</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">char</span><span style="color: #cc7832;font-weight: bold">(</span><span style="color: #5be9fe">3</span><span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cccccc;text-decoration: underline">file_content</span> <span style="color: #cc7832;font-weight: bold">:</span> <span style="color: #cccccc;font-style: italic;text-decoration: underline">abap</span><span style="color: #cc7832;font-weight: bold">.</span><span style="color: #cccccc;font-style: italic">string</span><span style="color: #cc7832;font-weight: bold">(</span> <span style="color: #5be9fe">999999999</span> <span style="color: #cc7832;font-weight: bold">);</span></p>
<p style="margin: 0"><span style="color: #cc7832;font-weight: bold">}</span></p>
<p>&nbsp;</p>
<p>then Create a Class where you can write you logic to create the template and pass the file content to the front end.</p>
<p>&nbsp;</p>
<div style="background-color: #1e1f22;padding: 0px 0px 0px 2px">
<div style="color: #cccccc;background-color: #1e1f22;font-size: 8pt">
<p style="margin: 0"><span style="color: #56a5e4;border: dashed 1pt #40abfe">CLASS</span><span style="color: #56a5e4"> </span><span style="color: #cccccc">zcl_down_template</span><span style="color: #56a5e4"> DEFINITION</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> PUBLIC FINAL</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> CREATE PUBLIC.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> PUBLIC SECTION.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> INTERFACES </span><span style="color: #cccccc">if_rap_query_provider</span><span style="color: #56a5e4">.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> PRIVATE SECTION.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> TYPES: BEGIN OF </span><span style="color: #cccccc">lty_template</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">docnum</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">Process_type</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">comp_code</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">sales_org</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">distr_chn</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">division</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">ref_doc</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">currency</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span><span style="color: #56a5e4"></span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">material</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">matl_group</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">net_amount</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">gross</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">quantity</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">price_unit</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">bill_unit</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">c</span><span style="color: #56a5e4"> LENGTH </span><span style="color: #5be9fe">40</span><span style="color: #56a5e4">,</span><span style="color: #56a5e4"></span></p>
<p style="margin: 0"><span style="color: #56a5e4"> END OF </span><span style="color: #cccccc">lty_template</span><span style="color: #56a5e4">.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> DATA </span><span style="color: #cccccc">et_result</span><span style="color: #56a5e4"> TYPE TABLE OF </span><span style="color: #cccccc">lty_template</span><span style="color: #56a5e4">.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> DATA </span><span style="color: #cccccc">es_result</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">lty_template</span><span style="color: #56a5e4">.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> DATA </span><span style="color: #cccccc">et_res</span><span style="color: #56a5e4"> TYPE TABLE OF z</span><span style="color: #cccccc">tmp_dwn</span><span style="color: #56a5e4">.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> DATA </span><span style="color: #cccccc">es_res</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">ztmp_dwn</span><span style="color: #56a5e4">.</span><span style="color: #56a5e4"></span></p>
<p style="margin: 0"><span style="color: #56a5e4;border: dashed 1pt #40abfe">ENDCLASS</span><span style="color: #56a5e4">.</span></p>
<p style="margin: 0"><span style="color: #56a5e4">CLASS </span><span style="color: #cccccc">zcl_down_template</span><span style="color: #56a5e4"> IMPLEMENTATION.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> METHOD </span><span style="color: #cccccc">if_rap_query_provider</span><span style="color: #56a5e4">~</span><span style="color: #cccccc">select</span><span style="color: #56a5e4">.</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #808080">&#8221; TODO: variable is assigned but never used (ABAP cleaner)</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> DATA(</span><span style="color: #cccccc">lr_skip</span><span style="color: #56a5e4">) = </span><span style="color: #cccccc">io_request</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">get_paging</span><span style="color: #56a5e4">( )-&gt;</span><span style="color: #cccccc">get_offset</span><span style="color: #56a5e4">( ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #808080">&#8221; TODO: variable is assigned but never used (ABAP cleaner)</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> DATA(</span><span style="color: #cccccc">lr_top</span><span style="color: #56a5e4">) = </span><span style="color: #cccccc">io_request</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">get_paging</span><span style="color: #56a5e4">( )-&gt;</span><span style="color: #cccccc">get_page_size</span><span style="color: #56a5e4">( ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> DATA </span><span style="color: #cccccc">lv_index_root</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">i</span><span style="color: #56a5e4"> VALUE </span><span style="color: #5be9fe">1</span><span style="color: #56a5e4">.</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> DATA </span><span style="color: #cccccc">lo_document</span><span style="color: #56a5e4"> TYPE REF TO </span><span style="color: #cccccc">if_xco_xlsx_wa_document</span><span style="color: #56a5e4">.</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> DATA </span><span style="color: #cccccc">lo_sheet</span><span style="color: #56a5e4"> TYPE REF TO </span><span style="color: #cccccc">if_xco_xlsx_wa_worksheet</span><span style="color: #56a5e4">.</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> DATA </span><span style="color: #cccccc">lv_sheet_name</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">string</span><span style="color: #56a5e4">.</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">lv_sheet_name</span><span style="color: #56a5e4"> = |</span><span style="color: #1eb540">Download_Template_</span><span style="color: #56a5e4">{ </span><span style="color: #cccccc">cl_abap_context_info</span><span style="color: #56a5e4">=&gt;</span><span style="color: #cccccc">get_system_date</span><span style="color: #56a5e4">( ) }|.</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">lo_document</span><span style="color: #56a5e4"> = </span><span style="color: #cccccc">xco_cp_xlsx</span><span style="color: #56a5e4">=&gt;</span><span style="color: #cccccc">document</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">empty</span><span style="color: #56a5e4">( )-&gt;</span><span style="color: #cccccc">write_access</span><span style="color: #56a5e4">( ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">lo_sheet</span><span style="color: #56a5e4"> = </span><span style="color: #cccccc">lo_document</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">get_workbook</span><span style="color: #56a5e4">( )-&gt;</span><span style="color: #cccccc">worksheet</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">at_position</span><span style="color: #56a5e4">( </span><span style="color: #cccccc">lv_index_root</span><span style="color: #56a5e4"> ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">lo_sheet</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">set_name</span><span style="color: #56a5e4">( </span><span style="color: #cccccc">iv_name</span><span style="color: #56a5e4"> = </span><span style="color: #cccccc">lv_sheet_name</span><span style="color: #56a5e4"> ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">et_result</span><span style="color: #56a5e4"> = VALUE #( </span><span style="color: #56a5e4">( </span><span style="color: #cccccc">docnum</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;ID&#8217;</span><span style="color: #56a5e4"> </span><span style="color: #cccccc">Process_type</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;Template&#8217;</span><span style="color: #56a5e4"> )</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> ( </span><span style="color: #cccccc">docnum</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;DOCNUM&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">Process_type</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;PAYTYPE&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">comp_code</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;COMP_CODE&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">sales_org</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;SALES_ORG&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">distr_chn</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;DISTR_CHAN&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">division</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;DIVISION&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">ref_doc</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;REF_DOC&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">currency</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;CURRENCY&#8217;</span><span style="color: #1eb540"></span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">material</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;MATERIAL&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">matl_group</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;MATL_GROUP&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">net_amount</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;NET_AMOUNT&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">gross</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;GROSS&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">quantity</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;QUANTITY&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">price_unit</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;PRICE_UNIT&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">bill_unit</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;BILL_UNIT&#8217;</span><span style="color: #56a5e4">)</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> ( </span><span style="color: #cccccc">docnum</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;*Document Number(10)&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">Process_type</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;*Process Type(4)&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">comp_code</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;*Company Code(4)&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">sales_org</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;*Sales Organization(4)&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">distr_chn</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;*Distribution Channel(2)&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">division</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;*Division&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">ref_doc</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;*Reference Document&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">currency</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;*Currency&#8217;</span><span style="color: #1eb540"></span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">ref_item</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;*Item No(10)&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">material</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;*Material(40)&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">matl_group</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;Material Group(9)&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">net_amount</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;NetAmount(15)&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">gross</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;Gross(15)&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">quantity</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;Quantuity(13)&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">price_unit</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;PriceUnit(5)&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">bill_unit</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;BillUnit(3)&#8217;</span><span style="color: #1eb540"></span><span style="color: #56a5e4"> ) ).</span></p>
<p>&nbsp;</p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> DATA(</span><span style="color: #cccccc">lo_pattern</span><span style="color: #56a5e4">) = </span><span style="color: #cccccc">xco_cp_xlsx_selection</span><span style="color: #56a5e4">=&gt;</span><span style="color: #cccccc">pattern_builder</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">simple_from_to</span><span style="color: #56a5e4">( )-&gt;</span><span style="color: #cccccc">get_pattern</span><span style="color: #56a5e4">( ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">lo_sheet</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">select</span><span style="color: #56a5e4">( </span><span style="color: #cccccc">lo_pattern</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> )-&gt;</span><span style="color: #cccccc">row_stream</span><span style="color: #56a5e4">(</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> )-&gt;</span><span style="color: #cccccc">operation</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">write_from</span><span style="color: #56a5e4">( REF #( </span><span style="color: #cccccc">et_result</span><span style="color: #56a5e4"> )</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> )-&gt;</span><span style="color: #cccccc">execute</span><span style="color: #56a5e4">( ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> DATA(</span><span style="color: #cccccc">ld_excel</span><span style="color: #56a5e4">) = </span><span style="color: #cccccc">lo_document</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">get_file_content</span><span style="color: #56a5e4">( ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> DATA(</span><span style="color: #cccccc">lv_base64_encoding</span><span style="color: #56a5e4">) = </span><span style="color: #cccccc">xco_cp</span><span style="color: #56a5e4">=&gt;</span><span style="color: #cccccc">xstring</span><span style="color: #56a5e4">( </span><span style="color: #cccccc">ld_excel</span><span style="color: #56a5e4"> )-&gt;</span><span style="color: #cccccc">as_string</span><span style="color: #56a5e4">( </span><span style="color: #cccccc">xco_cp_binary</span><span style="color: #56a5e4">=&gt;</span><span style="color: #cccccc">text_encoding</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">base64</span><span style="color: #56a5e4"> )-&gt;</span><span style="color: #cccccc">value</span><span style="color: #56a5e4">.</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">es_res</span><span style="color: #56a5e4">&#8211;</span><span style="color: #cccccc">file_content</span><span style="color: #56a5e4"> = </span><span style="color: #cccccc">lv_base64_encoding</span><span style="color: #56a5e4">.</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> APPEND </span><span style="color: #cccccc">es_res</span><span style="color: #56a5e4"> TO </span><span style="color: #cccccc">et_res</span><span style="color: #56a5e4">.</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> IF </span><span style="color: #cccccc">io_request</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">is_total_numb_of_rec_requested</span><span style="color: #56a5e4">( ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">io_response</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">set_total_number_of_records</span><span style="color: #56a5e4">( </span><span style="color: #cccccc">lines</span><span style="color: #56a5e4">( </span><span style="color: #cccccc">et_res</span><span style="color: #56a5e4"> ) ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> ENDIF.</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> IF </span><span style="color: #cccccc">io_request</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">is_data_requested</span><span style="color: #56a5e4">( ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">io_response</span><span style="color: #56a5e4">-&gt;</span><span style="color: #cccccc">set_data</span><span style="color: #56a5e4">( </span><span style="color: #cccccc">et_res</span><span style="color: #56a5e4"> ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> ENDIF.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> ENDMETHOD.</span></p>
<p style="margin: 0"><span style="color: #56a5e4">ENDCLASS.</span></p>
</div>
</div>
<p>&nbsp;</p>
<p>Now activate the class and expose it the service definition and at last create a web API v4 and pass the URL to the front person to fetch and download the excel sheet.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/how-to-create-api-to-download-an-excel-sheet/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Open SQL VS Native SQL</title>
		<link>https://www.sapewmhelp.com/question/open-sql-vs-native-sql/</link>
					<comments>https://www.sapewmhelp.com/question/open-sql-vs-native-sql/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Sun, 24 Aug 2025 11:25:36 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=open-sql-vs-native-sql</guid>

					<description><![CDATA[1. Open SQL ABAP’s database-independent SQL. Works on all supported DBs (HANA, Oracle, MSSQL, DB2, …). ABAP converts Open SQL statements into the database-specific SQL automatically. Ensures portability → same ABAP program runs regardless of underlying DB. Supports buffering (e.g., table buffers in SAP). Only a subset of SQL is allowed (the part SAP makes [&#8230;]]]></description>
										<content:encoded><![CDATA[<h5>1. <strong>Open SQL</strong></h5>
<ul>
<li><strong>ABAP’s database-independent SQL</strong>.</li>
<li>Works on <strong>all supported DBs</strong> (HANA, Oracle, MSSQL, DB2, …).</li>
<li>ABAP converts Open SQL statements into the <strong>database-specific SQL</strong> automatically.</li>
<li>Ensures <strong>portability</strong> → same ABAP program runs regardless of underlying DB.</li>
<li>Supports <strong>buffering</strong> (e.g., table buffers in SAP).</li>
<li>
<p>Only a <strong>subset of SQL</strong> is allowed (the part SAP makes portable).</p>
</li>
</ul>
<p>Example :</p>
<p>DATA: it_mara TYPE TABLE OF mara.</p>
<p>SELECT matnr mtart FROM mara<br />
INTO TABLE it_mara<br />
WHERE mtart = &#8216;FERT&#8217;.</p>
<ul>
<li>
<p>This works in <strong>any DB</strong> under SAP (Oracle, HANA, DB2, etc.).</p>
</li>
<li>
<p>Optimized by SAP kernel, can use table buffering.</p>
</li>
</ul>
<p>&nbsp;</p>
<h2 data-start="816" data-end="839">2. <strong>Native SQL</strong></h2>
<ul>
<li>
<p><strong>Database-specific SQL</strong>.</p>
</li>
<li>
<p>You write SQL directly for the underlying DBMS.</p>
</li>
<li>
<p>Executed via <strong>EXEC SQL … ENDEXEC</strong> or <strong>ADBC (ABAP Database Connectivity)</strong>.</p>
</li>
<li>
<p>No automatic portability → may not work if you change DB.</p>
</li>
<li>
<p><strong>No table buffering</strong> → always hits the DB.</p>
</li>
<li>
<p>Useful when:</p>
<ul>
<li>
<p>You need features not available in Open SQL (e.g., DB-specific functions, hints).</p>
</li>
<li>
<p>You want DB-level optimizations.</p>
</li>
</ul>
</li>
</ul>
<p>&nbsp;</p>
<p>Example:</p>
<p>&nbsp;</p>
<p>DATA: lv_matnr TYPE mara-matnr.</p>
<p>EXEC SQL.<br />
SELECT MATNR INTO :lv_matnr<br />
FROM MARA<br />
WHERE MTART = &#8216;FERT&#8217;<br />
ENDEXEC.</p>
<p>&nbsp;</p>
<p>This will only work if the DB syntax matches your system (e.g., Oracle-specific SQL won’t run on HANA).</p>
<p>&nbsp;</p>
<p><strong>Key Difference Summary:</p>
<p></strong></p>
<table>
<thead>
<tr>
<th>Feature</th>
<th><strong>Open SQL</strong></th>
<th><strong>Native SQL</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Portability</strong></td>
<td>DB-independent, portable</td>
<td>DB-dependent, not portable</td>
</tr>
<tr>
<td><strong>Syntax</strong></td>
<td>Subset of SQL, ABAP-friendly</td>
<td>Full DB SQL, DB-specific extensions</td>
</tr>
<tr>
<td><strong>Buffering</strong></td>
<td>Uses SAP buffering (if available)</td>
<td>Bypasses buffering, always DB access</td>
</tr>
<tr>
<td><strong>Performance</strong></td>
<td>Optimized by SAP kernel</td>
<td>Can be optimized manually at DB</td>
</tr>
<tr>
<td><strong>Use Case</strong></td>
<td>Most reports, standard programs</td>
<td>Special DB features, performance tuning, admin tasks</td>
</tr>
</tbody>
</table>
<p><strong> </strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/open-sql-vs-native-sql/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CDS View in Search Help</title>
		<link>https://www.sapewmhelp.com/question/cds-view-in-search-help/</link>
					<comments>https://www.sapewmhelp.com/question/cds-view-in-search-help/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Wed, 20 Aug 2025 07:30:33 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=cds-view-in-search-help</guid>

					<description><![CDATA[Search Help is essentially a value help / lookup mechanism that helps users find and select valid values for a field.When you see the F4 help in SAP GUI or the value help dialog in Fiori apps → that’s driven by Search Helps.   Steps to Create Search help Using CDS View. Step1 : create a [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Search Help is essentially a value help / lookup mechanism that helps users find and select valid values for a field.<br />When you see the F4 help in SAP GUI or the value help dialog in Fiori apps → that’s driven by Search Helps.  </p>
<p><strong>Steps to Create Search help Using CDS View.</strong></p>
<p>Step1 : create a CDS view</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/08/sh1.png" /></p>
<p>Step 2 : GOTO SE11 &#8211;&gt; Search Help In selection method add the CDS view SQL view name.</p>
<p>&nbsp;</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/08/sh2.png" /></p>
<p>Step 3 : Append it in the collective search Refer to the Append structure to add the elementary search in collective.</p>
<p><strong>Test:</strong></p>
<p><strong> <img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/08/sh3.png" /> </strong></p>
<p>Step 4 : In the collective search after append the structure we can call it in the program</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/08/sh4.png" /></p>
<p>&nbsp;</p>
<p>We have successfully created A search Help using CDS View.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/cds-view-in-search-help/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Extend an existing CDS view</title>
		<link>https://www.sapewmhelp.com/question/extend-an-existing-cds-view/</link>
					<comments>https://www.sapewmhelp.com/question/extend-an-existing-cds-view/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Thu, 07 Aug 2025 08:26:21 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=extend-an-existing-cds-view</guid>

					<description><![CDATA[Identify the Type of CDS View You Want to Extend There are different layers in RAP: Interface View (I_) Consumption/Projection View (C_ or ZC_) Data Definition View (Z_) Usually, you extend interface or projection views. Use the EXTEND VIEW Statement You can extend a CDS view using the EXTEND VIEW ABAP statement. extend view ZI_YOUR_ORIGINAL_VIEW [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Identify the Type of CDS View You Want to Extend</strong></p>
<p>There are different layers in RAP:</p>
<ul>
<li>Interface View (I_)</li>
<li>Consumption/Projection View (C_ or ZC_)</li>
<li>Data Definition View (Z_)</li>
</ul>
<p>Usually, you extend interface or projection views.</p>
<p><strong>Use the <code>EXTEND VIEW</code> Statement</strong></p>
<p>You can extend a CDS view using the <code>EXTEND VIEW</code> ABAP statement.</p>
<p>extend view ZI_YOUR_ORIGINAL_VIEW with ZI_YOUR_VIEW_EXTENSION {<br />
key YOUR_FIELD_1,<br />
YOUR_FIELD_2<br />
}</p>
</p>
<p><code>ZI_YOUR_ORIGINAL_VIEW</code> is the CDS view you&#8217;re extending.<br /><code>YOUR_FIELD_1</code>, <code>YOUR_FIELD_2</code> must be available in the underlying base table/view or added via association.</p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/extend-an-existing-cds-view/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>DDIC View vs CDS View</title>
		<link>https://www.sapewmhelp.com/question/ddic-view-vs-cds-view/</link>
					<comments>https://www.sapewmhelp.com/question/ddic-view-vs-cds-view/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Tue, 05 Aug 2025 19:01:32 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=ddic-view-vs-cds-view</guid>

					<description><![CDATA[Aspect DDIC View (ABAP Dictionary View) CDS View (Core Data Services View) Definition Tool Created using SE11 (Graphical interface) Created using ADT (Eclipse) with SQL-like DDL syntax Technology Base Classic SAP NetWeaver Modern SAP HANA / S/4HANA Definition Style GUI-based definition (drag-and-drop style) Text-based, code-centric with annotations Join Support Basic joins (Inner, Outer) Advanced joins [&#8230;]]]></description>
										<content:encoded><![CDATA[<table>
<thead>
<tr>
<th><strong>Aspect</strong></th>
<th><strong>DDIC View</strong> (ABAP Dictionary View)</th>
<th><strong>CDS View</strong> (Core Data Services View)</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Definition Tool</strong></td>
<td>Created using <strong>SE11</strong> (Graphical interface)</td>
<td>Created using <strong>ADT (Eclipse)</strong> with SQL-like DDL syntax</td>
</tr>
<tr>
<td><strong>Technology Base</strong></td>
<td>Classic SAP NetWeaver</td>
<td>Modern SAP HANA / S/4HANA</td>
</tr>
<tr>
<td><strong>Definition Style</strong></td>
<td>GUI-based definition (drag-and-drop style)</td>
<td>Text-based, code-centric with annotations</td>
</tr>
<tr>
<td><strong>Join Support</strong></td>
<td>Basic joins (Inner, Outer)</td>
<td>Advanced joins using <strong>associations</strong> and <strong>path expressions</strong></td>
</tr>
<tr>
<td><strong>Annotation Support</strong></td>
<td> Not supported</td>
<td> Yes – for UI, OData, analytical models, etc.</td>
</tr>
<tr>
<td><strong>Modularity / Reusability</strong></td>
<td> Limited</td>
<td> High – views can be composed and reused in layers</td>
</tr>
<tr>
<td><strong>Abstraction Layer</strong></td>
<td>Minimal abstraction</td>
<td>Full abstraction of business logic &amp; semantics</td>
</tr>
<tr>
<td><strong>Access Control</strong></td>
<td>Traditional authorization checks</td>
<td>Declarative via <strong>DCL (Data Control Language)</strong></td>
</tr>
<tr>
<td><strong>UI Integration (Fiori)</strong></td>
<td> Not supported</td>
<td> Fully supported with annotations</td>
</tr>
<tr>
<td><strong>OData Exposure</strong></td>
<td>Manual development required</td>
<td>Direct with <code>@OData.publish: true</code> annotation</td>
</tr>
<tr>
<td><strong>Analytical Capability</strong></td>
<td> Not suitable for analytics</td>
<td> Designed for <strong>OLAP</strong>, supports analytical queries</td>
</tr>
<tr>
<td><strong>HANA Optimization</strong></td>
<td>Limited pushdown capability</td>
<td>Fully optimized for <strong>HANA pushdown</strong> logic</td>
</tr>
<tr>
<td><strong>Extendibility</strong></td>
<td> Not extendable</td>
<td> Can be extended via <strong>CDS view extensions</strong></td>
</tr>
<tr>
<td><strong>Integration with RAP</strong></td>
<td> Not supported</td>
<td> Core to RAP-based app development</td>
</tr>
<tr>
<td><strong>Use Case Suitability</strong></td>
<td>Good for simple reports &amp; legacy ABAP scenarios</td>
<td>Ideal for <strong>modern SAP applications</strong>, analytics, and services</td>
</tr>
</tbody>
</table>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/ddic-view-vs-cds-view/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OLAP VS OLTP</title>
		<link>https://www.sapewmhelp.com/question/olap-vs-oltp/</link>
					<comments>https://www.sapewmhelp.com/question/olap-vs-oltp/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Tue, 05 Aug 2025 18:54:44 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=olap-vs-oltp</guid>

					<description><![CDATA[Feature OLTP OLAP Full Form Online Transaction Processing Online Analytical Processing Purpose Run daily operations Analyze and report on business data Operation Type Short, frequent transactions Complex queries, aggregations Data Volume Large number of small transactions Smaller number of large queries Performance Focus Speed of write operations Speed of read/analysis Data Structure Highly normalized Often [&#8230;]]]></description>
										<content:encoded><![CDATA[<table>
<thead>
<tr>
<th>Feature</th>
<th><strong>OLTP</strong></th>
<th><strong>OLAP</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Full Form</strong></td>
<td>Online Transaction Processing</td>
<td>Online Analytical Processing</td>
</tr>
<tr>
<td><strong>Purpose</strong></td>
<td>Run daily operations</td>
<td>Analyze and report on business data</td>
</tr>
<tr>
<td><strong>Operation Type</strong></td>
<td>Short, frequent transactions</td>
<td>Complex queries, aggregations</td>
</tr>
<tr>
<td><strong>Data Volume</strong></td>
<td>Large number of small transactions</td>
<td>Smaller number of large queries</td>
</tr>
<tr>
<td><strong>Performance Focus</strong></td>
<td>Speed of write operations</td>
<td>Speed of read/analysis</td>
</tr>
<tr>
<td><strong>Data Structure</strong></td>
<td>Highly normalized</td>
<td>Often denormalized (e.g., star schema)</td>
</tr>
<tr>
<td><strong>Examples</strong></td>
<td>Insert/update orders, banking</td>
<td>Sales analysis, reporting, BI dashboards</td>
</tr>
<tr>
<td><strong>Users</strong></td>
<td>Front-line staff, operational users</td>
<td>Managers, analysts, decision-makers</td>
</tr>
</tbody>
</table>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/olap-vs-oltp/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Row Store VS Column Store Database ?</title>
		<link>https://www.sapewmhelp.com/question/row-store-vs-column-store-database/</link>
					<comments>https://www.sapewmhelp.com/question/row-store-vs-column-store-database/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Tue, 05 Aug 2025 18:53:21 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=row-store-vs-column-store-database</guid>

					<description><![CDATA[Feature Row Store Column Store Data Layout Row by row Column by column Best Use Case OLTP (transactions) OLAP (analytics, reporting) Read Performance Good for full row reads Excellent for column-specific reads Write Performance Fast for row-level writes Slower for frequent updates/inserts Compression Lower Higher Aggregations &#38; Filters Slower Much faster]]></description>
										<content:encoded><![CDATA[<table>
<thead>
<tr>
<th>Feature</th>
<th><strong>Row Store</strong></th>
<th><strong>Column Store</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>Data Layout</td>
<td>Row by row</td>
<td>Column by column</td>
</tr>
<tr>
<td>Best Use Case</td>
<td>OLTP (transactions)</td>
<td>OLAP (analytics, reporting)</td>
</tr>
<tr>
<td>Read Performance</td>
<td>Good for full row reads</td>
<td>Excellent for column-specific reads</td>
</tr>
<tr>
<td>Write Performance</td>
<td>Fast for row-level writes</td>
<td>Slower for frequent updates/inserts</td>
</tr>
<tr>
<td>Compression</td>
<td>Lower</td>
<td>Higher</td>
</tr>
<tr>
<td>Aggregations &amp; Filters</td>
<td>Slower</td>
<td>Much faster</td>
</tr>
</tbody>
</table>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/row-store-vs-column-store-database/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Types of Association in CDS ?</title>
		<link>https://www.sapewmhelp.com/question/types-of-association-in-cds/</link>
					<comments>https://www.sapewmhelp.com/question/types-of-association-in-cds/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Tue, 05 Aug 2025 18:50:30 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=types-of-association-in-cds</guid>

					<description><![CDATA[Exposed Associations An exposed association is one that is defined in a CDS view and is made available (exposed) to consumers of the view — such as other CDS views, analytical queries, or OData services. You define the association using the association [&#8230;] to clause and then expose it using an alias (typically starting with [&#8230;]]]></description>
										<content:encoded><![CDATA[<h5><strong>Exposed Associations</strong></h5>
<p>An <strong>exposed association</strong> is one that is <strong>defined</strong> in a CDS view and is <strong>made available (exposed)</strong> to consumers of the view — such as other CDS views, analytical queries, or OData services. You define the association using the association [&#8230;] to clause and then expose it using an alias (typically starting with an underscore _) in the SELECT list.</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-js" data-lang="JavaScript"><code><!--StartFragment --><span><span>define </span>view ZI_SalesOrder <span>as </span><span>select </span><span>from </span>ZSalesOrderHeader
{
    <span>key </span>SalesOrderID<span>,</span>
    CustomerID<span>,</span>

    association [0<span>.</span><span>.</span>1] <span>to </span>ZI_Customer <span>as </span>_Customer 
        <span>on </span>_Customer<span>.</span>CustomerID <span>= </span>ZSalesOrderHeader<span>.</span>CustomerID

    // Exposing the association
    _Customer
}</span> </code></pre>
<p><strong>Key Points:</strong></p>
<ul>
<li>You can reuse exposed associations in other views.</li>
<li>Useful in modular CDS design.</li>
<li>Can be traversed via path expressions (e.g., _Customer.Name).</li>
</ul>
<h5><strong>Ad-hoc Associations</strong></h5>
<p>Ad-hoc associations are associations that are used inline (on-the-fly) via path expressions, without needing to expose the association explicitly in the SELECT list. If an association (like _Customer) is already defined in a view (exposed or implicit), you can use it ad-hoc in the SELECT or WHERE clause without re-exposing it.</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code><!--StartFragment --><span><span>define </span>view ZI_SalesOrder <span>as </span><span>select </span><span>from </span>ZSalesOrderHeader
{
    <span>key </span>SalesOrderID<span>,</span>
    _Customer<span>.</span>Name    // Ad<span>-</span>hoc usage <span>of </span>the association
}
</span> </code></pre>
<p>Key Points:</p>
<ul>
<li>No need to expose <code>_Customer</code> again in the select list.</li>
<li>You&#8217;re just traversing the association to access fields of the target entity.</li>
<li>Makes CDS views more compact and readable.</li>
</ul>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/types-of-association-in-cds/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
