<?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 &#8211; SAP EWM Help</title>
	<atom:link href="https://www.sapewmhelp.com/question-tag/cds/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>Search Help and Value Help in SAP RAP (RESTful ABAP Programming Model)</title>
		<link>https://www.sapewmhelp.com/question/search-help-and-value-help-in-sap-rap-restful-abap-programming-model/</link>
					<comments>https://www.sapewmhelp.com/question/search-help-and-value-help-in-sap-rap-restful-abap-programming-model/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Fri, 05 Sep 2025 19:46:18 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=search-help-and-value-help-in-sap-rap-restful-abap-programming-model</guid>

					<description><![CDATA[search help/value help is not implemented in the classic way (with SE11 search helps + F4 help). Instead, RAP follows the Fiori and OData paradigm: Search Help (free text search): Implemented via @Search annotations on CDS views. Value Help (F4 help / dropdowns): Implemented via associations + @Consumption.valueHelpDefinition annotations. 1. Search Help in RAP Search [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>search help/value help</strong> is not implemented in the classic way (with SE11 search helps + F4 help). Instead, RAP follows the <strong>Fiori and OData paradigm</strong>:</p>
<ul>
<li><strong>Search Help (free text search):</strong> Implemented via <code>@Search</code> annotations on CDS views.</li>
<li><strong>Value Help (F4 help / dropdowns):</strong> Implemented via associations + <code>@Consumption.valueHelpDefinition</code> annotations.</li>
</ul>
<h5>1. Search Help in RAP</h5>
<p>Search is enabled using annotations in the <strong>Projection View</strong> or <strong>Consumption View</strong>.</p>
<p>@Search.searchable: true<br />define view entity ZI_Book<br />as select from zbook<br />{<br />key book_id,<br />title,<br />author,<br />publisher<br />}</p>
<ul>
<li><code>@Search.searchable: true</code> → Allows free-text search across all fields.</li>
<li>You can refine it:</li>
</ul>
<p>@Search.defaultSearchElement: true<br />title,</p>
<p>@Search.defaultSearchElement: true<br />author</p>
<p>&nbsp;</p>
<h5>2. Value Help in RAP</h5>
<p>For dropdowns or F4 helps, you define <strong>associations</strong> and annotate them.</p>
<h6>Step 1: Define Value Help View</h6>
<p>@EndUserText.label: &#8216;Value Help for Publishers&#8217;<br />define view entity ZI_PublisherVH<br />as select from zpublisher<br />{<br />key publisher_id,<br />name<br />}</p>
<p>&nbsp;</p>
<h6>Step 2: Add Association in Main View</h6>
<p>define view entity ZI_Book<br />as select from zbook<br />association [0..1] to ZI_PublisherVH as _Publisher<br />on $projection.publisher_id = _Publisher.publisher_id<br />{<br />key book_id,<br />title,<br />publisher_id,<br />_Publisher<br />}</p>
<p>&nbsp;</p>
<h6>Step 3: Annotate Value Help</h6>
<p>@Consumption.valueHelpDefinition: [<br />{ entity: { name: &#8216;ZI_PublisherVH&#8217;, element: &#8216;publisher_id&#8217; } }<br />]<br />publisher_id,</p>
<p>&nbsp;</p>
<p>Now in Fiori, <code>publisher_id</code> will show F4 help with dropdown based on <code>ZI_PublisherVH</code>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/search-help-and-value-help-in-sap-rap-restful-abap-programming-model/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Abstract Entity In RAP</title>
		<link>https://www.sapewmhelp.com/question/abstract-entity-in-rap/</link>
					<comments>https://www.sapewmhelp.com/question/abstract-entity-in-rap/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Tue, 02 Sep 2025 19:45:00 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=abstract-entity-in-rap</guid>

					<description><![CDATA[Abstract Entity. A CDS abstract entity defines the type attributes of a CDS entity without defining a database object. CDS abstract entities can be used as  data types whose type attributes go beyond the regular DDIC structures in the ABAP Dictionary prototype definitions of data models without being created as instances of a data object. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Abstract Entity.</strong><br />
A CDS abstract entity defines the type attributes of a CDS entity without defining a database<br />
object.<br />
<strong>CDS abstract entities can be used as</strong></p>
<ul>
<li> data types whose type attributes go beyond the regular DDIC structures in the ABAP Dictionary</li>
<li>prototype definitions of data models without being created as instances of a data object.</li>
</ul>
<p><strong>Example:</strong><br />
Administrators can update a seller&#8217;s email via a &#8220;Update Email&#8221; button in the Seller Details form.Clicking the button opens a popup modal displaying the current email, an input field for the newemail, and an optional reason for the update. Validation ensures the new email has a proper format and is not duplicated. On save, an abstract entity processes the update, and the system<br />
records the change for compliance.</p>
<p><strong>Create a CDS abstract entity</strong></p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/a1.png" /></p>
<p>Add it using action in Behavior definition.</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/a2.png" /></p>
<p>Implement the method and modify the field.</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/a3.png" /></p>
<p>In Preview Screen → Before email update</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/a4.png" /></p>
<p>Email field updated</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/a5.png" /></p>
<p><strong>Conclusion:</strong><br />
Abstract entities in RAP applications provide a powerful framework for enhancing modularity, scalability, and reusability by encapsulating shared business logic and ensuring consistent behavior across root entities. This is particularly evident in scenarios like updating a seller&#8217;s email, where an abstract entity centralizes the handling of operations such as validation, transformation, and automated updates. The use of a popup modal for updates, paired with the abstract entity&#8217;s logic, ensures a user-friendly experience, streamlined workflows, and systemwide synchronization. This approach aligns with clean architecture principles, resulting in robust, maintainable, and adaptable applications capable of efficiently meeting current and future requirements.</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/abstract-entity-in-rap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Employee management APP in RAP</title>
		<link>https://www.sapewmhelp.com/question/employee-management-app-in-rap/</link>
					<comments>https://www.sapewmhelp.com/question/employee-management-app-in-rap/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Mon, 01 Sep 2025 19:55:20 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=employee-management-app-in-rap</guid>

					<description><![CDATA[Employee management APP.   Firstly, Create an employee table with the draft à zemployee_01 Create a draft table. à zemployee_01_d Create a class to insert the data. à zdpm_populate_empoyee Create a CDS root view entity  à zdpm_employee_transapp Create a projection, View. à zcl_employee_trans. Now create a metadata extension with UI annotation à zdpm_employee_transapp &#160; Create [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Employee management APP.</strong></p>
<p><strong> </strong></p>
<p><strong>Firstly, </strong></p>
<p>Create an employee table with the draft à zemployee_01</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e1.png" /></p>
<p>Create a draft table. à zemployee_01_d</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e2.png" /></p>
<p>Create a class to insert the data. à zdpm_populate_empoyee</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e3.png" /></p>
<p>Create a CDS root view entity  à zdpm_employee_transapp</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e4.png" /></p>
<p>Create a projection, View. à zcl_employee_trans.</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e5.png" /></p>
<p>Now create a metadata extension with UI annotation à zdpm_employee_transapp</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e6.png" /></p>
<p>&nbsp;</p>
<p>Create managed implementation on CUD operations.</p>
<p>Behavior Definition.</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e8.png" /></p>
<p>Make the class using the code below à zdp_i_employee_transapp</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e9.png" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Create a local classà lcl_</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e10.png" /></p>
<p>Create a business projection for business object. à zc_employee_transapp</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e11.png" /></p>
<p>Create a service definition.</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e12.png" /></p>
<p>Choose the <strong>defined service.</strong></p>
<p>Use the projection view name</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e13.png" /></p>
<p>Now create the service binding</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e14.png" /></p>
<p>If the service is not getting published, then change it to OData V2- UI.</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e15.png" /></p>
<p>Now publish it, you will get the entity set then login to the Fiori application.</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e16.png" /></p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e17-1.png" /></p>
<p>Goto the service URL.</p>
<p>Login in and click on the <strong>GO</strong> to view the data.</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e18.png" /></p>
<p>Now click on the row and you will find the detailed information.</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e19.png" /></p>
<p>You can add the filer based on the fields like:</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e20.png" /></p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/09/e21.png" /></p>
<p>&nbsp;</p>
<p><strong>Completed. </strong></p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/employee-management-app-in-rap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to create a web api using custom entity</title>
		<link>https://www.sapewmhelp.com/question/how-to-create-a-web-api-using-custom-entity/</link>
					<comments>https://www.sapewmhelp.com/question/how-to-create-a-web-api-using-custom-entity/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Wed, 27 Aug 2025 10:06:50 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=how-to-create-a-web-api-using-custom-entity</guid>

					<description><![CDATA[A Custom Entity in RAP is like a virtual data model — it does not persist data in a DB table, but fetches it from logic (e.g., CDS views, APIs, function modules, or custom code). It is exposed via a behavior definition and then published as an OData/Web API service. 1. Create a Custom Entity [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>A <strong>Custom Entity</strong> in RAP is like a <strong>virtual data model</strong> — it does <strong>not persist data in a DB table</strong>, but fetches it from logic (e.g., CDS views, APIs, function modules, or custom code).</p>
<p>It is exposed via a <strong>behavior definition</strong> and then published as an <strong>OData/Web API service</strong>.</p>
</p>
<p><strong>1. Create a Custom Entity in CDS</strong></p>
<p>@EndUserText.label: &#8216;Custom Employee API Entity&#8217;<br />
define custom entity ZC_EMPLOYEE_API {<br />
key empid : abap.char(10);<br />
empname : abap.char(40);<br />
department: abap.char(20);<br />
}</p>
</p>
<p><strong>2. Define a Behavior Implementation (Handler Class)</strong></p>
<p>CLASS zcl_employee_handler DEFINITION<br />
PUBLIC FINAL CREATE PUBLIC.<br />
PUBLIC SECTION.<br />
INTERFACES if_rap_query_provider.<br />
ENDCLASS.</p>
<p>CLASS zcl_employee_handler IMPLEMENTATION.<br />
METHOD if_rap_query_provider~select.<br />
DATA lt_data TYPE TABLE OF zc_employee_api.</p>
<p>&#8220;Fetch data (from table, FM, RFC, etc.)<br />
SELECT empid, empname, dept AS department<br />
FROM zemployees<br />
INTO TABLE @lt_data.</p>
<p>&#8220;Return data<br />
result = CORRESPONDING #( lt_data ).<br />
ENDMETHOD.<br />
ENDCLASS.</p>
<p>&nbsp;</p>
<p><strong>3. Register Service in Service Definition</strong></p>
<p>@EndUserText.label: &#8216;Employee API Service&#8217;<br />
define service ZUI_EMPLOYEE_API {<br />
expose ZC_EMPLOYEE_API;<br />
}</p>
<p>&nbsp;</p>
<p><strong>4. Publish via Service Binding</strong></p>
<ul>
<li>Create a <strong>Service Binding</strong> (<code>ZUI_EMPLOYEE_API_BIND</code>).</li>
<li>Choose <strong>OData V4</strong> as binding type.</li>
<li>Activate it → SAP generates a URL endpoint.</li>
</ul>
<p>/sap/opu/odata4/sap/zui_employee_api/srvd_a2x/sap/zui_employee_api/0001/</p>
<p>&nbsp;</p>
<p><strong>5. Test the API</strong></p>
<ul>
<li>
<p>Use <code>/IWFND/MAINT_SERVICE</code> (for OData V2 in SEGW) or Fiori Preview (for OData V4).</p>
</li>
<li>
<p>Run the URL in browser or Postman:</p>
</li>
</ul>
<p>GET &#8230;/ZC_EMPLOYEE_API</p>
<p>&nbsp;</p>
<h5>Summary</h5>
<ul>
<li>
<p><strong>Custom Entity</strong> = Virtual CDS entity (no table).</p>
</li>
<li>
<p>Implement a <strong>handler class</strong> to supply data.</p>
</li>
<li>
<p>Expose it in a <strong>service definition</strong>.</p>
</li>
<li>
<p>Bind it with <strong>service binding</strong> (OData V2/V4).</p>
</li>
<li>
<p>Test via Fiori preview or Postman.</p>
</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/how-to-create-a-web-api-using-custom-entity/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>Role of Custom CDS Views in SAP RAP</title>
		<link>https://www.sapewmhelp.com/question/role-of-custom-cds-views-in-sap-rap/</link>
					<comments>https://www.sapewmhelp.com/question/role-of-custom-cds-views-in-sap-rap/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Fri, 22 Aug 2025 18:59:48 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=role-of-custom-cds-views-in-sap-rap</guid>

					<description><![CDATA[Custom CDS Views in SAP RAP (RESTful ABAP Programming Model) are used to model and expose business data from existing SAP tables, standard CDS views, or other data sources. They let business users or developers combine, filter, and project data without writing ABAP code, making them the foundation for creating RAP Business Objects or OData [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Custom CDS Views in SAP RAP (RESTful ABAP Programming Model) are used to model and expose business data from existing SAP tables, standard CDS views, or other data sources. They let business users or developers combine, filter, and project data without writing ABAP code, making them the foundation for creating <strong>RAP Business Objects</strong> or <strong>OData services</strong>.</p>
<p>They act as a semantic layer that simplifies data consumption, allowing RAP BOs to work with ready-to-use data models that follow SAP extensibility rules.</p>
<h3 data-start="641" data-end="693">Example : Join Sales Order Header and Item</h3>
<ul>
<li>
<p><strong>Business Requirement</strong>: A key user wants to see <strong>Sales Order header information</strong> along with <strong>Item details</strong> in a single service.</p>
</li>
<li>
<p><strong>Custom CDS View</strong>:</p>
<ul>
<li>
<p>Data Source 1 → <code>I_SalesOrder</code> (standard CDS for sales order header)</p>
</li>
<li>
<p>Data Source 2 → <code>I_SalesOrderItem</code> (standard CDS for items)</p>
</li>
<li>
<p>Join Condition → <code>SalesOrder = SalesOrder</code></p>
</li>
<li>
<p>Fields Selected → <code>SalesOrderID, SalesOrderDate, CustomerID, ProductID, Quantity</code></p>
</li>
</ul>
</li>
<li>
<p><strong>Usage in RAP</strong>: This Custom CDS View can be exposed as an OData API in RAP, and consumed in a Fiori Elements app for Sales Order analysis.</p>
</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/role-of-custom-cds-views-in-sap-rap/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>
	</channel>
</rss>
