https://raw.githubusercontent.com/ajmaradiaga/feeds/main/scmt/topics/ABAP-Development-blog-posts.xmlSAP Community - ABAP Development2025-01-24T06:00:03.210005+00:00python-feedgenABAP Development blog posts in SAP Communityhttps://community.sap.com/t5/technology-blogs-by-members/how-to-control-events-on-user-decision-before-after-the-decision-made/ba-p/13973694How to Control Events on User Decision Before/After the Decision Made2025-01-03T15:39:05.090000+01:00MertSoylemishttps://community.sap.com/t5/user/viewprofilepage/user-id/178171<P>Hello everyone,</P><P><SPAN>There was a requirement in a project that the users wants developments before and after the users made their decisions. As the developers we decided to use the program exits in a tab of the User Decision step. In this step we can call a global class and with an interface that I am going to mention below, we can see the workitem details and we can control the start time for our development by the parameters of the interface.</SPAN></P><P>In this blog I will show you how can you use the program exits in the User Decision step and what is the interface for the global class.</P><H3 id="toc-hId-1207527613">1. Where is the program exit and how we use it.</H3><P>The program exits are in the steps of workflows that we create task inside like User Decision, Activity, Send Mail etc. I will continue on User Decision step so we can see how to control decisions before and after made.</P><P>When we double click on User Decision step we can see the Program Exits tab as show below. </P><P> <span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="USER DECISION.png" style="width: 345px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206306i81AE9FF4C6588B1D/image-dimensions/345x143?v=v2" width="345" height="143" role="button" title="USER DECISION.png" alt="USER DECISION.png" /></span><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Program exit ekranı.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206307i8105B8BC981A4C99/image-size/medium?v=v2&px=400" role="button" title="Program exit ekranı.png" alt="Program exit ekranı.png" /></span></P><P>We need to create a Z Class and give the interface IF_SWF_IFS_WORKITEM_EXIT in the class.</P><H5 id="toc-hId-1269179546">1.1 How we can have benefit from the Interfaces?</H5><P>There are two parameters of that interface which is; IM_EVENT_NAME and IM_WORKITEM_CONTEXT.</P><P>We can reach when the class is triggered by the IM_EVENT_NAME.</P><P>IM_EVENT_NAME contains the domain values as below;</P><UL><LI>BEF_CREAT Before Creation</LI><LI>CREATED After Creation</LI><LI>BEF_EXEC Before Execution</LI><LI>AFT_EXEC After Execution</LI><LI>AFT_ASYINV After Execution of a Synchronous Object Method</LI><LI>BEF_REMOVE Before Physical Deletion</LI><LI>STATE_CHG After a Status Change</LI><LI>AFT_REXEC After Rule Execution</LI><LI>AFT_ACTION After an Action</LI><LI>BEF_ACTION Before an Action</LI><LI>BEF_DECI Before Execution of a User Decision </LI></UL><P>IM_WORKITEM_CONTEXT contains another interface which is IF_WAPI_WORKITEM_CONTEXT and there are many methods that we can use for our cases.</P><H5 id="toc-hId-1072666041">1.2 Create your Z Class</H5><P>Create a global class and give the interface to it. By doing that you will be able to reach the method EVENT_RAISED.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Interface ekranı.png" style="width: 468px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206309i9DA04F209E042B3F/image-dimensions/468x211?v=v2" width="468" height="211" role="button" title="Interface ekranı.png" alt="Interface ekranı.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="method ekranı.png" style="width: 464px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206308iF5C8E7501BF76087/image-dimensions/464x211?v=v2" width="464" height="211" role="button" title="method ekranı.png" alt="method ekranı.png" /></span></P><P>Make your coding inside the method and don't forget to control it by IM_EVENT_NAME.</P><H3 id="toc-hId-617987098"><STRONG>2. Trigger The Workflow</STRONG></H3><P><SPAN>Now we all set. Trigger your workflow by your process. Once the workflow is triggered it can be seen from transaction SWIA.</SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SWIA.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206310i1D47314F78C94D38/image-size/medium?v=v2&px=400" role="button" title="SWIA.png" alt="SWIA.png" /></span></P><H3 id="toc-hId-421473593">3. How can we debug the method?</H3><P>When the workflow reaches the step that you implemented a program exit, the class is triggered and by the IM_EVENT_NAME we can check the time we want to control.</P><P>Place an external debug for user SAP_WFRT in the EVENT_RAISED method of Z class.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MertSoylemis_8-1735634344778.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206297i279FF880D9592657/image-size/medium?v=v2&px=400" role="button" title="MertSoylemis_8-1735634344778.png" alt="MertSoylemis_8-1735634344778.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MertSoylemis_9-1735634344793.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206298iBDF5C0CDE37464EA/image-size/medium?v=v2&px=400" role="button" title="MertSoylemis_9-1735634344793.png" alt="MertSoylemis_9-1735634344793.png" /></span></P><H3 id="toc-hId-224960088">3. Find the Parameters You Need</H3><P>When we are in the debug we can see the parameters as below and every step of user decision the IM_EVENT_NAME will be changed.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MertSoylemis_13-1735634769784.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206303i94D1F2F7B510C508/image-size/medium?v=v2&px=400" role="button" title="MertSoylemis_13-1735634769784.png" alt="MertSoylemis_13-1735634769784.png" /></span></P><P>In the IN_WORKITEM_CONTEXT You can reach the Node ID and Task ID clearly. And inside the M_CONTAINER we can reach the Workitem ID(WI_ID).</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MertSoylemis_14-1735634936822.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206304iBBEEE0C2144583CD/image-size/medium?v=v2&px=400" role="button" title="MertSoylemis_14-1735634936822.png" alt="MertSoylemis_14-1735634936822.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MertSoylemis_15-1735634960046.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206305i3362D0B02806667F/image-size/medium?v=v2&px=400" role="button" title="MertSoylemis_15-1735634960046.png" alt="MertSoylemis_15-1735634960046.png" /></span></P><P>By calling the <SPAN>GET_WI_CONTAINER method of the IM_WORKITEM_CONTEXT parameter we can reach the container elements that we send to the user decision.</SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MertSoylemis_13-1735634769784.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206303i94D1F2F7B510C508/image-size/medium?v=v2&px=400" role="button" title="MertSoylemis_13-1735634769784.png" alt="MertSoylemis_13-1735634769784.png" /></span></P><P>The container elements will be shown in the MT_ELEMENTS tab.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MertSoylemis_12-1735634727703.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206302i2E0624151230060D/image-size/medium?v=v2&px=400" role="button" title="MertSoylemis_12-1735634727703.png" alt="MertSoylemis_12-1735634727703.png" /></span></P><H3 id="toc-hId-28446583"><STRONG>Conclusion :</STRONG></H3><P><SPAN>Now you can design your workflow and check the steps of the User Decision if it's on the after creation, before execution etc. and make your development.</SPAN><BR /><BR /><SPAN>Thanks for your time.</SPAN><BR /><BR /><SPAN>If you think this blog is helpful please do not forget to like and share. <span class="lia-unicode-emoji" title=":slightly_smiling_face:">🙂</span></SPAN></P>2025-01-03T15:39:05.090000+01:00https://community.sap.com/t5/technology-blogs-by-members/switching-from-alv-gui-to-list-report-fiori-restful-abap-programming-is-now/ba-p/13974211Switching from ALV GUI to List Report Fiori RESTful Abap Programming is now easy2025-01-03T15:44:27.909000+01:00SamyDhttps://community.sap.com/t5/user/viewprofilepage/user-id/40609<H2 id="toc-hId-1078470590">List report read-only </H2><P>In this topic will create a simple Fiori List Report without object page. It's recommended to use odata v4 but here we will create both v2 and v4</P><H3 id="toc-hId-1011039804">CDS Model </H3><P>The CDS model is driven by the <A href="https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee6ff9b281d8448f96b4fe6c89f2bdc8/8573b810511948c8a99c0672abc159aa.html" target="_self" rel="noopener noreferrer">VDM</A>(Virtual data model) which follow consistent modeling and naming rules.</P><H4 id="toc-hId-943609018">View entity Basics/Composites</H4><P>Create new data definition language in ADT(need eclipse <span class="lia-unicode-emoji" title=":grinning_face:">😀</span> )</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="01.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206370i856EB2196E579BA2/image-size/large?v=v2&px=999" role="button" title="01.png" alt="01.png" /></span></P><P>DDIC view based are obsoletes, so we only use view entity.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="02.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206374iBE69F208E983FD95/image-size/large?v=v2&px=999" role="button" title="02.png" alt="02.png" /></span></P><P>We don't use table directly beceause it's not clean core, instead we use release CDS, you can see this if they are flagged with "#PUBLIC_LOCAL_API" or release C1 contract in API State.</P><P>Now fill your new CDS :</P><P> </P><pre class="lia-code-sample language-abap"><code>@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'CDS basic purchase orders'
define view entity ZI_MyPurchaseOrders
as select from I_PurchaseOrderAPI01
{
key PurchaseOrder,
PurchaseOrderType,
PurchaseOrderSubtype,
PurchasingDocumentOrigin,
CreatedByUser,
CreationDate,
PurchaseOrderDate,
CashDiscount1Percent,
CashDiscount1Days,
@Semantics.amount.currencyCode: 'DocumentCurrency'
DownPaymentAmount,
DocumentCurrency
}</code></pre><P> </P><P>Compile your CDS, and if you want you can add documentation :</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="03.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206376i593535FEDCFF244B/image-size/large?v=v2&px=999" role="button" title="03.png" alt="03.png" /></span></P><P>Now you can fill your own documentation</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="04.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206377iE73B75CEE21DF16C/image-size/large?v=v2&px=999" role="button" title="04.png" alt="04.png" /></span></P><P>And if you refresh your CDS you can open your documentation or if you press F2 on your object you can see documentation with definition</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="05.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206378iF819CD872209C0E2/image-size/large?v=v2&px=999" role="button" title="05.png" alt="05.png" /></span></P><P>Now we will create our root view entity but you can also create other CDS levels between the two.</P><P>The root view entity is the last level before projection view. We'll go into more detail in the object section on page</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="06.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206379i5DD7D73AACC59991/image-size/large?v=v2&px=999" role="button" title="06.png" alt="06.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="07.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206380i97378B3C5BCAF7F6/image-size/large?v=v2&px=999" role="button" title="07.png" alt="07.png" /></span></P><P>You can use the code below</P><P> </P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'CDS root purchase orders'
define root view entity ZR_MyPurchaseOrders
as select from ZI_MyPurchaseOrders
{
key PurchaseOrder,
PurchaseOrderType,
PurchaseOrderSubtype,
PurchasingDocumentOrigin,
CreatedByUser,
CreationDate,
PurchaseOrderDate,
CashDiscount1Percent,
CashDiscount1Days,
DownPaymentAmount,
DocumentCurrency
}</code></pre><P> </P><P>Compile</P><H4 id="toc-hId-747095513">View entity Projection View</H4><P>Now you need to create the top level view. Only the fields you have in this view can be displayed.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="08.png" style="width: 548px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206383iA977A2D9FAA2C8A3/image-size/large?v=v2&px=999" role="button" title="08.png" alt="08.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="09.png" style="width: 549px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206384i7C74DED1292FCB08/image-size/large?v=v2&px=999" role="button" title="09.png" alt="09.png" /></span></P><P> </P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'CDS Projection view Purchase Orders'
define root view entity ZC_MYPURCHASEORDERS
provider contract transactional_query
as projection on ZR_MyPurchaseOrders
{
key PurchaseOrder,
PurchaseOrderType,
PurchaseOrderSubtype,
PurchasingDocumentOrigin,
CreatedByUser,
CreationDate,
PurchaseOrderDate,
CashDiscount1Percent,
CashDiscount1Days,
DownPaymentAmount,
DocumentCurrency
}</code></pre><P> </P><P>As you're pointing to a root cds view, you need to specify the root instruction in the projection view too.</P><P>Also you need to provide a contract, for our example it's "transactional_query", you can bypass this but it's not recommended.</P><P>Compile</P><H4 id="toc-hId-550582008">Metadata Extension</H4><P>The metadata extension is used to arrange elements on the UI application with annotations. You can have multiple levels of <A href="https://help.sap.com/docs/abap-cloud/abap-data-models/metadata-extensions" target="_self" rel="noopener noreferrer">metadata extension</A>. </P><H5 id="toc-hId-483151222">Add fields position in table</H5><P>By default, no fields will be displayed. To achieve this, we're going to add annotations at the CDS level (where they can also be added in the frontend application).</P><P>So firstly you need to add this annotation in your projection view</P><P> </P><pre class="lia-code-sample language-abap"><code>@Metadata.allowExtensions: true</code></pre><P> </P><P>Then to add a field in first position you'll use this annotation</P><P> </P><pre class="lia-code-sample language-abap"><code>"""Metadata extension """
@UI.lineItem: [{ position: 10 },{ importance: #HIGH }]</code></pre><P> </P><P>Increment from 10 to 10 to make reworking easier if you've got a position wrong.</P><H5 id="toc-hId-286637717">Add selection fields(filters) position in table</H5><P> </P><pre class="lia-code-sample language-abap"><code>"""Metadata extension """
@UI.selectionField: [{ position: 10 }]</code></pre><P> </P><H5 id="toc-hId-90124212">Add value helps</H5><P>To add value helps your have two options, one with relationship with foreign key and the second with cds view</P><P>We focus only on the second option. To do this, we'll need a cds view of type value help, which we'll call up and which will return all the values in the database.</P><P> </P><pre class="lia-code-sample language-abap"><code>@Consumption.valueHelpDefinition: [{ entity : {name: '/DMO/I_AGENCY_STDVH', element: 'AgencyID' } }]</code></pre><P> </P><H5 id="toc-hId--106389293">Create and fill your metadata extension</H5><P>Now that we have the three default annotations for a correct list report, we can get started.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="10.png" style="width: 546px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206385i25967E92BD072D56/image-size/large?v=v2&px=999" role="button" title="10.png" alt="10.png" /></span></P><P>Then you can choose to annotate entity or view.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="11.png" style="width: 552px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206386i7F186443285464FA/image-size/large?v=v2&px=999" role="button" title="11.png" alt="11.png" /></span></P><P>Choose view for example</P><P>Now the aim is to add annotations for every field you want</P><P> </P><pre class="lia-code-sample language-abap"><code>@Metadata.layer: #CUSTOMER
@UI: {
headerInfo: {
typeName: 'Purchase Order',
typeNamePlural: 'Purchase Orders'
},
presentationVariant: [{
sortOrder: [{
by: 'PurchaseOrder',
direction: #DESC
}],
visualizations: [{
type: #AS_LINEITEM
}]
}]
}
@Search.searchable: true
annotate view ZC_MYPURCHASEORDERS with
{
@UI.lineItem: [{ position: 10 },{ importance: #HIGH }]
@UI.selectionField: [{ position: 10 }]
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
PurchaseOrder;
@UI.lineItem: [{ position: 20 },{ importance: #HIGH }]
@UI.selectionField: [{ position: 20 }]
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
@Consumption.valueHelpDefinition: [{ entity : {name: 'I_PurchasingDocumentType', element: 'PurchasingDocumentType' } }]
PurchaseOrderType;
@UI.lineItem: [{ position: 30 }]
@UI.selectionField: [{ position: 30 }]
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
PurchaseOrderSubtype;
@UI.lineItem: [{ position: 40 }]
@UI.selectionField: [{ position: 40 }]
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
PurchasingDocumentOrigin;
@UI.lineItem: [{ position: 50 }]
@UI.selectionField: [{ position: 50 }]
CreatedByUser;
@UI.lineItem: [{ position: 60 }]
@UI.selectionField: [{ position: 60 }]
CreationDate;
@UI.lineItem: [{ position: 70 }]
@UI.selectionField: [{ position: 70 }]
PurchaseOrderDate;
@UI.lineItem: [{ position: 80 }]
@UI.selectionField: [{ position: 80 }]
CashDiscount1Percent;
@UI.lineItem: [{ position: 90 }]
@UI.selectionField: [{ position: 90 }]
CashDiscount1Days;
@UI.lineItem: [{ position: 100 }]
@UI.selectionField: [{ position: 100 }]
DownPaymentAmount;
@UI.lineItem: [{ position: 110 }]
@UI.selectionField: [{ position: 110 }]
DocumentCurrency;
}</code></pre><P> </P><H3 id="toc-hId--561068236">Business Services</H3><P>Now we will define entities and create odata service</P><H4 id="toc-hId--1126216117">Service Definition</H4><P>Create new Service Definition</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="16.png" style="width: 550px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206843iEC3CDD51FA53C1C8/image-size/large?v=v2&px=999" role="button" title="16.png" alt="16.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="17.png" style="width: 551px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206844iF0ACAE28C04DB1B6/image-size/large?v=v2&px=999" role="button" title="17.png" alt="17.png" /></span></P><P>Insert the code below</P><P> </P><pre class="lia-code-sample language-abap"><code>@EndUserText.label: 'Service definition for ZC_MYPURCHASEORDERS'
define service ZUI_MYPURCHORDERS {
expose ZC_MYPURCHASEORDERS as PurchaseOrders;
}</code></pre><P> </P><P>Don't forget to alias your entities</P><H4 id="toc-hId--1322729622">Service Binding</H4><P>Now we'll create our odata service. Here's how to create an odata v2 and v4 service.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="18.png" style="width: 550px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206845i58DDCFFBD608362D/image-size/large?v=v2&px=999" role="button" title="18.png" alt="18.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="19.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206846i73281CFC0046F396/image-size/large?v=v2&px=999" role="button" title="19.png" alt="19.png" /></span></P><P>You need to activate your service binding (ctrl+f3)</P><P>Now you have two way to activate your odata service, use the publish button BUT it's only for testing because the input will be local and cannot be put into a package, or use the t-code /IWFND/V4_ADMIN to transport it in package.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206853iE570D2434591B9CA/image-size/large?v=v2&px=999" role="button" title="20.png" alt="20.png" /></span></P><P>I advise you to check that there are no errors with the publish option in service binding, as you can sometimes get errors with conversion routines (which are not allowed in view entities with 3 exceptions). Once ok, you can unpublish it and then republish it with the transaction for productive use.</P><P>Now your odata V4 is ready to use.</P><P>For V2 it's the same logic but for productivity you need to activate with t-code /IWFND/MAINT_SERVICE</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="21.png" style="width: 547px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206861i96ABFD1D8D219486/image-size/large?v=v2&px=999" role="button" title="21.png" alt="21.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="22.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206868i056BB6242FE1E613/image-size/large?v=v2&px=999" role="button" title="22.png" alt="22.png" /></span></P><P> </P><H4 id="toc-hId--1519243127">Access control (DCL)</H4><P>If you want to add authorization objects in this application, you can add access control. For example if you want restrict purchase order type with PFCG object. Once you've created your odata service, you'll need to add the authorization objects used in access control in su24.</P><P>Make sure you have enabled authorization control on the root view</P><P> </P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #CHECK</code></pre><P> </P><P>Create DCL(Access Control) for root view entity :</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="12.png" style="width: 548px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206838i6EB06C9BC549B583/image-size/large?v=v2&px=999" role="button" title="12.png" alt="12.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="13.png" style="width: 699px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206839i87A40AD8DB15BBC7/image-size/large?v=v2&px=999" role="button" title="13.png" alt="13.png" /></span></P><P>Then insert the code below</P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>@EndUserText.label: 'Access control for ZR_MYPURCHASEORDERS'
@MappingRole: true
define role ZR_MYPURCHASEORDERS {
grant
select
on
ZR_MYPURCHASEORDERS
where ( PurchaseOrderType ) = aspect pfcg_auth ( M_BEST_BSA,BSART,actvt = '03' );
}</code></pre><P> </P><P><EM>And of course, if you want to use your own specific authorization object, that's also possible.</EM></P><P>Now create another DCL(Access Control) for projection view. This DCL will only inherit the DCL of the root view.</P><P>Make sure you have enabled authorization control on the projection view</P><P> </P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #CHECK</code></pre><P> </P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="14.png" style="width: 549px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206840i4D205F9F5567CF4D/image-size/large?v=v2&px=999" role="button" title="14.png" alt="14.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="15.png" style="width: 672px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206842i3ED68AD5FEEC3973/image-size/large?v=v2&px=999" role="button" title="15.png" alt="15.png" /></span></P><P>Insert the below code</P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>@EndUserText.label: 'Access control for ZC_MYPURCHASEORDERS'
@MappingRole: true
define role ZC_MYPURCHASEORDERS {
grant
select
on
ZC_MYPURCHASEORDERS
where
inheriting conditions from entity ZR_MyPurchaseOrders;
}</code></pre><P> </P><P> </P><P>Now you just need to add yours authorizations objects in your odata service with t-code SU24, and create role in PFCG and assign to you or users.</P><H3 id="toc-hId--1422353625">Fiori Element</H3><P>Open Business Application Studio or VScode(with configured Fiori tools extension).</P><P>Launch "Fiori open application generator" with command palette(ctrl+shift+p)</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="23.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206880iC739CC8C45981348/image-size/medium?v=v2&px=400" role="button" title="23.png" alt="23.png" /></span></P><P>Select Fiori Element List report and select your system, odata service,project name, options</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="24.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206883i38E0BA2FED585D8E/image-size/medium?v=v2&px=400" role="button" title="24.png" alt="24.png" /></span><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="25.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206884iC8CB402AB2A1109B/image-size/medium?v=v2&px=400" role="button" title="25.png" alt="25.png" /></span><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="26.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206885i4094850D9CCAADC5/image-size/medium?v=v2&px=400" role="button" title="26.png" alt="26.png" /></span><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="27.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206886i0B2D53CDF1288FF9/image-size/medium?v=v2&px=400" role="button" title="27.png" alt="27.png" /></span><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="28.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206887iD7343DCEB12E3281/image-size/medium?v=v2&px=400" role="button" title="28.png" alt="28.png" /></span></P><P>Now your app is ready to test.</P><P>You'll notice that by default it has added a navigation in manifest.json to an object page that we haven't coded in the CDS views. We'll set this aside.</P><pre class="lia-code-sample language-json"><code> },
"PurchaseOrdersObjectPage": {
"type": "Component",
"id": "PurchaseOrdersObjectPage",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings": {
"editableHeaderContent": false,
"contextPath": "/PurchaseOrders"
}
}
}</code></pre><P>Test your app with command </P><pre class="lia-code-sample language-bash"><code>npm run start</code></pre><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="29.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206889iFBE9E46D6F5C1CFF/image-size/large?v=v2&px=999" role="button" title="29.png" alt="29.png" /></span></P><P>You can also test your value help in purchase order type</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="30.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/206891i4D0A6E5030DB7D57/image-size/large?v=v2&px=999" role="button" title="30.png" alt="30.png" /></span></P><H4 id="toc-hId--1912270137">And congrats, you've got a simple List Report application that respects the new development standards.</H4><P>Of course, this display is very simplistic as we've added very few features, so feel free to dig deeper. You can also extend your application to add a custom filter or a new column. And if the design of the lists reports doesn't suit your needs you can always go for <A href="https://sapui5.hana.ondemand.com/test-resources/sap/fe/core/fpmExplorer/index.html" target="_self" rel="nofollow noopener noreferrer">FPM</A> and even freestyle(but no longer recommended <span class="lia-unicode-emoji" title=":grinning_face:">😀</span> )</P><P> </P><H3 id="toc-hId--1815380635">Technical Catalog</H3><P>If you want to deploy for an Private Cloud/On-Premise system in the Fiori Launchpad, you need to create at least a technical catalog. To do this create your catalog in t-code /UI2/FLPAM an fill your Fiori application technical data(no longer use launchpad designer please)</P><P> </P><H2 id="toc-hId--1718491133">Next steps</H2><P>The next step is to deploy your application on your SAP system. To do this, you'll need to run the deployment configuration (npm run deploy-config). Also you may need to fill in the object page and we'll look at that in a second part. And why not show how to add an action with behavior definition(BDEF).</P>2025-01-03T15:44:27.909000+01:00https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/idoc-failure-and-resolution-in-sap/ba-p/13976342IDoc Failure and Resolution in SAP2025-01-04T09:15:54.686000+01:00mickaelquesnothttps://community.sap.com/t5/user/viewprofilepage/user-id/150004<P><SPAN>IDocs (Intermediate Documents) in SAP are used for Electronic Data Interchange (EDI) to exchange data between SAP and external systems. However, IDoc processing can encounter errors resulting in failures. Here's a breakdown of IDoc failures and their resolution process, along with an example:</SPAN><SPAN><BR /></SPAN><SPAN><BR /></SPAN><SPAN>**IDoc Failure:**</SPAN><SPAN><BR /></SPAN><SPAN><BR /></SPAN><SPAN>An IDoc failure occurs when there's an issue during data exchange, preventing successful transfer of information. This can happen due to various reasons:</SPAN><SPAN><BR /></SPAN><SPAN><BR /></SPAN><SPAN>* **Data Mapping Errors:** Incorrect mapping between SAP data fields and the external system's format.</SPAN><SPAN><BR /></SPAN><SPAN>* **Missing or Invalid Data:** Required data fields missing in the IDoc or containing invalid values.</SPAN><SPAN><BR /></SPAN><SPAN>* **Communication Issues:** Network connectivity problems between SAP and the external system.</SPAN><SPAN><BR /></SPAN><SPAN>* **Application Errors:** Errors in the receiving application logic causing processing issues.</SPAN><SPAN><BR /></SPAN><SPAN><BR /></SPAN><SPAN>**Resolving IDoc Failures:**</SPAN><SPAN><BR /></SPAN><SPAN><BR /></SPAN><SPAN>Here's a general process for resolving IDoc failures:</SPAN><SPAN><BR /></SPAN><SPAN><BR /></SPAN><SPAN>1. **Identify the Error:** Use transaction WE05 (Display IDoc) to check the IDoc status and error message. The message provides details about the cause of the failure.</SPAN><SPAN><BR /></SPAN><SPAN>2. **Analyze the Error:** Based on the error message, pinpoint the root cause (data mapping, missing data, etc.).</SPAN><SPAN><BR /></SPAN><SPAN>3. **Resolve the Issue:**</SPAN> <SPAN><BR /></SPAN><SPAN>* Fix data mapping errors in the configuration.</SPAN><SPAN><BR /></SPAN><SPAN>* Correct missing or invalid data in the originating document.</SPAN><SPAN><BR /></SPAN><SPAN>* Troubleshoot network connectivity issues.</SPAN><SPAN><BR /></SPAN><SPAN>* Work with the application team to address application-specific errors.</SPAN><SPAN><BR /></SPAN><SPAN>4. **Reprocess the IDoc:** Once the issue is resolved, use transaction WE19 (Reprocess IDoc) to attempt processing the IDoc again.</SPAN><SPAN><BR /></SPAN><SPAN><BR /></SPAN><SPAN>**Example:**</SPAN><SPAN><BR /></SPAN><SPAN><BR /></SPAN><SPAN>An IDoc for a sales order fails with an error message indicating a missing customer number. The resolution steps might involve:</SPAN><SPAN><BR /></SPAN><SPAN><BR /></SPAN><SPAN>* Checking the originating sales order in transaction VA01.</SPAN><SPAN><BR /></SPAN><SPAN>* Verifying if the customer number is missing or incorrect.</SPAN><SPAN><BR /></SPAN><SPAN>* Updating the customer number in the sales order.</SPAN><SPAN><BR /></SPAN><SPAN>* Reprocessing the IDoc using WE19.</SPAN><SPAN><BR /></SPAN><SPAN><BR /></SPAN><SPAN>**Additional Tips:**</SPAN><SPAN><BR /></SPAN><SPAN><BR /></SPAN><SPAN>* Use transaction SM37 (Job Overview) to monitor background jobs related to IDoc processing.</SPAN><SPAN><BR /></SPAN><SPAN>* Leverage table EDIDS to track IDoc statuses and detailed error logs.</SPAN><SPAN><BR /></SPAN><SPAN>* For complex errors, consider involving SAP Basis or EDI specialists for further assistance.</SPAN><SPAN><BR /></SPAN><SPAN><BR /></SPAN><SPAN>By following these steps and understanding the potential causes of IDoc failures, you can effectively troubleshoot and resolve issues to ensure smooth data exchange between SAP and external systems.</SPAN></P>2025-01-04T09:15:54.686000+01:00https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/defining-local-fields-in-sap-query/ba-p/13976354Defining Local Fields in SAP QUERY2025-01-04T09:20:52.090000+01:00mickaelquesnothttps://community.sap.com/t5/user/viewprofilepage/user-id/150004<DIV class=""><P><STRONG>Local Fields in SAP Query: Enhancing Reporting Flexibility</STRONG></P><P>Local fields in SAP Query are calculated fields that you define <EM>within</EM> the query itself. They don't exist in the underlying database tables or InfoSet. This allows you to perform calculations, transformations, or logical operations on existing fields without needing to create new fields in the database. This is very useful for reporting purposes.</P><P><STRONG>Key Benefits of Local Fields:</STRONG></P><UL><LI><STRONG>Flexibility:</STRONG> Create custom calculations and derive new information without modifying the underlying data structure.</LI><LI><STRONG>Performance:</STRONG> Calculations are performed during query execution, avoiding the need to store redundant data.</LI><LI><STRONG>Simplicity:</STRONG> Define complex logic directly within the query, making it easier to manage and maintain.</LI></UL><P><STRONG>Example: Calculating Delivery Variance (Your Scenario)</STRONG></P><P>Let's use your example of the BACKLOGVENTES InfoSet to illustrate how to define a local field for delivery variance:</P><P><STRONG>Scenario:</STRONG> You want to see the difference between the referenced quantity (DELIVERY) and the confirmed quantity (SALES ORDER). This difference represents the delivery variance.</P><P><STRONG>Steps to Define a Local Field:</STRONG></P><OL><LI><P><STRONG>Open SAP Query (SQ01/SQ02):</STRONG> Navigate to SAP Query using transaction codes SQ01 (Queries) or SQ02 (InfoSets).</P></LI><LI><P><STRONG>Edit/Create a Query:</STRONG> Open the relevant query based on the BACKLOGVENTES InfoSet.</P></LI><LI><P><STRONG>Go to the "Fields" tab:</STRONG> This is where you select the fields to be included in your report.</P></LI><LI><P><STRONG>Define a Local Field:</STRONG></P><UL><LI><P>Click on the "Local Fields" button (usually represented by an icon of a calculator or a field with a plus sign).</P></LI><LI><P>Enter a name for your local field (e.g., DELIVERY_VARIANCE).</P></LI><LI><P>Enter a description (e.g., "Difference between Referenced and Confirmed Quantity").</P></LI><LI><P><STRONG>Crucially, enter the formula:</STRONG> This is where you define the calculation. In your case, the formula would be:</P><DIV class=""><DIV class=""><DIV class=""><PRE>DELIVERY - SALES_ORDER</PRE></DIV></DIV></DIV><P>(Assuming DELIVERY represents the "Referenced quantity in base unit of measure" and SALES_ORDER represents the "Confirmed Quantity". Adjust the field names to match your InfoSet.)</P></LI><LI><P>Specify the data type and length of the local field, if necessary. Usually, the query tool infers this based on the formula.</P></LI></UL></LI><LI><P><STRONG>Add the Local Field to the Output:</STRONG> Select the newly created local field (DELIVERY_VARIANCE) to be included in your report output.</P></LI><LI><P><STRONG>Execute the Query:</STRONG> Run the query to see the results, including the calculated delivery variance.</P></LI></OL><P><STRONG>Example in More Detail (with potential field names):</STRONG></P><P>Let's say the actual field names in your InfoSet are:</P><UL><LI>VBAP-KWMENG (Confirmed Quantity in Sales Order - often aliased as SALES_ORDER in the Infoset)</LI><LI>LIPS-LFIMG (Delivered Quantity / Referenced Quantity in delivery - often aliased as DELIVERY)</LI></UL><P>Then, your local field definition would be:</P><UL><LI><STRONG>Name:</STRONG> DELIVERY_VARIANCE</LI><LI><STRONG>Description:</STRONG> "Difference between Delivered and Confirmed Quantity"</LI><LI><STRONG>Formula:</STRONG> LIPS-LFIMG - VBAP-KWMENG or DELIVERY - SALES_ORDER (depending on how the fields are aliased in your InfoSet)</LI></UL><P><STRONG>Important Considerations:</STRONG></P><UL><LI><STRONG>Data Types:</STRONG> Ensure the data types of the fields used in the formula are compatible. You might need to use type conversions (e.g., NUMC to DEC) if necessary.</LI><LI><STRONG>Aliases:</STRONG> If your InfoSet uses aliases for field names, use the aliases in your formula.</LI><LI><STRONG>Error Handling:</STRONG> Consider potential errors, such as dividing by zero. You can use conditional statements (e.g., IF...THEN...ELSE) to handle these cases.</LI></UL><P>By using local fields effectively, you can create powerful and flexible reports in SAP Query without needing to modify the underlying data structure, making reporting much easier and more efficient.</P></DIV>2025-01-04T09:20:52.090000+01:00https://community.sap.com/t5/technology-blogs-by-members/12-tips-for-beginners-starting-with-sap-abap-programming/ba-p/1397656812 Tips for Beginners Starting with SAP ABAP Programming2025-01-05T03:58:59.961000+01:00tiagobernardhttps://community.sap.com/t5/user/viewprofilepage/user-id/1938787<P><STRONG>Welcome to Our SAP ABAP Programming Guide!</STRONG></P><P>Are you starting your journey into the world of SAP ABAP programming? You've come to the right place! In this post, we’ve compiled 12 essential tips to help you navigate the initial steps of learning ABAP. Whether you're a complete beginner or have some basic knowledge, these tips will provide you with a solid foundation to build your skills.</P><P>12 Tips for Beginners Starting with SAP ABAP Programming</P><P>1. Understand the Basics of SAP<BR />Before diving into ABAP, familiarize yourself with the fundamentals of SAP. Learn about SAP modules, the ERP system, and how different components interact.</P><P>2. Learn the Syntax and Structure<BR />Start by understanding the basic syntax and structure of ABAP. Get comfortable with keywords, data types, and basic programming constructs.</P><P>3. Use the ABAP Development Tools (ADT)<BR />Get accustomed to using ABAP Development Tools in Eclipse. It’s essential for efficient development and offers features like syntax highlighting, code completion, and debugging tools.</P><P>4. Understand Data Dictionary Objects<BR />Learn how to work with Data Dictionary (DDIC) objects such as tables, views, data elements, and domains. These are crucial for database interactions in ABAP.</P><P>5. Practice Modularization Techniques<BR />Master the use of subroutines, function modules, methods, and classes to write modular and reusable code. This will make your programs more maintainable and efficient.</P><P>6. Get Familiar with Internal Tables<BR />Internal tables are a key feature in ABAP for handling data in-memory. Practice creating, populating, and manipulating internal tables.</P><P>7. Understand ALV Reports<BR />Learn how to create and customize ALV (ABAP List Viewer) reports. ALV provides a flexible way to output data with features like sorting, filtering, and layout customization.</P><P>8. Explore Open SQL<BR />SAP ABAP uses Open SQL for database operations. Learn the basics of SELECT, INSERT, UPDATE, and DELETE statements, and how to handle database transactions.</P><P>9. Practice Debugging<BR />Get comfortable with the debugging tools in ABAP. Knowing how to effectively debug your code is crucial for identifying and fixing issues.</P><P>10. Learn About BAPIs and RFCs<BR />BAPIs (Business Application Programming Interfaces) and RFCs (Remote Function Calls) are essential for integrating different SAP systems. Understand how to use them to enable communication between systems.</P><P>11. Get Hands-On with Enhancements and Exits<BR />Learn about user exits, BADI (Business Add-Ins), and enhancement spots to customize and extend standard SAP functionality.</P><P>12. Engage with the SAP Community<BR />Join the SAP community through forums, blogs, and SAP’s official website. Engaging with experienced professionals can provide valuable insights and help you stay updated with the latest developments.</P>2025-01-05T03:58:59.961000+01:00https://community.sap.com/t5/technology-blogs-by-members/writing-clean-code-and-best-practices-in-sap-abap/ba-p/13977859Writing Clean Code and Best Practices in SAP ABAP2025-01-06T16:12:50.402000+01:00tiagobernardhttps://community.sap.com/t5/user/viewprofilepage/user-id/1938787<P>Clean code is not just about writing code that works; it's about writing code that is readable, maintainable, and efficient. In the context of SAP ABAP, adhering to clean code principles and best practices can significantly enhance the quality of your programs. Here are some key points to keep in mind:</P><P><STRONG>1. Use Meaningful Names</STRONG><BR />Choose clear, descriptive names for variables, methods, and classes. Avoid abbreviations and aim for names that convey the purpose and intent of the code.</P><P><STRONG>2. Write Small and Focused Methods</STRONG><BR />Keep your methods small and focused on a single task. This makes the code easier to understand, test, and maintain. Aim for methods that do one thing and do it well.</P><P><STRONG>3. Avoid Hardcoding Values</STRONG><BR />Hardcoding values makes the code inflexible and harder to maintain. Use constants or configuration tables instead, so changes can be made easily without modifying the code.</P><P><STRONG>4. Comment Judiciously</STRONG><BR />Write comments that explain why a piece of code exists, not what it does. Good code should be self-explanatory, but comments can provide context and rationale for complex logic.</P><P><STRONG>5. Follow Consistent Formatting</STRONG><BR />Maintain a consistent coding style and format throughout your ABAP programs. This includes indentation, spacing, and naming conventions. Consistent formatting improves readability and helps in code reviews.</P><P><STRONG>6. Use Modularization Techniques</STRONG><BR />Break down complex processes into smaller, reusable components using subroutines, function modules, or methods. Modularization promotes code reuse and simplifies debugging.</P><P><STRONG>7. Handle Exceptions Properly</STRONG><BR />Implement proper error handling using TRY-CATCH blocks. Ensure that your code gracefully handles exceptions and provides meaningful error messages to users.</P><P><STRONG>8. Optimize Database Access</STRONG><BR />Minimize the number of database accesses and use efficient queries. Retrieve only the data you need and avoid nested SELECT statements. Use indexes and buffering where appropriate.</P><P><STRONG>9. Avoid Using Obsolete Constructs</STRONG><BR />Stay updated with the latest ABAP syntax and features. Avoid using obsolete constructs and embrace modern ABAP features such as inline declarations, new string operations, and expressions.</P><P><STRONG>10. Test Your Code Thoroughly</STRONG><BR />Write unit tests to validate your code's functionality. Regular testing helps catch bugs early and ensures that your code behaves as expected in different scenarios.</P><P><STRONG>11. Document Your Code</STRONG><BR />Provide clear and concise documentation for your programs. This includes explaining the purpose, usage, and any special considerations of your code. Good documentation aids future maintenance and onboarding of new developers.</P><P><STRONG>12. Engage in Code Reviews</STRONG><BR />Participate in code reviews to share knowledge and ensure adherence to coding standards. Peer reviews help identify potential issues and foster a culture of continuous improvement.</P><P>By following these clean code principles and best practices, you can create ABAP programs that are robust, efficient, and easy to maintain. Clean code is a key factor in the long-term success of any software project, and SAP ABAP is no exception.</P>2025-01-06T16:12:50.402000+01:00https://community.sap.com/t5/supply-chain-management-blogs-by-members/manual-assignment-of-loading-and-truck-resource-to-fo/ba-p/13920402Manual Assignment of Loading and Truck Resource to FO2025-01-07T09:23:17.911000+01:00ashraf_usmanihttps://community.sap.com/t5/user/viewprofilepage/user-id/233880<P>Hi All,</P><P>I would like to share my working experience on custom development for Transportation Management Optimization, SAP has already provided standard Fiori app to perform optimization, however we don't have any GUI based single step solution to perform optimization in TM.</P><P><STRONG>Requirement: </STRONG>We received requirement from business team, to design simple SAP ABAP program to perform TM Optimization automation. based on inputs: Freight Unit, Sending Location, Receiving location, Planning Profile.</P><P><STRONG>Pre-requisite: </STRONG>ABAP Development and BOBF Development and functional skills needed to perform above activity.</P><P><STRONG>Following are the process steps:</STRONG></P><OL><LI>An Automatic Freight Unit is created in SAP TM, from an ERP STO document.</LI><LI>Transportation Planning is performed and Freight Order is created from FU document.</LI><LI>Transportation planning utilizes the optimizer engines like – TVSR/ VSR (Vehicle Resource Scheduling) and assigns a truck resource and loading resource to the Freight Order, according to the input variables from Freight Unit document.</LI><LI>But, in case there is no loading slot available, enough to accommodate the loading activity of the Freight Order or, there is no available truck resource during the FU -> pick up window date/ time, then a manual planning is performed in the Transportation Cockpit window.</LI><LI>But, in manual planning, only a truck resource is assigned not the loading resource.</LI><LI>For the resolution for this business requirement, a custom manual optimization button is created, which would assign an appropriate truck resource (truck having 100% utilization for the selected FU) and a loading resource is assigned according to the prioritized sequence for the loading plant and product combination.</LI><LI>First FO document is created against the FU, by selecting the FU and calling the standard action of the business object – TOR -> sub-node - STOP_SUCC -> action - AUTOPLAN_STAGE.</LI><LI>Above action will create a Freight Order and assign it to the Freight Unit.</LI><LI>Afterwards, select the newly created FO and call the action -> ASSIGN_VEHICLE_RES for assigning the truck resource at BO – TOR -> sub-node – ROOT.</LI><LI>Once the truck resource is assigned, loading/ handling resource can be assigned to this Freight Order, with start load time, similar to FU pick up window start date/ time. Further 15 mins. of loading time is ended in start date/ time leading to load end date/ time.</LI><LI>This would complete the manual optimization process, with a single button.</LI></OL><P><STRONG>Logic: </STRONG>Get the all fright unit DB keys from the from the Transparent Table /SCMTMS/D_TORROT based on Document, pass all the DB keys to helper class <!-- StartFragment --><FONT face="arial black,avant garde"><SPAN>/scmtms/cl_tor_helper_read</SPAN></FONT> method <FONT face="arial black,avant garde">GET_TOR_DATA</FONT> to read Logistical Stop Successor Stage data</P><P> </P><pre class="lia-code-sample language-abap"><code>/scmtms/cl_tor_helper_read=>get_tor_data(
EXPORTING
it_root_key = int_key " Key Table
IMPORTING
et_stop_succ = DATA(int_stop_succ) " Logistical Stop Successor = Stage
).</code></pre><P> </P><P>Using these data, get the Planning Profile data /SCMTMS/D_PLAPRO and call standard action from freight unit -> AUTOPLAN_STAGE</P><P> </P><pre class="lia-code-sample language-abap"><code>"Get instance of service manager TOR
DATA(lo_tor_srvmgr) = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_tor_c=>sc_bo_key ).
"Get instance for transaction manager
CALL METHOD /bobf/cl_tra_trans_mgr_factory=>get_transaction_manager
RECEIVING
eo_transaction_manager = DATA(lo_txn_mgr). " Standalone Transaction Manager Instance
CREATE DATA lr_create_capa_param.
SELECT SINGLE * INTO (wa_plapro) FROM /scmtms/d_plapro WHERE profile_id = @p_pro.
IF sy-subrc = 0.
MOVE-CORRESPONDING wa_plapro TO lr_create_capa_param->plan_prof .
ENDIF.
TRY.
"Call action From FU -> STOP_SUCC -> AUTOPLAN_STAGE action
lo_tor_srvmgr->do_action(
EXPORTING
iv_act_key = /scmtms/if_tor_c=>sc_action-stop_successor-autoplan_stage
it_key = int_fo_key
is_parameters = lr_create_capa_param
IMPORTING
eo_change = DATA(lo_change)
eo_message = DATA(fo_message)
et_failed_key = DATA(lt_failed_key)
et_failed_action_key = DATA(lt_failed_action_key)
ev_static_action_failed = DATA(int_static_action_failed)
et_data = lt_tor_root
et_data_link = DATA(int_data_link)
).
CATCH /bobf/cx_frw_contrct_violation INTO DATA(lx_exc). " Caller violates a BOPF contract
ENDTRY.
lo_txn_mgr->save(
IMPORTING
ev_rejected = DATA(lv_re) " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')
eo_message = fo_message " Interface for transaction change objects
).</code></pre><P> </P><P>After saving the action, Now get the freight order details against freight unit /SCMTMS/D_TORITE inner join /SCMTMS/D_TORROT</P><P> </P><pre class="lia-code-sample language-abap"><code>"Get Freight Order aginst Freight Unit number
SELECT SINGLE b~db_key, b~tor_id, a~gro_vol_val, a~src_loc_keytrq, a~des_loc_keytrq
INTO (wa_tor_fo)
FROM /scmtms/d_torite AS a
INNER JOIN /scmtms/d_torrot AS b
ON a~parent_key = b~db_key
WHERE a~fu_root_key = _tor_fu_key
AND a~item_cat = 'PRD'
AND b~tor_cat = 'TO'.</code></pre><P> </P><P> </P><P>Assign vehicle to the freight order:<!-- StartFragment --> <SPAN>Action <SPAN class="">For </SPAN><SPAN class="">Assign </SPAN>Truck Resource <SPAN class="">to </SPAN>Freight <SPAN class="">Order</SPAN><SPAN class="">.</SPAN><BR /><SPAN class="">If the Truck Resource ID is Available the perform the action to assign.</SPAN></SPAN></P><P> </P><pre class="lia-code-sample language-abap"><code> " action – ASSIGN_VEHICLE_RES, on Freight Order object – ROOT node, with VEH_KEY as TMSRESUID
lo_tor_srvmgr->do_action(
EXPORTING
iv_act_key = /scmtms/if_tor_c=>sc_action-root-assign_vehicle_res
it_key = int_fo_key
is_parameters = lr_assign_vehicle_res
IMPORTING
eo_change = lo_change
eo_message = fo_message
et_failed_key = lt_failed_key
).
lo_txn_mgr->save(
IMPORTING
ev_rejected = lv_re " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')
eo_message = fo_message " Interface for transaction change objects
).</code></pre><P> </P><P><SPAN><SPAN class="">If The Truck Resource ID in Not Available the Perform the action which will cancel the,</SPAN><BR /><SPAN class="">Created Fright order against the Selected Freight Unit.</SPAN></SPAN></P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>*-- Action to Cancle Frieght Order
CALL METHOD lo_tor_srvmgr->do_action
EXPORTING
iv_act_key = /scmtms/if_tor_c=>sc_action-root- remove_tor_assignments
it_key = int_fo_key
IMPORTING
eo_change = lo_change
eo_message = fo_message
et_failed_key = lt_failed_key.
lo_txn_mgr->save(
IMPORTING
ev_rejected = lv_re " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')
eo_message = fo_message " Interface for transaction change objects
).
*-- Display Message
MESSAGE: TEXT-184 TYPE 'S' DISPLAY LIKE 'E'.
EXIT.</code></pre><P> </P><P>Once the truck resource is assigned, loading/ handling resource can be assigned to this Freight Order, with start load time, similar to FU pick up window start date/ time. Further 15 mins. of loading time is ended in start date/ time leading to load end date/ time.</P><P> </P><pre class="lia-code-sample language-abap"><code> " get all the stop and root data for freight order
CLEAR: int_stop_key[].
SELECT db_key INTO TABLE @int_stop_key FROM /scmtms/d_torstp WHERE parent_key = _tor_fo-db_key.
lo_tor_srvmgr->retrieve(
EXPORTING
iv_node_key = /scmtms/if_tor_c=>sc_node-stop
it_key = int_stop_key
IMPORTING
et_data = int_fo_stop ).
"now set the indicator based on which action we are calling
LOOP AT int_fo_stop ASSIGNING FIELD-SYMBOL(<fs_fo_stop>) WHERE stop_cat = 'O'.
<fs_fo_stop>-assgn_hres = wl_handling_res.
<fs_fo_stop>-assgn_hres_cons = '1'.
CONVERT TIME STAMP <fs_fo_stop>-aggr_assgn_start_l TIME ZONE 'UTC' INTO DATE wf_input_date TIME wf_input_time.
wl_duration = wl_fix_dur.
wf_hours = wl_duration+0(2).
wf_minutes = wl_duration+2(2).
wf_seconds = wl_duration+4(2).
CALL FUNCTION 'IGN_TIMESTAMP_PLUSMINUS'
EXPORTING
start_date = wf_input_date
start_time = wf_input_time
forward = abap_false
backward = abap_true
hours = wf_hours
minutes = wf_minutes
seconds = wf_seconds
IMPORTING
result_date = wf_output_date
result_time = wf_output_time.
IF sy-subrc = 0.
<fs_fo_stop>-aggr_assgn_start_l = wf_output_date && wf_output_time.
ENDIF.
ENDLOOP.
INSERT /scmtms/if_tor_c=>sc_node_attribute-stop-assgn_hres INTO TABLE int_chg_fields.
INSERT /scmtms/if_tor_c=>sc_node_attribute-stop-assgn_hres_cons INTO TABLE int_chg_fields.
INSERT /scmtms/if_tor_c=>sc_node_attribute-stop-aggr_assgn_start_l INTO TABLE int_chg_fields.
/scmtms/cl_mod_helper=>mod_update_multi(
EXPORTING
it_data = int_fo_stop
iv_node = /scmtms/if_tor_c=>sc_node-stop
iv_bo_key = /scmtms/if_tor_c=>sc_bo_key
it_changed_fields = int_chg_fields
CHANGING
ct_mod = int_mod ).
lo_tor_srvmgr->modify(
EXPORTING
it_modification = int_mod ).
lo_txn_mgr->save(
IMPORTING
ev_rejected = lv_re " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')
eo_message = fo_message " Interface for transaction change objects
).</code></pre><P> </P><P>Display success message from the standard messages.</P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P>2025-01-07T09:23:17.911000+01:00https://community.sap.com/t5/application-development-blog-posts/abap-llm-client-beta-release/ba-p/13978388ABAP LLM Client Beta Release2025-01-08T10:10:58.336000+01:00BPreisslerhttps://community.sap.com/t5/user/viewprofilepage/user-id/1907130<P>Following the alpha preview <A href="https://community.sap.com/t5/application-development-blog-posts/abap-llm-client/ba-p/13973039" target="_self">announcement</A>, I'm excited to share that ABAP LLM Client has reached its beta milestone with version 0.1.0. This release brings several significant improvements and new features that make LLM integration in ABAP easier to use.</P><H2 id="toc-hId-1078590939">What's New in Beta</H2><H3 id="toc-hId-1011160153">Enhanced Provider Support</H3><UL><LI>Added Azure OpenAI Services support</LI><LI>Existing integrations with OpenAI, OLLAMA, and OpenRouter improved</LI></UL><H3 id="toc-hId-814646648">Improved Security</H3><UL><LI>Implemented SSF-based secret encryption</LI><LI>New BAdI interfaces for custom security implementations, authorization checks, and more</LI><LI>Flexible architecture allowing easy integration of your security requirements</LI></UL><H3 id="toc-hId-618133143">Tool (Function call) Support</H3><UL><LI>Added support for tool calls</LI><LI>Enhanced configuration options</LI></UL><H3 id="toc-hId-421619638">Developer Experience</H3><UL><LI>Streamlined API design for more intuitive usage</LI><LI>Reduced complexity </LI><LI>Documentation for quick start</LI></UL><H2 id="toc-hId-96023414">Looking Ahead</H2><P>While this beta release marks a significant milestone, it's important to note that this client serves as a foundation for more exciting developments to come.</P><H2 id="toc-hId--100490091">Getting Started</H2><P>Visit the <A class="" href="https://github.com/abap-ai/llm_client" target="_blank" rel="noopener noreferrer nofollow">GitHub repository</A> to:</P><UL><LI>Access installation instructions</LI><LI>Review documentation</LI><LI>Explore example implementations</LI><LI>Provide feedback or report issues</LI></UL><P>Stay tuned for upcoming announcements about new projects building upon this foundation!</P>2025-01-08T10:10:58.336000+01:00https://community.sap.com/t5/technology-blogs-by-members/cds-views-7-5x-quick-reference/ba-p/13978469CDS Views 7.5x Quick Reference2025-01-09T07:55:43.926000+01:00jeffrey_towell2https://community.sap.com/t5/user/viewprofilepage/user-id/229148<P><FONT size="5">Introduction</FONT></P><P><SPAN>This Quick Reference is a collection of new CDS functionality made available in ABAP 7.5x releases. This functionality is summarised in a way that will make sense to those familiar with SAP CDS. Links to the SAP Help are also provided throughout to allow the reader to dive in deeper if desired. The version the functionality was released is also given to aid in determining if it is available in your system.</SPAN></P><P> </P><TABLE border="1" width="71.70390068546324%"><TBODY><TR><TD width="10%"><STRONG>S/4HANA</STRONG></TD><TD width="6.3824289405684755%">1511</TD><TD width="6.640826873385013%">1610</TD><TD width="6.253229974160204%">1709</TD><TD width="6.253229974160206%">1809</TD><TD width="7.02842377260982%">1909</TD><TD width="6.770025839793281%">2020</TD><TD width="6.770025839793281%">2021</TD><TD width="7.674418604651166%">2022</TD><TD width="7.932816537467698%">2023</TD></TR><TR><TD width="10%"><STRONG>ABAP</STRONG></TD><TD width="6.3824289405684755%">7.50</TD><TD width="6.640826873385013%">7.51</TD><TD width="6.253229974160204%">7.52</TD><TD width="6.253229974160206%">7.53</TD><TD width="7.02842377260982%">7.54</TD><TD width="6.770025839793281%">7.55</TD><TD width="6.770025839793281%">7.56</TD><TD width="7.674418604651166%">7.57</TD><TD width="7.932816537467698%">7.58</TD></TR></TBODY></TABLE><P><FONT size="4"><STRONG>Contents</STRONG></FONT></P><OL><LI><P>CDS View Entity</P></LI><LI>CDS Abstract Entity</LI><LI>CDS Custom Entity</LI><LI>CDS Projection views</LI><LI><A href="https://community.sap.com/t5/technology-blogs-by-members/cds-access-controls-7-5x-quick-reference/ba-p/13986001" target="_self">CDS Access Controls</A></LI></OL><P> </P><H2 id="toc-hId-1078591839">1. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_define_view_entity.htm" target="_self" rel="noopener noreferrer">CDS View Entity</A> (7.50)</H2><H3 id="toc-hId-1011161053"><FONT size="4">Syntax</FONT></H3><P><FONT size="2" color="#0000FF">[@enity_annot1]</FONT><BR /><FONT size="2" color="#0000FF">[@entity_annot2]</FONT><BR /><FONT size="2" color="#0000FF">...</FONT><BR /><FONT size="2" color="#0000FF">[@view_entity_annot1]</FONT><BR /><FONT size="2" color="#0000FF">[@view_entity_annot2]</FONT><BR /><FONT size="2" color="#0000FF">...</FONT><BR /><FONT size="2" color="#0000FF">[DEFINE] [ROOT] VIEW ENTITY view_entity</FONT><BR /><FONT size="2" color="#0000FF"> [parameter_list]</FONT><BR /><FONT size="2" color="#0000FF"> AS select_statement [;]...</FONT></P><P><FONT size="4"><STRONG>Description</STRONG></FONT></P><P><SPAN>CDS view entities are non DDIC-based views. While they were introduced in 7.50 the old DDIC-based views (</SPAN>DEFINE VIEW ddic_based_view) <SPAN>only became obsolete in 7.56.</SPAN></P><P> </P><H3 id="toc-hId-814647548">Extensions</H3><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_extend_view_entity.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>EXTEND VIEW ENTITY</EM></STRONG></A> (7.55)</P><P>Makes it possible to add new view fields to existing CDS view entities and CDS projection views by using CDS view entity extensions.</P><P><FONT size="2" color="#0000FF">EXTEND VIEW ENTITY cds_view_entity <EM>|</EM> projection_view</FONT><BR /><FONT size="2" color="#0000FF"> WITH</FONT><BR /><FONT size="2" color="#0000FF"> <EM>[</EM>association1</FONT><BR /><FONT size="2" color="#0000FF"> association2 ...<EM>]</EM></FONT><BR /><FONT size="2" color="#0000FF"> { select_list_extension }</FONT><BR /><FONT size="2" color="#0000FF"> <EM>[</EM>GROUP BY field1, field2, ... <EM>]</EM></FONT><BR /><FONT size="2" color="#0000FF"> <EM>[</EM>EXCEPT <EM>|</EM> INTERSECT <EM>|</EM> UNION <EM>[</EM>ALL<EM>]</EM> { ... }<EM>]</EM> <EM>[</EM>;<EM>]</EM></FONT></P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_annotate_view.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>ANNOTATE ENTITY</EM></STRONG></A> (7.53)</P><P>Define CDS metadata extensions(type:DDLX) for any CDS entities with the exception of CDS table functions.</P><P><FONT size="2" color="#0000FF">@Metadata.layer: #CORE|#LOCALIZATION|#INDUSTRY|#PARTNER|#CUSTOMER</FONT><BR /><FONT size="2" color="#0000FF"> [@entity_annot1]</FONT><BR /><FONT size="2" color="#0000FF"> [@entity_annot2]</FONT><BR /><FONT size="2" color="#0000FF"> ...</FONT><BR /><FONT size="2" color="#0000FF"> ANNOTATE ENTITY cds_entity WITH</FONT><BR /><FONT size="2" color="#0000FF"> [ parameter_list]</FONT><BR /><FONT size="2" color="#0000FF"> { [element_list] }[;]</FONT></P><H3 id="toc-hId-618134043"> </H3><H3 id="toc-hId-421620538">Set Operators</H3><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_union_v2.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>UNION</EM></STRONG></A> (7.56) </P><P>Now supported in CDS view entities.</P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_except_v2.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>EXCEPT</EM></STRONG></A> (7.56) </P><P>Returns all rows of a SELECT statement that are not part of the result sets of the following SELECT statements.</P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_intersect_v2.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>INTERSECT</EM></STRONG></A> (7.56)</P><P>Returns all distinct rows that are included in all result sets of multiple SELECT statements.</P><P> </P><H3 id="toc-hId-225107033">Functions</H3><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_conv_func_unit_curr_v2.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>GET_NUMERIC_VALUE</EM></STRONG></A> (7.56)</P><P>Conversion Function. Returns the numeric value of a currency or quantity without its currency or unit key.</P><P> </P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code> key carrid,
key connid,
key fldate,
@Semantics.amount.currencyCode: 'currency'
price,
currency,
@Semantics.amount.currencyCode: 'currency'
paymentsum,
GET_NUMERIC_VALUE( paymentsum ) / GET_NUMERIC_VALUE( price )
as number_of_bookings</code></pre><P> </P><P> </P><P> </P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_conv_func_unit_curr_v2.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>CURR_TO_DECFLOAT_AMOUNT</EM></STRONG></A> (7.56)</P><P> Conversion Function. Converts the function argument(must have data type CURR and a currency key ) into a type DECFLOAT34.</P><P> </P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code> key id,
cuky as currency,
@Semantics.amount.currencyCode: 'currency'
curr10_4 as amount,
@Semantics.amount.currencyCode: 'currency'
CURR_TO_DECFLOAT_AMOUNT(curr10_4) as curr_conv</code></pre><P> </P><P> </P><P> </P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_sql_functions_character_v2.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>SUBSTRING</EM></STRONG></A> (7.57)</P><P>Function enhanced to accept literals, fields, parameters, expressions, and built-in functions as arguments pos and len.</P><P><FONT color="#0000FF">SUBSTRING(arg, pos, len) Substring arg from the position pos with length len. </FONT></P><P> </P><P><U><STRONG><EM>LEFT</EM></STRONG> and <STRONG><EM>RIGHT</EM></STRONG> </U>(7.57)</P><P>Functions enhanced to accept literals, fields, parameters, expressions, and built-in functions as argument len.</P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_sql_functions_character_v2.htm" target="_blank" rel="noopener noreferrer">LEFT(arg, len)</A> String of the length len with the len left characters of arg (ignoring the trailing blanks).</P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_sql_functions_character_v2.htm" target="_blank" rel="noopener noreferrer">RIGHT(arg,len)</A> String of the length len with the len right characters of arg (ignoring the trailing blanks).</P><P> </P><H3 id="toc-hId-28593528">Types</H3><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_typed_literal_v2.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>Typed Literals</EM></STRONG></A> (7.56) </P><P>Now supported in CDS view entities. Not supported in the ON condition of a CDS association.</P><P> </P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>{
key id,
abap.char'aaa ' as char_trailing_blanks,
abap.sstring'aaa ' as sstring_trailing_blanks,
abap.string'aaa ' as string_trailing_blanks,
'aaa' as untyped_literal }
where
numc1 = abap.numc'1' and
datn < abap.datn'20200101'</code></pre><P> </P><P> </P><P> </P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_calculated_quantity.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>CDS Calculated Quantity</EM></STRONG></A> (7.56)</P><P>A new type that is the result of a calculation using amount and/or quantity fields.</P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_session_var_application_v2.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>Application Session Variables</EM></STRONG></A> (7.57)</P><P>In form $session.vname</P><TABLE width="553"><TBODY><TR><TD width="130"><P><STRONG>vname</STRONG></P></TD><TD width="423"><P><STRONG>Value when accessed</STRONG></P></TD></TR><TR><TD width="130"><P>bs_instance_id</P></TD><TD width="423"><P>Instance ID of the current business service instance. The returned value has the data type SSTRING.</P></TD></TR><TR><TD width="130"><P>bs_zone_id</P></TD><TD width="423"><P>Zone ID of the current business service instance. The returned value has the data type SSTRING.</P></TD></TR></TBODY></TABLE><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_param.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>Input Parameters</EM></STRONG></A> (7.57)</P><P>abap.string now supported.</P><P> </P><H3 id="toc-hId--167919977">ABAP Reports</H3><P><U><STRONG><EM>RUTDDLS_MIGRATION_CANDIDATES </EM></STRONG></U>(7.56) </P><P>Evaluates whether a migration from a CDS DDIC-based view to a CDS view entity is possible.</P><P><SPAN><STRONG><EM> </EM></STRONG></SPAN><U><STRONG><EM>RUTDDLSV2MIGRATION </EM></STRONG></U>(7.56) </P><P>Migrates CDS DDIC-based views to CDS view entities.</P><P><STRONG><EM><U>RUT_WHERE_USE_SQLVIEW </U></EM></STRONG>(7.57)</P><P>Lists all repository objects that use CDS-managed DDIC views.</P><P> </P><H3 id="toc-hId--364433482">Annotations</H3><P><EM><STRONG><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_v2_view_buffering.htm" target="_self" rel="noopener noreferrer">Table Buffering Annotation</A></STRONG></EM> (7.57).</P><P>Defines whether table buffering is allowed for a CDS view entity or not.</P><P><FONT color="#0000FF">@AbapCatalog.entityBuffer.definitionAllowed: true|false</FONT></P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_define_view_entity_buffer.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>CDS entity buffer</EM></STRONG></A> (7.57)</P><P data-unlink="true">The actual buffering type can be defined by a separate ABAP tuning object called a CDS entity buffer with the DDL statement:</P><P><FONT color="#0000FF">DEFINE VIEW ENTITY BUFFER ON cds_view_entity</FONT><BR /><FONT color="#0000FF"> LAYER CORE</FONT><BR /><FONT color="#0000FF"> <EM>|</EM> LOCALIZATION</FONT><BR /><FONT color="#0000FF"> <EM>|</EM> INDUSTRY</FONT><BR /><FONT color="#0000FF"> <EM>|</EM> PARTNER</FONT><BR /><FONT color="#0000FF"> <EM>|</EM> CUSTOMER</FONT><BR /><FONT color="#0000FF"> TYPE SINGLE</FONT><BR /><FONT color="#0000FF"> <EM>|</EM> <EM>{</EM>GENERIC NUMBER OF KEY ELEMENTS number<EM>}</EM></FONT><BR /><FONT color="#0000FF"> <EM>|</EM> FULL</FONT><BR /><FONT color="#0000FF"> <EM>|</EM> NONE</FONT></P><P>Table buffering can be defined differently for the layers core, localization, industry, partner and customer.</P><P> </P><H3 id="toc-hId--560946987">Other</H3><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_select_statement_v2.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>DISTINCT</EM></STRONG></A> (7.56)</P><P>Available for SELECT statements in CDS view entities. Works like ABAP SELECT.</P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_reusable_expression_v2.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>Reusing</EM></STRONG></A><SPAN><STRONG><EM> Expressions</EM></STRONG></SPAN> (7.56)</P><P>Reuse expressions defined in the SELECT list in other operand positions of the same CDS view entity.</P><P> </P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>key id as field1,
concat($projection.field1, 'x') as field_reuse,</code></pre><P> </P><P> </P><P> </P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_where_clause_v2.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>WHERE</EM></STRONG></A><SPAN><STRONG><EM> clause</EM></STRONG></SPAN> (7.56)</P><P>Now supports arithmetic expressions and case expressions as operands.</P><P> </P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>define view entity DEMO_SALES_ORDER_WHERE
as select from
demo_sales_order
association to demo_sales_bupa as _partner
on $projection.id = _partner.id
{
key so_key,
id,
company_code,
_partner.family_name
}
where
_partner.family_name like 'S%'
and length( _partner.family_name ) = abap.int1'4'
and created_on between abap.dats'20200101' and abap.dats'20200401'
and cast( _partner.birth_name as DEMO_BT_BIRTH_NAME
preserving type ) = abap.char'Meier'</code></pre><P> </P><P> </P><P> </P><P> </P><P><SPAN><STRONG><EM> </EM></STRONG></SPAN><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_having_clause_v2.htm" target="_self" rel="noopener noreferrer"><STRONG><EM>HAVING</EM></STRONG></A> clause (7.56)</P><P>Now supports arithmetic expressions and case expressions as operands.</P><P> </P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-json"><code>define view entity DEMO_CDS_VIEW_ENTITY_HAVING
as select from sflight
{
concat_with_space(carrid, connid, 1) as ID,
count(*) as col_count,
seatsmax
}
group by
carrid,
connid,
seatsmax
having
seatsmax > abap.int2'500'</code></pre><P> </P><P> </P><P> </P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_searched_case_expr_v2.htm" target="_self" rel="noopener noreferrer"><STRONG><EM>Searched Case Expression</EM></STRONG></A> (7.56)</P><P>Now supports arithmetic expressions and case expressions as operands.</P><P> </P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>define view entity demo_cds_searched_case_ve
as select from
spfli
{
key carrid,
key connid,
distance,
distid,
case
when distance >= 2000 then 'long-haul flight'
when distance >= 1000 and
distance < 2000 then 'medium-haul flight'
when distance < 1000 then 'short-haul flight'
else 'error'
end as flight_type
}
where
distid = 'MI'</code></pre><P> </P><P> </P><P> </P><P> </P><H2 id="toc-hId--539288854">2. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_define_abstract_entity.htm" target="_self" rel="noopener noreferrer">CDS Abstract Entity</A> (7.53)</H2><H3 id="toc-hId--1029205366">Syntax</H3><P><FONT size="2" color="#0000FF">[@entity_annot1]</FONT><BR /><FONT size="2" color="#0000FF">[@entity_annot2]</FONT><BR /><FONT size="2" color="#0000FF">...</FONT><BR /><FONT size="2" color="#0000FF">[DEFINE] [ROOT] ABSTRACT ENTITY abstract_entity</FONT><BR /><FONT size="2" color="#0000FF"> [parameter_list]</FONT><BR /><FONT size="2" color="#0000FF"> element_list[;]</FONT></P><H3 id="toc-hId--1225718871">Description</H3><P>Works like a structure definition but nothing is created in DDIC and has annotations that can be evaluated with class CL_DD_DDL_ANNOTATION_SERVICE.</P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_extend_abstract_entity.htm" target="_blank" rel="noopener noreferrer"><EM>EXTEND ABSTRACT ENTITY</EM></A> (7.56)</P><P>Allows extension of existing abstract entity</P><P>EXTEND ABSTRACT ENTITY cds_abstract_entity WITH { element_list_extension }</P><P> </P><P data-unlink="true"><EM><U><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_absent_to_parent_assoc.htm" target="_blank" rel="noopener noreferrer">To-Parent Association Without ON</A></U></EM> (7.56) </P><P>The ON condition can be left out of a “to-parent” if the association target is also a CDS abstract entity.</P><P> </P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>define abstract entity DEMO_CDS_ABSTRACT_CHILD
{
key key_field : abap.char(1);
data_field : abap.int4;
_to_parent : association to parent DEMO_CDS_ABSTRACT_COMPOSITION
on _to_parent.key_field = $projection.key_field;
<- Last line can be omitted
}</code></pre><P> </P><P> </P><P> </P><P> </P><H2 id="toc-hId--1128829369"> 3. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_custom_entities.htm" target="_self" rel="noopener noreferrer">CDS Custom Entity</A> (7.54)</H2><H3 id="toc-hId--1618745881">Syntax</H3><P><FONT size="2" color="#0000FF">[@entity_annot1]</FONT><BR /><FONT size="2" color="#0000FF">[@entity_annot2]</FONT><BR /><FONT size="2" color="#0000FF">...</FONT><BR /><FONT size="2" color="#0000FF">[@ObjectModel.query.implementedBy : 'class_name']</FONT><BR /><FONT size="2" color="#0000FF">[DEFINE] [ROOT] CUSTOM ENTITY custom_entity</FONT><BR /><FONT size="2" color="#0000FF"> [parameter_list]</FONT><BR /><FONT size="2" color="#0000FF"> element_list[;]</FONT></P><H3 id="toc-hId--1815259386">Description</H3><P>No DDIC entries created and has annotations that can be evaluated with class CL_DD_DDL_ANNOTATION_SERVICE.</P><P>Used in RAP as basis of unmanaged queries.</P><P> </P><P><SPAN><EM> </EM></SPAN><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_extend_custom_entity.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>EXTEND CUSTOM ENTITY</EM></STRONG></A><SPAN><EM> (</EM></SPAN>7.57)</P><P>Makes it possible to add new elements to existing CDS custom entities by using CDS custom entity extensions.</P><P>EXTEND CUSTOM ENTITY CustomEntity WITH { ElementListExtension }</P><P> </P><H2 id="toc-hId--1718369884">4. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_proj_views.htm" target="_self" rel="noopener noreferrer"><SPAN>CDS Projection Views</SPAN></A></H2><H3 id="toc-hId-2086680900">Syntax</H3><P><FONT size="2" color="#0000FF"><EM>[</EM>@entity_annot1<EM>]</EM></FONT><BR /><FONT size="2" color="#0000FF"><EM>[</EM>@entity_annot2<EM>]</EM></FONT><BR /><FONT size="2" color="#0000FF">...</FONT><BR /><FONT size="2" color="#0000FF"><EM>[</EM>@proj_view_annot1<EM>]</EM></FONT><BR /><FONT size="2" color="#0000FF"><EM>[</EM>@proj_view_annot2<EM>]</EM></FONT><BR /><FONT size="2" color="#0000FF">...</FONT><BR /><FONT size="2" color="#0000FF">DEFINE <EM>[</EM>ROOT<EM>]</EM> VIEW ENTITY projection_view</FONT><BR /><FONT size="2" color="#0000FF"> <EM>[</EM> PROVIDER CONTRACT provider_contract</FONT><EM><FONT size="2" color="#0000FF">]</FONT></EM> [From 7.56]<BR /> <FONT size="2" color="#0000FF">AS PROJECTION ON cds_entity <EM>[</EM>AS alias_name<EM>]</EM></FONT><BR /> <FONT size="2" color="#0000FF"><EM>[</EM>association1 association2 ...</FONT><EM><FONT size="2" color="#0000FF">] </FONT> </EM>[From 7.55]<BR /> <FONT size="2" color="#0000FF"><EM>[</EM>redefined_assoc1 redefined_assoc2 ...</FONT><EM><FONT size="2" color="#0000FF">] </FONT></EM> [From 7.56]<BR /> <FONT size="2" color="#0000FF">{ projection_list }</FONT><BR /> <FONT size="2" color="#0000FF"> <EM>[</EM>WHERE cds_cond</FONT><EM><FONT size="2" color="#0000FF">] </FONT> </EM>[From 7.58 for Transactional Interfaces ]</P><H3 id="toc-hId-1890167395">Description</H3><P>A special CDS view entity that is based on another CDS view entity (called projected entity). CDS projection views adapt a CDS data model for service-specific use cases.</P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_define_view_as_projection.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>Associations</EM></STRONG></A> (7.55)</P><P>It is possible to add new, local, read-only associations association1, association2 to a projection view. Read-only associations in projection views can only be exposed but they cannot be used in path expressions to expose elements from new associations.</P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_proj_view_redefined_assoc.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>REDEFINE ASSOCIATION</EM></STRONG></A> (7.56) </P><P>For Projection views it is now possible to redefine an association. In this way, it is possible to modify an association from the underlying view. </P><P><FONT color="#0000FF">... REDEFINE ASSOCIATION [source.]_ProjAssoc [ filter] [AS _RedefinedName] redirection ...</FONT></P><P> </P><H3 id="toc-hId-1693653890">Provider Contracts</H3><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_pv_provider_contract.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>PROVIDER CONTRACT</EM></STRONG></A> (7.56) </P><P>For Projection views it is now possible to have a provider contract which specifies the scenario in which a CDS projection view is used. Provider contract options available:</P><UL><LI>TRANSACTIONAL_QUERY (7.56) [Default if not provided]</LI><LI>TRANSACTIONAL_INTERFACE (7.57) [Use for Transactional Interfaces]</LI><LI>ANALYTICAL_QUERY (7.57) [Use for Transient View Entities]</LI></UL><P> </P><H3 id="toc-hId-1665324076"><FONT size="4"><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_pv_provider_contract.htm" target="_self" rel="noopener noreferrer"><STRONG><EM>CDS Transactional </EM></STRONG><SPAN><STRONG><EM>Query</EM></STRONG></SPAN></A><SPAN><STRONG><EM> (7.56)</EM></STRONG></SPAN></FONT></H3><P><FONT color="#0000FF"><FONT color="#000000">Uses</FONT> DEFINE [ROOT] VIEW ENTITY AS PROJECTION ON</FONT> with provider contract “<FONT color="#0000FF">TRANSACTIONAL_QUERY</FONT>”.</P><P>Transactional queries are intended for modelling the projection layer of a RAP business object. A transactional projection view must always be part of a business object. That means it must either be a root entity itself, or it must be part of a composition tree that contains a root entity</P><P> </P><H3 id="toc-hId-1468810571"><FONT size="4"><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_pv_provider_contract.htm" target="_self" rel="noopener noreferrer"><STRONG><EM>CDS Transactional Interface</EM></STRONG></A><SPAN><STRONG><EM> (7.57)</EM></STRONG></SPAN></FONT></H3><P>Uses <FONT color="#0000FF">DEFINE VIEW ENTITY AS PROJECTION ON</FONT> with provider contract “<FONT color="#0000FF">TRANSACTIONAL_INTERFACE</FONT>”.</P><P>CDS transactional interfaces serve as stable public interface layer in a CDS data model. They are typically used in the context of the ABAP RESTful Application Programming Model to provide the basis for a RAP BO interface. </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_interface_cond_expr.htm" target="_blank" rel="noopener noreferrer"><EM>WHERE </EM></A> (7.58) condition allowed for Transactional Interfaces.</P><P> </P><H3 id="toc-hId-1272297066"><FONT size="4"><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_pv_provider_contract.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>CDS Analytical Projection Views</EM></STRONG></A><SPAN><STRONG><EM> (7.57)</EM></STRONG></SPAN></FONT></H3><P>Uses <FONT color="#0000FF">DEFINE TRANSIENT VIEW ENTITY AS PROJECTION ON</FONT> with provider contract “<FONT color="#0000FF">ANALYTICAL_QUERY</FONT>”.</P><P>A CDS DDL that is intended for modeling analytical queries within a CDS data model. A CDS analytical projection view defines an analytical query in its element_list.</P><P>The projected entity cds_entity can be an <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_analytical_cube_glosry.htm" target="_blank" rel="noopener noreferrer">analytical cube view</A>(7.57) or an <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_anal_dim_view_glosry.htm" target="_blank" rel="noopener noreferrer">analytical dimension view</A>(7.58). One base view can serve as a basis for multiple analytical projection views.</P>2025-01-09T07:55:43.926000+01:00https://community.sap.com/t5/technology-blogs-by-sap/how-to-implement-quot-readonly-update-quot-for-draft-instances/ba-p/13981904How to implement "readonly : update" for draft instances2025-01-09T17:40:28.603000+01:00Andre_Fischerhttps://community.sap.com/t5/user/viewprofilepage/user-id/55<H1 id="toc-hId-950228718">Introduction</H1><P>Via the customer influence channel the requirement was raised to "a<SPAN>llow to modify a field for a draft entity that is not already created in persistency table, the record only exists in draft table." when the field has been configured as readonly : update in the behavior definition. </SPAN></P><P><SPAN>Since this does not work out of the box, </SPAN><SPAN>I will show how such a behavior, a field which is read-only after the first draft has been saved can be achieved in RAP using the SAP standard. </SPAN></P><P><SPAN> </SPAN></P><H1 id="toc-hId-753715213"><SPAN>Problem description </SPAN></H1><P><SPAN>When a field is being defined as readonly for update </SPAN></P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code> field ( readonly : update ) AgencyId;</code></pre><P> </P><P> </P><P><SPAN>and if this application is draft-enabled it turns out, that the field cannot be edited after having provided an intial value in the first dialogue of your application. </SPAN></P><H1 id="toc-hId-557201708"><SPAN>Solution ( implementation ) </SPAN></H1><P><SPAN>You can test this code with sample RAP business object that is being created using the following tutorial: </SPAN></P><P><SPAN><A href="https://developers.sap.com/group.abap-build-fiori-element-rap.html" target="_blank" rel="noopener noreferrer">Build an SAP Fiori elements App Using the ABAP RESTful Application Programming Model (RAP) – Beginner [RAP100] | SAP Tutorials</A></SPAN></P><P><SPAN>The desired behavior can be achieved by using dynamic feature control. Instead of using the statement <STRONG>readonly : update</STRONG> you can use the following syntax in your behavior defintion. </SPAN></P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code> field ( features : instance ) AgencyId; </code></pre><P> </P><P> </P><P><SPAN>And in your behavior implementation in the <STRONG>get_instance_features()</STRONG> method you have to implement code that checks if an active instance of the travel entity is available. </SPAN></P><P><SPAN>If yes, the field will be made readonly. If not, and this is only the case when the object is being created as a draft but has not been persisted yet, the field will still be editable. </SPAN></P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code> METHOD get_instance_features.
DATA result_line LIKE LINE OF result.
" read relevant travel instance data
READ ENTITIES OF zrap100_r_traveltp_rou IN LOCAL MODE
ENTITY Travel
FIELDS ( AgencyId )
WITH CORRESPONDING #( keys )
RESULT DATA(travels)
FAILED failed.
LOOP AT travels INTO DATA(travel).
SELECT SINGLE * FROM zrap100_r_traveltp_rou
WHERE TravelId = -TravelId
INTO (travel_cds_line).
result_line-%tky = travel-%tky.
IF travel_cds_line IS NOT INITIAL.
result_line-%features-%field-AgencyId = if_abap_behv=>fc-f-read_only .
ELSE.
result_line-%features-%field-AgencyId = if_abap_behv=>fc-f-unrestricted.
ENDIF.
APPEND result_line TO result.
ENDLOOP.
ENDMETHOD.</code></pre><P> </P><P> </P><P> </P><H1 id="toc-hId-360688203"><SPAN>Result</SPAN></H1><P><SPAN>The app now behaves as follows: </SPAN></P><UL class="lia-list-style-type-upper-roman"><LI><SPAN>We create a new travel instance.</SPAN><OL><LI><SPAN>We enter a value for the field <STRONG>AgencyId </STRONG></SPAN></LI><LI><SPAN>and press the <STRONG>"Back"</STRONG> button<BR /><BR /><BR /><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="100_create_new_travel.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/210298iCF74C5FD0525E055/image-size/large?v=v2&px=999" role="button" title="100_create_new_travel.png" alt="100_create_new_travel.png" /></span></SPAN></LI></OL></LI></UL><P> </P><UL class="lia-list-style-type-upper-roman"><LI><SPAN>We can now see the newly created instance in our drafts</SPAN><OL><LI><SPAN>We select the editing status <STRONG>"Own Draft"</STRONG> </SPAN></LI><LI><SPAN>We select the newly created entity <BR /><BR /><BR /><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="200_create_new_travel.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/210311i1B657D51ACC61605/image-size/large?v=v2&px=999" role="button" title="200_create_new_travel.png" alt="200_create_new_travel.png" /></span><BR /></SPAN></LI></OL></LI></UL><P> </P><UL><LI>When we now edit the entity again we see that the field <STRONG>AgencyId</STRONG> can still be edited<BR /><OL><LI>We press <STRONG>Create</STRONG> to persist the data.<BR /><BR /><BR /><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="300_create_new_travel.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/210312iF211AB3EF4948326/image-size/large?v=v2&px=999" role="button" title="300_create_new_travel.png" alt="300_create_new_travel.png" /></span><BR /><BR /></LI></OL></LI></UL><P>The newly created item shows up and we press <STRONG>Edit</STRONG> again<BR /><BR /><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="400_create_new_travel.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/210315i23631F0E547471BE/image-size/large?v=v2&px=999" role="button" title="400_create_new_travel.png" alt="400_create_new_travel.png" /></span><BR /><BR /><BR /></P><UL><LI>Finally we can see that the field <STRONG>AgencyId</STRONG> has become readonly because an active instance exists. <BR /><BR /><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="500_create_new_travel.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/210318i8B109F01F55D320F/image-size/large?v=v2&px=999" role="button" title="500_create_new_travel.png" alt="500_create_new_travel.png" /></span></LI></UL>2025-01-09T17:40:28.603000+01:00https://community.sap.com/t5/technology-blogs-by-sap/new-sap-discovery-center-mission-mastering-sap-s-4hana-extension-with-sap/ba-p/13982559New SAP Discovery Center Mission: Mastering SAP S/4HANA Extension with SAP Build2025-01-10T12:27:25.847000+01:00ilya-belozerov-saphttps://community.sap.com/t5/user/viewprofilepage/user-id/1941622<DIV><SPAN>From the very beginning, SAP Build has been introduced as a unified low-code platform, enabling developers of all skill levels to create, extend, and automate business applications with drag-and-drop simplicity. Later, its capabilities were expanded with the integration of Java and JavaScript development, enhanced by AI features. And now the latest enhancements of SAP Build include ABAP development capabilities, advanced generative AI features, and deeper integration with SAP S/4HANA and other business applications. </SPAN></DIV><DIV> </DIV><DIV><SPAN>SAP Build simplifies extension development and accelerates ERP modernization by seamlessly connecting all SAP development tools — ABAP, Java, JavaScript, and low-code — to enable effortless collaboration across diverse skill sets.</SPAN></DIV><DIV> </DIV><DIV><SPAN>Start the new mission </SPAN><A href="https://discovery-center.cloud.sap/missiondetail/4420/4706/?tab=overview" target="_self" rel="nofollow noopener noreferrer"><SPAN>Mastering SAP S/4HANA Extension with SAP Build</SPAN></A><SPAN> to try out the power of the Fusion Development experience provided by SAP Build.</SPAN></DIV><DIV> </DIV><H3 id="toc-hId-1208420263"><SPAN>Who is the mission made for?</SPAN></H3><DIV> </DIV><DIV><SPAN>No matter if you are a professional developer or a citizen developer with small development experience, this mission will guide you to the process of developing your extension application within a few hours.</SPAN></DIV><H3 id="toc-hId-1011906758"><SPAN>What is it about?</SPAN></H3><DIV> </DIV><DIV><SPAN>The tutorial scenario is based on the following story:</SPAN></DIV><DIV> </DIV><DIV><SPAN>Suzan, a medical technician at <EM>SBA Medical Clinic</EM>, noticed a small issue with one of the medical devices during her routine equipment checks. To address it quickly, she used the </SPAN><EM>Service Hub Client</EM><SPAN> mobile app to report the problem directly from her smartphone. The app, powered by SAP's Cloud Application Programming Model (CAP), immediately logged the incident in a central system, ensuring all service details were captured in one place.</SPAN></DIV><DIV> </DIV><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="service-hub.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/210593iC6E389AE641A79F5/image-size/medium?v=v2&px=400" role="button" title="service-hub.png" alt="service-hub.png" /></span></P><P> </P><DIV><SPAN>Alex, the service manager at <EM>Health Tech Devices</EM>, received the report through the </SPAN><EM>Service Hub Admin</EM><SPAN> interface. He quickly reviewed the issue, prioritized it, and assigned a technician to fix the problem. Using the ABAP RESTful Application Programming model (RAP) power in background, Alex is able to assign the nearest processor of the issue, seeing all available technicians on the map within a selected range.</SPAN></DIV><DIV> </DIV><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="service-hub-admin.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/210594i03EA4EDE8679D0A2/image-size/medium?v=v2&px=400" role="button" title="service-hub-admin.png" alt="service-hub-admin.png" /></span></P><P> </P><H3 id="toc-hId-815393253"><SPAN>What will I do?</SPAN></H3><DIV> </DIV><DIV><SPAN>The final solution consists of several services and applications driven by SAP BTP.</SPAN></DIV><DIV> </DIV><DIV><SPAN><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="diagram.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/210596iCDEC4C384E51E94B/image-size/medium?v=v2&px=400" role="button" title="diagram.png" alt="diagram.png" /></span></SPAN></DIV><DIV> </DIV><DIV><SPAN>You will start development by creating and deploying a CAP application using </SPAN><SPAN>SAP Build Code</SPAN><SPAN>. This application will be the heart of the project, processing data for equipment maintenance issues. All the steps will be done using the power of artificial intelligence provided by Joule. You will design a data model, expose it with the services, implement some custom logic and deploy to the Cloud Foundry environment, including SAP HANA artifacts.</SPAN></DIV><DIV> </DIV><DIV><SPAN><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="joule.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/210598i7E6F6E8762E08F62/image-size/medium?v=v2&px=400" role="button" title="joule.png" alt="joule.png" /></span></SPAN></DIV><DIV> </DIV><DIV><SPAN>You will then create another background service using </SPAN><SPAN>SAP BTP ABAP environment</SPAN><SPAN>. This will provide the data for the available incident processors. The data includes some processor information and geo-location. The main data of a processor is assumed to come from an SAP S/4HANA Cloud system (Business Partner data). For simplicity, this data is uploaded only once. In real production scenarios, there should be a more comprehensive integration. To reproduce this scenario, you don't need an access to a real SAP S/4HANA Cloud system as you will use the SAP Business Accelerator Hub Sandbox. In addition, you will create a service using the ABAP RESTful Application Programming model to search for the processors within a given distance range using the power of the SAP HANA database geo-engine.</SPAN></DIV><DIV> </DIV><DIV><SPAN><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rap.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/210599i7280CE59CC81F869/image-size/medium?v=v2&px=400" role="button" title="rap.png" alt="rap.png" /></span></SPAN></DIV><DIV> </DIV><DIV><SPAN>To access the data from your front-end applications, you will create SAP BTP destinations.</SPAN></DIV><DIV> </DIV><DIV><SPAN>When all background services are available you will use </SPAN><SPAN>SAP Build Apps</SPAN><SPAN> to create 2 cross-platform applications. You will use all the power of SAP Build Apps hidden behind the drag-and-drop simplicity, including advanced components, complex (but still intuitive) formulas, REST-based integration for non-standard data requests, and so on.</SPAN></DIV><DIV> </DIV><H3 id="toc-hId-618879748"><SPAN>How can I start?</SPAN></H3><DIV> </DIV><DIV><SPAN>Try out the mission in SAP Discovery Center for free. The content of the mission is tested on a regular basis and will be kept up to date by integrating the latest services and features.</SPAN></DIV><DIV> </DIV><DIV><SPAN>Even though this mission involves numerous services and applications, you can complete all the steps from start to finish using the SAP BTP Trial Account.</SPAN></DIV><DIV> </DIV><DIV><SPAN>You are interested in more end-to-end missions? Pick up one of them from SAP Discovery Center.</SPAN></DIV><DIV> </DIV><DIV><SPAN>We are excited to hear your feedback about this mission. Please feel free share your thoughts in the comment section below or reach out to us via Discovery Center support tool.</SPAN></DIV>2025-01-10T12:27:25.847000+01:00https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/reuse-alv-grid-display-dynamic-total-in-editable-alv/ba-p/13981454REUSE_ALV_GRID_DISPLAY - Dynamic Total in Editable ALV2025-01-10T13:49:32.183000+01:00Abhijeethttps://community.sap.com/t5/user/viewprofilepage/user-id/1392530<P>In SAP ABAP, handling editable ALV (ABAP List Viewer) grids with dynamic events such as data changes and automatic summations can be tricky, but it provides a very effective way to interact with and manipulate data. The program we are reviewing here aims to achieve just that—enable editable fields in the ALV grid, track changes in those fields, and update the summation of those changes at runtime.</P><P>The main objective of the blog is to create an editable ALV grid where the user can modify the weight (BRGEW) of materials (MATNR). When any change occurs, the summation of the BRGEW field is automatically recalculated and displayed.</P><P>The ALV grid provides a user-friendly interface for displaying the data, and we utilize event handling (specifically the DATA_CHANGED event) to capture and process changes made by the user. Additionally, since the Enter key does not trigger a default action in the ALV grid, the report uses the DATA_CHANGED event to monitor any updates and recalculate the summation.</P><P><div class="video-embed-center video-embed"><iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F5QfZWl1r4-I%3Ffeature%3Doembed&display_name=YouTube&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5QfZWl1r4-I&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F5QfZWl1r4-I%2Fhqdefault.jpg&type=text%2Fhtml&schema=youtube" width="400" height="225" scrolling="no" title="Editable ALV and Dynamic Total" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture;" allowfullscreen="true"></iframe></div></P><H3 id="toc-hId-1208389506"><FONT size="5">Key Concepts:</FONT></H3><UL><LI><STRONG>Editable ALV</STRONG>: The ALV grid is made editable for the field BRGEW.</LI><LI><STRONG>Event Handling</STRONG>: The DATA_CHANGED event is used to detect when data in the grid changes, which triggers the summation update.</LI><LI><STRONG>Summation</STRONG>: Whenever the user edits the BRGEW field, the program recalculates the total value of the BRGEW column and displays the updated sum.</LI></UL><P><FONT size="5">Code Snippet:</FONT></P><P> </P><pre class="lia-code-sample language-abap"><code>REPORT ztest7.
TYPE-POOLS:slis.
DATA: gt_mara TYPE TABLE OF ztest_s,
gt_fieldcat TYPE slis_t_fieldcat_alv,
gt_events TYPE slis_t_event,
go_grid TYPE REF TO cl_gui_alv_grid,
gs_stable TYPE lvc_s_stbl,
gr_data TYPE REF TO data.
FIELD-SYMBOLS: <gtr_sum_tab> TYPE table.
START-OF-SELECTION.
SELECT matnr,
brgew
FROM mara
INTO TABLE _mara UP TO 10 ROWS.
IF sy-subrc EQ 0.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_structure_name = 'ZTEST_S'
CHANGING
ct_fieldcat = gt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
READ TABLE gt_fieldcat ASSIGNING FIELD-SYMBOL(<gs_fcat>) WITH KEY fieldname = 'BRGEW'.
IF sy-subrc EQ 0.
<gs_fcat>-edit = 'X'.
<gs_fcat>-do_sum = 'X'.
ENDIF.
APPEND VALUE #( name = 'DATA_CHANGED' form = 'GET_DATA_CHANGED' ) TO gt_events.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = gt_fieldcat
it_events = gt_events
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab = gt_mara.
ENDIF.
ENDIF.
FORM set_pf_status USING itr_extab TYPE slis_t_extab.
* Get the ALV Object reference
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = go_grid.
IF go_grid IS BOUND.
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
ENDIF.
" PF Status Code
CASE sy-ucomm.
* WHEN
WHEN OTHERS.
ENDCASE.
ENDFORM.
FORM get_data_changed USING io_data_changed TYPE REF TO cl_alv_changed_data_protocol.
IF go_grid IS BOUND.
LOOP AT io_data_changed->mt_mod_cells ASSIGNING FIELD-SYMBOL(<gs_changed>) WHERE fieldname = 'BRGEW'.
READ TABLE gt_mara ASSIGNING FIELD-SYMBOL(<gs_tab>) INDEX <gs_changed>-row_id.
IF sy-subrc EQ 0.
<gs_tab>-brgew = <gs_changed>-value.
ENDIF.
ENDLOOP.
go_grid->get_subtotals(
IMPORTING
ep_collect00 = gr_data " Overall Total
).
ASSIGN gr_data->* TO <gtr_sum_tab>.
READ TABLE <gtr_sum_tab> ASSIGNING FIELD-SYMBOL(<l_sum>) INDEX 1.
IF sy-subrc EQ 0.
ASSIGN COMPONENT 'BRGEW' OF STRUCTURE <l_sum> TO FIELD-SYMBOL(<lg_val>).
IF <lg_val> IS ASSIGNED.
<lg_val> = REDUCE #( INIT lv_i TYPE ntgew_15 FOR <ls_t> IN gt_mara NEXT lv_i = lv_i + <ls_t>-brgew ).
ENDIF.
ENDIF.
gs_stable-col = 'X'.
gs_stable-row = 'X'.
go_grid->refresh_table_display(
EXPORTING
is_stable = gs_stable " With Stable Rows/Columns
i_soft_refresh = 'X' " Without Sort, Filter, etc.
EXCEPTIONS
finished = 1 " Display was Ended (by Export)
OTHERS = 2
).
IF sy-subrc <> 0.
ENDIF.
ENDIF.
ENDFORM. "get_data_changed</code></pre><P> </P><P><STRONG>Event Handler Registration</STRONG></P><P> </P><pre class="lia-code-sample language-abap"><code>APPEND VALUE #( name = 'DATA_CHANGED' form = 'GET_DATA_CHANGED' ) TO gt_events.</code></pre><P> </P><P>The DATA_CHANGED event is added to the event table (gt_events). This event will trigger the GET_DATA_CHANGED form when any modification happens to the grid.</P><H4 id="toc-hId-1140958720">Make the BRGEW Field Editable and Enable Summation</H4><P> </P><pre class="lia-code-sample language-abap"><code>READ TABLE gt_fieldcat ASSIGNING FIELD-SYMBOL(<gs_fcat>) WITH KEY fieldname = 'BRGEW'.
IF sy-subrc EQ 0.
<gs_fcat>-edit = 'X'.
<gs_fcat>-do_sum = 'X'.
ENDIF.</code></pre><P> </P><P>In this section, we search for the BRGEW field in the field catalog (gt_fieldcat). If the field is found, it is set to be editable (edit = 'X') and summable (do_sum = 'X').</P><H4 id="toc-hId-944445215">PF Status</H4><P> </P><pre class="lia-code-sample language-abap"><code>FORM set_pf_status USING itr_extab TYPE slis_t_extab.
" Get the ALV Object reference
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = go_grid.
IF go_grid IS BOUND.
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
ENDIF.
" PF Status Code
CASE sy-ucomm.
WHEN OTHERS.
ENDCASE.
ENDFORM.</code></pre><P> </P><P>Intentionally, the FM GET_GLOBALS_FROM_SLVC_FULLSCR is initialized, and events are registered in the PF status so that the ENTER key press event should be detected. This can also be added in the TOP-OF-PAGE event. The ABAP code retrieves an ALV grid object (go_grid) using the function GET_GLOBALS_FROM_SLVC_FULLSCR and checks if it is properly initialized with the IS BOUND check. If the grid object is bound, it registers two edit events for the grid: one for when the user modifies data (mc_evt_modified), and another for when the user presses the Enter key (mc_evt_enter). These events are linked to the grid to allow further processing or actions in response to user interactions with the grid, such as triggering updates or executing custom logic.</P><P><STRONG>Data Changed Handler (Recalculate Sum)</STRONG></P><P> </P><pre class="lia-code-sample language-abap"><code>FORM get_data_changed USING io_data_changed TYPE REF TO cl_alv_changed_data_protocol.
IF go_grid IS BOUND.
LOOP AT io_data_changed->mt_mod_cells ASSIGNING FIELD-SYMBOL(<gs_changed>) WHERE fieldname = 'BRGEW'.
READ TABLE gt_mara ASSIGNING FIELD-SYMBOL(<gs_tab>) INDEX <gs_changed>-row_id.
IF sy-subrc EQ 0.
<gs_tab>-brgew = <gs_changed>-value.
ENDIF.
ENDLOOP.
go_grid->get_subtotals(
IMPORTING
ep_collect00 = gr_data " Overall Total
).
ASSIGN gr_data->* TO <gtr_sum_tab>.
READ TABLE <gtr_sum_tab> ASSIGNING FIELD-SYMBOL(<l_sum>) INDEX 1.
IF sy-subrc EQ 0.
ASSIGN COMPONENT 'BRGEW' OF STRUCTURE <l_sum> TO FIELD-SYMBOL(<lg_val>).
IF <lg_val> IS ASSIGNED.
<lg_val> = REDUCE #( INIT lv_i TYPE ntgew_15 FOR <ls_t> IN gt_mara NEXT lv_i = lv_i + <ls_t>-brgew ).
ENDIF.
ENDIF.
gs_stable-col = 'X'.
gs_stable-row = 'X'.
go_grid->refresh_table_display(
EXPORTING
is_stable = gs_stable " With Stable Rows/Columns
i_soft_refresh = 'X' " Without Sort, Filter, etc.
EXCEPTIONS
finished = 1 " Display was Ended (by Export)
OTHERS = 2
).
IF sy-subrc <> 0.
ENDIF.
ENDIF.
ENDFORM.</code></pre><P> </P><P>In the get_data_changed form, the system loops through the modified cells, retrieves the updated value, and updates the corresponding entry in the internal table gt_mara. Then, it calculates the sum of the BRGEW column and refreshes the ALV grid to display the updated total.</P><P>In conclusion, this blog demonstrates how to build an interactive and editable ALV grid in SAP ABAP that responds to user modifications in real-time. By leveraging the DATA_CHANGED event, we are able to efficiently track and process changes to the data, recalculate sums dynamically, and display the updated results without requiring the user to press any additional buttons. This approach provides a seamless and intuitive user experience while utilizing SAP's built-in functionality to manage the ALV grid and event handling.</P><P><FONT size="4">Thanks for Reading!</FONT></P><P>I hope this blog post provided useful insights into creating dynamic, editable ALV grids in SAP. Feel free to adapt and customize the provided code to suit your specific needs.</P><P><STRONG>Regards,</STRONG><BR />Abhijeet Tikar</P>2025-01-10T13:49:32.183000+01:00https://community.sap.com/t5/technology-blogs-by-members/disenchantment-gpt-for-generating-abap-code-documentation/ba-p/13983219Disenchantment: GPT for generating ABAP code documentation2025-01-11T18:24:29.595000+01:00Sandra_Rossihttps://community.sap.com/t5/user/viewprofilepage/user-id/145194<P>I just asked a publicly GPT trained model at my company, to generate the documentation of an old and huge ABAP program, to see if ChatGPT can save me some time to understand what the program does.</P><P>The prompt is limited to one or two thousand characters, so I can only ask for one portion of a subroutine at a time. The generated text is just good for explaining the meaning of each individual ABAP statement. It cannot save time.</P><P>Below are two questions and answers for your information.</P><P>Did you have a better experience with GenAI for generating a good ABAP documentation?</P><P>Which engine do you use? (public, SAP Joule, privately trained model, etc.)</P><P>Thank you.</P><P>Sandra</P><P>First prompt:</P><TABLE border="1" width="100%"><TBODY><TR><TD width="100%">Describe the detailed steps of the subroutine SAVE_COMMENT. Here is its code: FORM save_comment USING p_vl_max_fake p_ok_boolean. CLEAR sg_zfake_user. MOVE sy-datum TO sg_zfake_user-date_2. IF gw_mode = 'CREER'. MOVE sy-datum TO sg_zfake_user-date_1. MOVE 'E' TO sg_zfake_user-statut. ELSE. DELETE FROM zfake_user WHERE nfake = gi_nfake AND typefake = '2'. IF sy-subrc <> 0. ENDIF. MOVE g_date_1 TO sg_zfake_user-date_1. MOVE g_statut TO sg_zfake_user-statut. ENDIF. MOVE gi_nfake TO sg_zfake_user-nfake. MOVE '2' TO sg_zfake_user-typefake. MOVE 0 TO sg_zfake_user-notypefake. PERFORM affichage_commentaire USING 'GET' tg_fake_commentaire_user_m tg_fake_commentaire_admin_m. LOOP AT tg_fake_commentaire_user_m INTO sg_fake_commentaire. CONCATENATE sg_zfake_user-rubrique1 sg_fake_commentaire INTO sg_zfake_user-rubrique1 SEPARATED BY space. ENDLOOP. CONDENSE sg_zfake_user-rubrique1. MOVE sg_zfake_user-rubrique1 TO g_rubrique1. LOOP AT tg_fake_commentaire_admin_m INTO sg_fake_commentaire. CONCATENATE sg_zfake_user-rubrique2 sg_fake_commentaire INTO sg_zfake_user-rubrique2 SEPARATED BY space. ENDLOOP. CONDENSE sg_zfake_user-rubrique2. MOVE sg_zfake_user-rubrique2 TO g_rubrique2. MOVE p_encopiede TO sg_zfake_user-rubrique3. IF p_encopiede IS NOT INITIAL. CLEAR : b_mdp_ecc, b_sup_ecc , b_sup_decisionnel, sg_zfake_user-rubrique4, sg_zfake_user-rubrique6, sg_zfake_user-rubrique7. ELSE. IF b_mdp_ecc = 'X'. MOVE 'X' TO sg_zfake_user-rubrique4. ENDIF. IF b_mdp_infocentre = 'X'. MOVE 'X' TO sg_zfake_user-rubrique5. ENDIF. IF b_sup_ecc = 'X'. MOVE 'X' TO sg_zfake_user-rubrique6. ENDIF. IF b_sup_decisionnel = 'X'. MOVE 'X' TO sg_zfake_user-rubrique7. ENDIF. ENDIF. INSERT zfake_user FROM sg_zfake_user. IF sy-subrc <> 0. UPDATE zfake_user FROM sg_zfake_user. ENDIF. IF sy-subrc <> 0. MESSAGE 'Cannot save the comments' TYPE 'S' p_ok_boolean = 'X'. EXIT. ENDIF. ENDFORM.</TD></TR></TBODY></TABLE><P>The answer:</P><TABLE border="1" width="100%"><TBODY><TR><TD width="100%">There’s a problem processing your request. Please try again later or let me know if I can help.</TD></TR></TBODY></TABLE><P>I shortened the prompt:</P><TABLE border="1" width="100%"><TBODY><TR><TD width="100%" height="277px">Describe the detailed steps of the subroutine SAVE_COMMENT. Here is its code: FORM save_comment USING p_vl_max_fake p_ok_boolean. CLEAR sg_zfake_user. MOVE sy-datum TO sg_zfake_user-date_2. IF gw_mode = 'CREER'. MOVE sy-datum TO sg_zfake_user-date_1. MOVE 'E' TO sg_zfake_user-statut. ELSE. DELETE FROM zfake_user WHERE nfake = gi_nfake AND typefake = '2'. IF sy-subrc <> 0. ENDIF. MOVE g_date_1 TO sg_zfake_user-date_1. MOVE g_statut TO sg_zfake_user-statut. ENDIF. MOVE gi_nfake TO sg_zfake_user-nfake. MOVE '2' TO sg_zfake_user-typefake. MOVE 0 TO sg_zfake_user-notypefake. PERFORM affichage_commentaire USING 'GET' tg_fake_commentaire_user_m tg_fake_commentaire_admin_m. LOOP AT tg_fake_commentaire_user_m INTO sg_fake_commentaire. CONCATENATE sg_zfake_user-rubrique1 sg_fake_commentaire INTO sg_zfake_user-rubrique1 SEPARATED BY space. ENDLOOP.</TD></TR></TBODY></TABLE><P>The answer:</P><TABLE border="1" width="100%"><TBODY><TR><TD width="100%"><P>Using publicly trained GPT model...</P><P>Sure, let's break down the subroutine `SAVE_COMMENT` step by step:</P><P>Subroutine Definition<BR />FORM save_comment USING p_vl_max_fake p_ok_boolean.<BR />The subroutine SAVE_COMMENT is defined with two parameters: p_vl_max_fake and p_ok_boolean.</P><P>Step 1: Clear the Work Area<BR />CLEAR sg_zfake_user.<BR />The work area sg_zfake_user is cleared to ensure it starts with no data.</P><P>Step 2: Set the Current Date<BR />MOVE sy-datum TO sg_zfake_user-date_2.<BR />The current system date (sy-datum) is moved to the field date_2 of the work area sg_zfake_user.</P><P>Step 3: Check the Mode<BR />IF gw_mode = 'CREER'.<BR />The subroutine checks if the mode (gw_mode) is 'CREER' (which likely means 'create').</P><P>Step 3.1: If Mode is 'CREER'<BR />MOVE sy-datum TO sg_zfake_user-date_1.<BR />MOVE 'E' TO sg_zfake_user-statut.<BR />The current system date (sy-datum) is moved to the field date_1 of the work area sg_zfake_user.<BR />The status field statut of the work area sg_zfake_user is set to 'E'.</P><P>Step 3.2: If Mode is Not 'CREER'<BR />ELSE.<BR />DELETE FROM zfake_user WHERE nfake = gi_nfake AND typefake = '2'.<BR />IF sy-subrc <> 0.<BR />ENDIF.<BR />MOVE g_date_1 TO sg_zfake_user-date_1.<BR />MOVE g_statut TO sg_zfake_user-statut.<BR />The subroutine deletes entries from the database table zfake_user where nfake equals gi_nfake and typefake equals '2'.<BR />If the deletion is not successful (sy-subrc is not zero), it does nothing (empty ENDIF).<BR />The value of g_date_1 is moved to the field date_1 of the work area sg_zfake_user.<BR />The value of g_statut is moved to the field statut of the work area sg_zfake_user.</P><P>Step 4: Set Additional Fields<BR />MOVE gi_nfake TO sg_zfake_user-nfake.<BR />MOVE '2' TO sg_zfake_user-typefake.<BR />MOVE 0 TO sg_zfake_user-notypefake.<BR />The value of gi_nfake is moved to the field nfake of the work area sg_zfake_user.<BR />The value '2' is moved to the field typefake of the work area sg_zfake_user.<BR />The value 0 is moved to the field notypefake of the work area sg_zfake_user.</P><P>Step 5: Perform Another Subroutine<BR />PERFORM affichage_commentaire USING 'GET' tg_fake_commentaire_user_m tg_fake_commentaire_admin_m.<BR />The subroutine affichage_commentaire is called with the parameters 'GET', tg_fake_commentaire_user_m, and tg_fake_commentaire_admin_m.</P><P>Step 6: Loop Through Internal Table<BR />LOOP AT tg_fake_commentaire_user_m INTO sg_fake_commentaire.<BR />CONCATENATE sg_zfake_user-rubrique1 sg_fake_commentaire INTO sg_zfake_user-rubrique1 SEPARATED BY space.<BR />ENDLOOP.<BR />The subroutine loops through the internal table tg_fake_commentaire_user_m and reads each entry into the work area sg_fake_commentaire.<BR />For each entry, it concatenates the value of sg_fake_commentaire to the field rubrique1 of the work area sg_zfake_user, separated by a space.</P><P>End of Subroutine<BR />ENDFORM.<BR />The subroutine ends.</P><P>Summary<BR />The SAVE_COMMENT subroutine performs the following actions:</P><UL><LI>Clears the work area sg_zfake_user.</LI><LI>Sets the current date in date_2.</LI><LI>Depending on the mode (gw_mode), it either sets the creation date and status or deletes existing entries and sets the date and status from global variables.</LI><LI>Sets additional fields in the work area.</LI><LI>Calls another subroutine affichage_commentaire.</LI><LI>Loops through an internal table and concatenates its entries to a field in the work area.</LI></UL></TD></TR></TBODY></TABLE><P> </P>2025-01-11T18:24:29.595000+01:00https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/date-to-factory-date-conversion-with-s-4hana-abap-cds-view/ba-p/13988259Date to Factory Date Conversion with S/4HANA ABAP CDS view2025-01-16T20:15:24.433000+01:00uladzislau_pralathttps://community.sap.com/t5/user/viewprofilepage/user-id/185101<P>I wish S/4HANA ABAP CDS views supported date-to-factory-date conversion using an out-of-the-box built-in function, similar to currency or unit conversion. Unfortunately, that’s not the case. But don’t worry—I’ve got you covered with a custom-built S/4HANA ABAP CDS view.</P><P>S/4HANA provides DATE_CONVERT_TO_FACTORYDATE standard function module for date-to-factory-date conversion. Base on factory, for example, CA Canada:</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="uladzislau_pralat_0-1737040490889.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213115i4E82A466E5BD6F60/image-size/medium?v=v2&px=400" role="button" title="uladzislau_pralat_0-1737040490889.png" alt="uladzislau_pralat_0-1737040490889.png" /></span></P><P> </P><P>The function module converts date to closest next factory date (default "+" conversion option):</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="uladzislau_pralat_2-1737040875350.jpeg" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213124i63FE754402AB9312/image-size/medium?v=v2&px=400" role="button" title="uladzislau_pralat_2-1737040875350.jpeg" alt="uladzislau_pralat_2-1737040875350.jpeg" /></span></P><P>or closest prior factory date ("-" conversion option):</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="uladzislau_pralat_3-1737040914086.jpeg" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213125i77EDFB38EEC501CB/image-size/medium?v=v2&px=400" role="button" title="uladzislau_pralat_3-1737040914086.jpeg" alt="uladzislau_pralat_3-1737040914086.jpeg" /></span></P><P>The same date-to-factory-date conversion can be achieved using custom-built ABAP CDS view </P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="uladzislau_pralat_4-1737041466998.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213128i180CE8FC71EAA058/image-size/medium?v=v2&px=400" role="button" title="uladzislau_pralat_4-1737041466998.png" alt="uladzislau_pralat_4-1737041466998.png" /></span></P><P>All it takes a simple custom built ABAP CDS view</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="uladzislau_pralat_6-1737041728164.jpeg" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213132iFFCC50ECB0CE3E92/image-size/medium?v=v2&px=400" role="button" title="uladzislau_pralat_6-1737041728164.jpeg" alt="uladzislau_pralat_6-1737041728164.jpeg" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="uladzislau_pralat_0-1737054646707.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213183i4BF814A820FE720F/image-size/large?v=v2&px=999" role="button" title="uladzislau_pralat_0-1737054646707.png" alt="uladzislau_pralat_0-1737054646707.png" /></span></P><P>Above code does a trick transforming pivoted and nested factory calendar data </P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="uladzislau_pralat_8-1737044160689.jpeg" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213146i8056D5CF393FECC3/image-size/medium?v=v2&px=400" role="button" title="uladzislau_pralat_8-1737044160689.jpeg" alt="uladzislau_pralat_8-1737044160689.jpeg" /></span></P><P>into factory calendar on date level</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="uladzislau_pralat_9-1737044673748.jpeg" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213147i90893B534B8E4FCF/image-size/medium?v=v2&px=400" role="button" title="uladzislau_pralat_9-1737044673748.jpeg" alt="uladzislau_pralat_9-1737044673748.jpeg" /></span></P><P>followed by a couple of window functions to find next and previous factory date for first / last week-end or holiday date</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="uladzislau_pralat_0-1737651483013.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/216007iE768C99D397A21CB/image-size/medium?v=v2&px=400" role="button" title="uladzislau_pralat_0-1737651483013.png" alt="uladzislau_pralat_0-1737651483013.png" /></span></P><P>and copy it over to other week-end / holiday dates as well fill next factory date / previous factory date for weekdays.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="uladzislau_pralat_1-1737651537888.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/216008i814C317D65F93F2B/image-size/medium?v=v2&px=400" role="button" title="uladzislau_pralat_1-1737651537888.png" alt="uladzislau_pralat_1-1737651537888.png" /></span></P><P>Source code for the CDS view can be downloaded below:</P><P><A href="https://github.com/UladzislauPralat/ABAP/blob/master/DateToFactoryDateConversionWithS4HANAABAPCDSView/ZI_FactoryCalendar.abap" target="_self" rel="nofollow noopener noreferrer">ZI_FactoryCalendar</A> </P><P><A href="https://github.com/UladzislauPralat/ABAP/blob/master/DateToFactoryDateConversionWithS4HANAABAPCDSView/zcl_factory_calendar.abap" target="_self" rel="nofollow noopener noreferrer">ZCL_FACTORY_CALENDAR</A> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P>2025-01-16T20:15:24.433000+01:00https://community.sap.com/t5/technology-blogs-by-members/cds-access-controls-7-5x-quick-reference/ba-p/13986001CDS Access Controls 7.5x Quick Reference2025-01-17T05:45:21.145000+01:00jeffrey_towell2https://community.sap.com/t5/user/viewprofilepage/user-id/229148<P><FONT size="5" color="#000000">Introduction</FONT></P><P><FONT color="#000000"><SPAN>This Quick Reference is a collection of new CDS Access Control (DCL) functionality made available in ABAP 7.5x releases. This functionality is summarised in a way that will make sense to those familiar with Access Controls. Links to the SAP Help are also provided throughout to allow the reader to dive in deeper if desired. The version the functionality was released is also given to aid in determining if it is available in your system.</SPAN></FONT></P><P> </P><TABLE border="1" width="71.70390068546324%"><TBODY><TR><TD width="10%"><STRONG>S/4HANA</STRONG></TD><TD width="6.3824289405684755%">1511</TD><TD width="6.640826873385013%">1610</TD><TD width="6.253229974160204%">1709</TD><TD width="6.253229974160206%">1809</TD><TD width="7.02842377260982%">1909</TD><TD width="6.770025839793281%">2020</TD><TD width="6.770025839793281%">2021</TD><TD width="7.674418604651166%">2022</TD><TD width="7.932816537467698%">2023</TD></TR><TR><TD width="10%"><STRONG>ABAP</STRONG></TD><TD width="6.3824289405684755%">7.50</TD><TD width="6.640826873385013%">7.51</TD><TD width="6.253229974160204%">7.52</TD><TD width="6.253229974160206%">7.53</TD><TD width="7.02842377260982%">7.54</TD><TD width="6.770025839793281%">7.55</TD><TD width="6.770025839793281%">7.56</TD><TD width="7.674418604651166%">7.57</TD><TD width="7.932816537467698%">7.58</TD></TR></TBODY></TABLE><P><FONT size="4" color="#000000"><STRONG>Contents</STRONG></FONT></P><P data-unlink="true"><FONT color="#000000"><STRONG>1. Roles</STRONG> </FONT></P><P data-unlink="true"><FONT color="#000000"><STRONG>2. Access Rule</STRONG>s</FONT></P><UL><LI><FONT color="#000000">A. Conditional Rule </FONT></LI><LI><FONT color="#000000">B. Inherited Rule (OBSOLETE)</FONT></LI><LI><FONT color="#000000">C. Projection Rule (7.58)</FONT></LI></UL><P data-unlink="true"><FONT color="#000000"><STRONG>3. Access Conditions</STRONG></FONT></P><UL><LI><FONT color="#000000">A. Literal Condition</FONT></LI><LI><FONT color="#000000">B. PFCG Condition</FONT></LI><LI><FONT color="#000000">C. Aspect Condition</FONT></LI><LI><FONT color="#000000">D. User Condition (7.51) </FONT></LI><LI><FONT color="#000000">E. Inherit Condition </FONT></LI><LI><FONT color="#000000">F. DCL Function</FONT></LI><LI><FONT color="#000000">G. Boolean (7.53)</FONT></LI><LI><FONT color="#000000">H. VOID (7.53)</FONT></LI><LI><FONT color="#000000">I. IF…THEN…ELSE (7.57) </FONT></LI></UL><P> </P><H1 id="toc-hId-950369021"><FONT color="#0000FF">1. Roles</FONT></H1><P><FONT size="2" color="#0000FF">@MappingRole: true</FONT><BR /><FONT size="2" color="#0000FF">[@role_annot1]</FONT><BR /><FONT size="2" color="#0000FF">[@role_annot2]</FONT><BR /><FONT size="2" color="#0000FF">...</FONT><BR /><FONT size="2" color="#0000FF"><EM>[</EM>DEFINE<EM>]</EM> ROLE role_name <EM>[</EM>SWITCHABLE<EM>]</EM> { access_rules }</FONT></P><P><FONT color="#0000FF"><EM><STRONG>CDS Role</STRONG></EM> (7.50)</FONT></P><P><FONT color="#000000">Access Controls are expanded to include implicit evaluations of <STRONG><EM>CDS roles</EM></STRONG>. If a <STRONG><EM>CDS entity</EM></STRONG> is associated with a CDS role, an additional <STRONG><EM>access condition</EM></STRONG> is checked by default when the CDS entity is accessed using ABAP SQL. Only that data is read for which the current user has an authorization or that matches a literal condition.</FONT></P><P> </P><P><FONT color="#0000FF"><EM><STRONG>CDS Table Functions</STRONG></EM> <FONT color="#000000">(7.52)</FONT></FONT></P><P><FONT color="#000000">CDS roles can now also be defined for CDS table functions.</FONT></P><P> </P><P><FONT color="#0000FF"><EM><STRONG>DCL Restrictions for ABAP CDS Hierarchies</STRONG></EM> <FONT color="#000000">(7.54)</FONT></FONT></P><P><FONT color="#000000">ABAP CDS hierarchies can now be protected using access controls</FONT></P><P> </P><P><FONT color="#0000FF"><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_define_role.htm" target="_blank" rel="noopener noreferrer"><EM><STRONG>SWITCHABLE</STRONG></EM></A> <FONT color="#000000">(7.57)</FONT></FONT></P><P><FONT color="#000000">With this addition, the content of the role reacts to status changes in the Switch Framework .</FONT></P><P> </P><P> </P><P> </P><H1 id="toc-hId-753855516"><FONT color="#0000FF">2. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_dcl_role_rules.htm" target="_blank" rel="noopener noreferrer">Access Rules</A></FONT></H1><P><FONT size="2" color="#0000FF">A. ... conditional_rule| grant_rule</FONT><BR /><FONT size="2" color="#0000FF"> [conditional_rule| grant_rule]</FONT><BR /><FONT size="2" color="#0000FF"> ...</FONT><BR /><BR /><FONT size="2" color="#0000FF">B. ... inherited_rule </FONT><FONT size="2" color="#000000"> [Obsolete]</FONT><BR /><FONT size="2" color="#0000FF"> [conditional_rule| grant_rule]</FONT><BR /><FONT size="2" color="#0000FF"> [conditional_rule| grant_rule]</FONT><BR /><FONT size="2" color="#0000FF"> ...</FONT><BR /><BR /><FONT size="2" color="#0000FF">C. ... projection_rule ... <FONT color="#000000">[7.58]</FONT></FONT></P><P> </P><H2 id="toc-hId-686424730"><FONT color="#0000FF"><FONT color="#000000">A.</FONT> <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_dcl_role_cond_rule.htm" target="_blank" rel="noopener noreferrer">Conditional Rule</A></FONT></H2><P><FONT color="#0000FF">GRANT SELECT ON cds_entity</FONT><BR /><FONT color="#0000FF"> [WITH OPTIONAL ELEMENTS ( element1 DEFAULT { TRUE | FALSE }, ... ) ] <FONT color="#000000">[7.56]</FONT></FONT><BR /><FONT color="#0000FF"> [COMBINATION MODE OR | COMBINATION MODE AND | REDEFINITION] <FONT color="#000000">[7.54]</FONT></FONT><BR /><FONT color="#0000FF"> WHERE cds_cond;</FONT></P><P><FONT color="#000000">A conditional access rule GRANT SELECT ON with the addition WHERE restricts access to a CDS entity cds_entity using access conditions cds_cond. See section <STRONG>Access Conditions</STRONG>.</FONT></P><P> </P><P><FONT color="#0000FF"><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abencds_dcl_role_cond_rule.htm#!ABAP_ADDITION_1@1@" target="_blank" rel="noopener noreferrer"><EM><STRONG>WITH OPTIONAL ELEMENTS</STRONG></EM></A> <FONT color="#000000">(7.56)</FONT></FONT></P><P><FONT color="#000000">By declaring elements of an access control as optional you specify that these elements may be missing in inheritance targets of the access conditions using those elements.</FONT></P><P> </P><P><FONT color="#0000FF"><STRONG><EM>COMBINATION <FONT color="#0000FF">MODE</FONT> OR|AND</EM></STRONG> <FONT color="#000000">(7.54)</FONT></FONT></P><P><FONT color="#000000">Used to define how the access conditions of multiple access rules for the same CDS entity cds_entity are combined.</FONT></P><P><FONT color="#0000FF"><FONT color="#3366FF">COMBINATION MODE OR</FONT> <FONT color="#000000">is used to combine the access conditions using the logical operator <EM>or</EM>. If created, these access rules make the restrictions less strong.</FONT></FONT></P><P><FONT color="#0000FF"><FONT color="#3366FF">COMBINATION MODE AND</FONT> <FONT color="#000000">combines the current access rule with the logical operator <EM>and</EM> and the other access rules. This means the restrictions are made stronger.</FONT></FONT></P><P> </P><P><FONT color="#0000FF"><STRONG><EM>REDEFINITION</EM></STRONG> <FONT color="#000000">(7.54)</FONT></FONT></P><P><FONT color="#000000">Used to indicate that the specified CDS access rule is the only existing access rule and any other access rules are ignored.</FONT></P><P> </P><P><FONT color="#0000FF"><STRONG><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_dcl_role_grant_rule.htm" target="_blank" rel="noopener noreferrer"><EM>Full Access Rules</EM></A></STRONG> <FONT color="#000000">(7.51)</FONT></FONT></P><P><FONT color="#000000">A full access rule GRANT SELECT ON without the addition WHERE provides access to a CDS entity cds_entity without conditions.</FONT></P><P> </P><P> </P><H2 id="toc-hId-489911225"><FONT color="#0000FF"><FONT color="#000000">B.</FONT> <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_dcl_role_inherited_rule.htm" target="_blank" rel="noopener noreferrer">Inherited Rule (OBSOLETE)</A></FONT></H2><P> </P><H2 id="toc-hId-293397720"><FONT color="#0000FF"><FONT color="#000000">C.</FONT> <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_dcl_role_proj_rule.htm" target="_blank" rel="noopener noreferrer">Projection Rule</A> (7.58)</FONT></H2><P><FONT color="#0000FF">GRANT SELECT ON cds_entity_projection</FONT><BR /><FONT color="#0000FF"> AS PROJECTION ON cds_entity_base</FONT><BR /><FONT color="#0000FF"> FALLBACK ASSOCIATION fallback_association;</FONT></P><P><FONT color="#000000">A new type of access rule is available for CDS projection views of type CDS transactional query.</FONT></P><P><FONT color="#000000">At runtime, the access conditions of the base view are applied to the projection view if certain conditions are met. If it is not possible to apply the access conditions of the base view directly to the projection view, all access conditions are rewritten at runtime to point to the association fallback_association.</FONT></P><P><FONT color="#0000FF"><STRONG> </STRONG><STRONG> </STRONG></FONT></P><H1 id="toc-hId--32198504"><FONT color="#0000FF">3. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_dcl_role_conditions.htm" target="_blank" rel="noopener noreferrer">Access Conditions</A></FONT></H1><P><FONT color="#0000FF"><EM>A. </EM>... literal_condition</FONT><BR /><FONT color="#0000FF">B.<STRONG> </STRONG> | pfcg_condition</FONT><BR /><FONT color="#0000FF">C. | aspect_condition</FONT><BR /><FONT color="#0000FF">D. | user_condition</FONT><BR /><FONT color="#0000FF">E. | inherit_condition</FONT><BR /><FONT color="#0000FF">F. | dcl_function</FONT><BR /><FONT color="#0000FF">G. | TRUE <FONT color="#000000">[7.53]</FONT></FONT><BR /><FONT color="#0000FF">G. | FALSE <FONT color="#000000">[7.53]</FONT></FONT><BR /><FONT color="#0000FF">H. | VOID <FONT color="#000000"> [7.54]</FONT></FONT><BR /><FONT color="#0000FF"> I. | if_then_else ...</FONT></P><P><FONT color="#000000">The result of an access condition is true or false.</FONT></P><H4 id="toc-hId-158536148"> </H4><H2 id="toc-hId--296142795"><FONT color="#0000FF">A. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_cond_literal.htm" target="_blank" rel="noopener noreferrer">Literal Condition</A></FONT></H2><P><FONT color="#0000FF">... [ALL|EXISTS] {</FONT><BR /><FONT color="#0000FF"> { element [BYPASS WHEN bypass_condition] operator [']value['] }...</FONT><BR /><FONT color="#0000FF"> | { element [BYPASS WHEN bypass_condition] [NOT] BETWEEN [']value1['] AND [']value2['] }</FONT><BR /><FONT color="#0000FF"> | { element [BYPASS WHEN bypass_condition] [NOT] LIKE 'value' [ESCAPE 'esc'] }</FONT><BR /><FONT color="#0000FF"> | { element [BYPASS WHEN bypass_condition] IS [NOT] NULL }</FONT><BR /><FONT color="#0000FF"> | { element [BYPASS WHEN bypass_condition] IS [NOT] INITIAL } } ...</FONT></P><P><FONT color="#000000">Compares an element of a CDS entity with fixed values.</FONT></P><P> </P><P><STRONG><FONT color="#0000FF"><EM>ALL</EM></FONT></STRONG><FONT color="#000000"> (7.55)</FONT></P><P><FONT color="#000000">With new addition ALL, access conditions can express that access shall only be granted when from a set-valued association all values satisfy the condition.</FONT></P><P><FONT color="#0000FF">WHERE ALL toItem.State = 'A'</FONT></P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_cond_pfcg.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>BYPASS WHEN</EM> </STRONG></A>(7.55)</P><P>The addition BYPASS WHEN bypass_condition can be used to specify that the element is not used for authorization filtering if it meets the specified condition.</P><P><FONT color="#0000FF">ALL toSetVal.F BYPASS WHEN IS NULL = 'A'</FONT></P><P> </P><P data-unlink="true"><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_dcl_cond_expression.htm" target="_self" rel="noopener noreferrer"><STRONG><EM>Operator </EM></STRONG><SPAN>?=</SPAN> </A>(7.51)</P><P>Works Like the = operator, however, condition is also met if the value of the left side is the null value or a type-dependent initial value.</P><P> </P><P><STRONG><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_cond_literal.htm" target="_blank" rel="noopener noreferrer"><EM>BETWEEN and IS NULL</EM></A></STRONG> (7.52)</P><P>The operators BETWEEN and IS NULL are now available for literal conditions as part of an access condition.</P><P> </P><P><EM><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_cond_literal.htm" target="_blank" rel="noopener noreferrer"><U><STRONG>ESCAPE </STRONG></U></A></EM>(7.52)</P><P>{ element [NOT] LIKE 'value' [ESCAPE 'esc'] }</P><P>In a literal condition [NOT] LIKE, the percent sign (%) can be used as a placeholder for any string and the underscore character (_) for any single character. The addition ESCAPE can be used to define a single character escape character 'esc' in quotation marks for the placeholders. The character # is recommended as the escape character esc for the operator LIKE.</P><P> </P><P><STRONG><FONT color="#0000FF"><EM>IS [NOT] INITIAL</EM></FONT></STRONG> (7.55)</P><P>In a literal condition, IS <EM>[</EM>NOT<EM>]</EM> INITIAL can now be used to check whether the value of the left side matches (does not match) the initial value of the ABAP data type that matches the element.</P><P> </P><H2 id="toc-hId--492656300">B. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_cond_pfcg.htm" target="_blank" rel="noopener noreferrer">PFCG Condition</A></H2><P><FONT color="#3366FF">...[ALL|EXISTS]</FONT><BR /><FONT color="#3366FF"> ([element1 [BYPASS WHEN bypass_condition]</FONT><BR /><FONT color="#3366FF"> |{ element1[, element2 ...] }</FONT><BR /><FONT color="#3366FF"> [, element2 [BYPASS WHEN bypass_condition]</FONT><BR /><FONT color="#3366FF"> |{ element1[, element2 ...] } ...]] )</FONT><BR /><FONT color="#3366FF"> =|?= ASPECT pfcg_auth</FONT><BR /><FONT color="#3366FF"> ( auth_object [IN SCENARIO scenario_name], </FONT> [7.54]<BR /> <FONT color="#3366FF"> [mapped_field1|{ PFCG_MAPPING = pfcg_mapping}[,</FONT><BR /><FONT color="#3366FF"> mapped_field2|{ PFCG_MAPPING = pfcg_mapping} ...]][,</FONT><BR /><FONT color="#3366FF"> auth_field1 = 'value'[,</FONT><BR /><FONT color="#3366FF"> auth_field2 = 'value' ...]] ) ...</FONT></P><P> </P><P data-unlink="true"><STRONG><EM><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_cond_pfcg.htm" target="_self" rel="noopener noreferrer">ALL </A><FONT color="#000000"> (7.55)</FONT> </EM></STRONG></P><P>With new addition ALL, access conditions can express that access shall only be granted when from a set-valued association all values satisfy the condition.</P><P><FONT color="#3366FF">WHERE ALL toItem.State = 'A'</FONT></P><P> </P><P><STRONG><EM><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_cond_pfcg.htm" target="_blank" rel="noopener noreferrer">BYPASS WHEN</A></EM> </STRONG>(7.55)</P><P>The addition BYPASS WHEN bypass_condition can be used to specify that the element is not used for authorization filtering if it meets the specified condition.</P><P><FONT color="#3366FF">ALL toSetVal.F BYPASS WHEN IS NULL = 'A</FONT>'</P><P> </P><P><EM><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_cond_pfcg.htm" target="_blank" rel="noopener noreferrer"><STRONG>IN SCENARIO</STRONG></A></EM> (7.54)</P><P>Used to apply the switchable authorization (transaction SACF) to an authorization object.</P><P> </P><P><STRONG><EM><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_cond_pfcg_mapping.htm" target="_blank" rel="noopener noreferrer">PFCG Mapping</A></EM></STRONG></P><P><FONT color="#3366FF">... ( ... { element1[, element2 ...] } ... )</FONT><BR /><FONT color="#3366FF"> =|?= ASPECT pfcg_auth</FONT><BR /><FONT color="#3366FF"> ( ... PFCG_MAPPING = pfcg_mapping ... ) ...</FONT></P><P>Assigns an element list specified in curly brackets { element1<EM>[</EM>, element2 ...<EM>]</EM> } to a PFCG mapping pfcg_mapping in the definition of a PFCG condition.</P><P> </P><P><STRONG><FONT color="#0000FF"><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_define_pfcg_mapping.htm" target="_self" rel="noopener noreferrer"><EM>Define PFCG Mapping</EM></A></FONT></STRONG></P><P><FONT color="#3366FF">[DEFINE] PFCG_MAPPING pfcg_mapping(output1[, output2 ..spec])</FONT><BR /><FONT color="#3366FF"> BETWEEN mapping_entity AND auth_object [IN SCENARIO scenario_name]</FONT><BR /><FONT color="#3366FF"> { input1 = auth_field1 [CONSTRAINT ID][,</FONT><BR /><FONT color="#3366FF"> input2 = auth_field2 [CONSTRAINT ID] ... ] }</FONT></P><P>Defines a PFCG mapping pfcg_mapping as part of a CDS access policy defined using DEFINE ACCESSPOLICY. The name of the PFCG mapping must match the name of the CDS access policy.</P><P> </P><P><FONT color="#0000FF"><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_define_pfcg_mapping.htm" target="_blank" rel="noopener noreferrer"><STRONG><EM>PFCG Mapping to Element List</EM> </STRONG></A></FONT><SPAN> </SPAN>(7.53)</P><P>This mapping assigns the CDS elements to the authorization fields of an authorization object.</P><P> </P><P><STRONG><FONT color="#0000FF"><EM>CONSTRAINT ID</EM></FONT> </STRONG>(7.54)</P><P>Any number of optional assignments can be flagged using the addition CONSTRAINT ID.</P><P> </P><H2 id="toc-hId--689169805">C. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_cond_aspect.htm" target="_blank" rel="noopener noreferrer">Aspect Condition</A></H2><P><FONT color="#3366FF">... (element1 [, element2, ...] ) = ASPECT aspect</FONT><BR /><FONT color="#3366FF"> [FILTER BY ( aspect filter )] ... </FONT></P><P>An aspect condition can now be used to specify the generic aspect defined in an aspect definition in the right side introduced by ASPECT.</P><P> </P><P><STRONG><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_cond_aspect.htm" target="_blank" rel="noopener noreferrer">WITH FILTER ELEMENTS</A></STRONG> (7.56)</P><P>Denominates an arbitrary set of elements (path expressions are supported) of an aspect as filter elements. These filter elements can by referenced when using the user-defined aspect in an access condition.</P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_define_generic_aspect.htm" target="_blank" rel="noopener noreferrer"><STRONG>DEFINE ASPECT</STRONG></A></P><P><FONT color="#3366FF">[aspect_annot]</FONT><BR /><FONT color="#3366FF">[DEFINE] ASPECT aspect AS SELECT FROM aspect_entity</FONT><BR /><FONT color="#3366FF"> WITH USER ELEMENT user_element</FONT><BR /><FONT color="#3366FF"> [WITH FILTER ELEMENTS ( filter_element1 [AS filter_alias1], [7.56]</FONT><BR /><FONT color="#3366FF"> filter_element2... ) ]</FONT><BR /><FONT color="#3366FF">{</FONT><BR /><FONT color="#3366FF"> output1 [BYPASS WHEN aspect_bypass_condition]</FONT><BR /><FONT color="#3366FF"> [, ... ]</FONT><BR /><FONT color="#3366FF">}</FONT></P><P>Defines a user-defined aspect <EM>aspect </EM>as part of a <STRONG><EM>CDS access policy</EM></STRONG> defined using DEFINE ACCESSPOLICY. The name of the user-defined aspect must be the same as the name of the CDS access policy.</P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_define_accesspolicy.htm" target="_blank" rel="noopener noreferrer"><STRONG>DEFINE ACCESS POLICY</STRONG></A> (7.54)</P><P><FONT color="#3366FF">[@access_policy_annot]</FONT><BR /><FONT color="#3366FF">[DEFINE] ACCESSPOLICY access_policy {</FONT><BR /><FONT color="#3366FF"> pfcg_mapping_definition | aspect_definition</FONT><BR /><FONT color="#3366FF">}</FONT></P><P>Defines a CDS access policy <EM>access_policy</EM> in the CDS DCL to be used as a medium for further definitions.</P><P> </P><P> </P><H2 id="toc-hId--538428953">D. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_cond_user.htm" target="_blank" rel="noopener noreferrer">User Condition</A> (7.51)</H2><P>In a user condition, the predefined aspect user is specified on the right side introduced with ASPECT.</P><P><FONT color="#3366FF">DEFINE ROLE ...[ALL|EXISTS] element =|<>|?= ASPECT user ...</FONT></P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>@MappingRole: true
define role demo_cds_role_user {
grant select on demo_cds_auth_user
where
uname ?= aspect user; }</code></pre><P> </P><P> </P><P> </P><P>The following can now be checked instead of the user name:</P><UL><LI>The value of the alias. (7.55)</LI><LI>The number of the business partner assigned to the user. (7.55)</LI></UL><P> </P><H2 id="toc-hId--734942458">E. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_cond_inherit.htm" target="_blank" rel="noopener noreferrer">Inherit Condition </A></H2><P><FONT color="#3366FF">... { { INHERIT parent_role FOR GRANT SELECT ON cds_entity } <FONT color="#000000">[7.53]</FONT></FONT><BR /><FONT color="#3366FF"> | { INHERITING CONDITIONS FROM</FONT><BR /><FONT color="#3366FF"> { ENTITY cds_entity [DEFAULT TRUE|FALSE] }</FONT><BR /><FONT color="#3366FF"> | SUPER } }</FONT> [7.54]<BR /> <FONT color="#3366FF">[ replacing ] ... </FONT> [7.54]</P><P> </P><P><STRONG><FONT color="#0000FF"><EM>INHERIT parent_role</EM></FONT></STRONG> (7.53)</P><P><FONT color="#3366FF">{ INHERIT parent_role FOR GRANT SELECT ON cds_entity }</FONT></P><P>Makes old access rule (GRANT SELECT ON cds_entity INHERIT parent_role) obsolete.</P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>@MappingRole: true
define role DEMO_CDS_ROLE_INHERITED_VE {
grant select on DEMO_CDS_AUTH_INHERITED_VE
where
inherit demo_cds_role_lit_pfcg_ve
for grant select on demo_cds_authority_lit_pfcg_ve
or currcode = 'USD'; }</code></pre><P> </P><P> </P><P> </P><P> </P><P><STRONG><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abencds_f1_cond_inherit.htm#!ABAP_VARIANT_3@3@" target="_blank" rel="noopener noreferrer"><EM>INHERITING CONDITIONS FROM SUPER</EM></A></STRONG> (7.54)</P><P>This variant is possible only if the access rule has the addition REDEFINITION and only if the inherited CDS entity has access controls. Instead of this condition, those conditions are used that would have been applied by the access controls disabled by REDEFINITION.</P><P> </P><P><STRONG><EM><FONT color="#0000FF">REPLACING</FONT></EM></STRONG> (7.56)</P><P><FONT color="#3366FF">... REPLACING { replacement_step [, replacement_step, ...] }</FONT></P><P>Modifies inherited access conditions from source entity cds_entity before they are applied to the protected entity of their own access rule. It contains a sequence of replacement steps replacement_step which are executed in the order.</P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>WHERE INHERITING CONDITIONS FROM ENTITY Source REPLACING {
ELEMENT Element1OfSource WITH Element1OfTarget,
ELEMENT Assoc1OfSource WITH Assoc1[r = 4].Assoc2OfTarget,
ELEMENT Assoc2(p : $parameters.p1)[ q = 1].Field WITH MyShortField }</code></pre><P> </P><P> </P><P> </P><P> </P><P><STRONG><EM><FONT color="#0000FF">Replacing (Role Based)</FONT></EM></STRONG> (7.56)</P><P>Available for role-based inheritance</P><P> </P><H2 id="toc-hId--931455963">F. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_dcl_function.htm" target="_blank" rel="noopener noreferrer">DCL Function</A></H2><P><FONT color="#3366FF">... { SACF_CHECK_IN_USE( NAME => scenario_name [, OBJECT => auth_object ] ) <FONT color="#000000">[7.56]</FONT></FONT><BR /><FONT color="#3366FF"> IS [NOT] INITIAL }</FONT><BR /><FONT color="#3366FF"> | { OPTIONAL_ELEMENT_EXISTS( NAME => element ) <FONT color="#000000">[7.56]</FONT></FONT><BR /><FONT color="#3366FF"> IS [NOT] INITIAL }</FONT><BR /><FONT color="#3366FF"> | { SWITCH_RUNTIME_STATE( NAME => switch_name ) <FONT color="#000000">[7.58]</FONT></FONT><BR /><FONT color="#3366FF"> IS [NOT] INITIAL }</FONT><BR /><FONT color="#3366FF"> | { TOGGLE_RUNTIME_STATE( NAME => toggle_name ) <FONT color="#000000">[7.58]</FONT></FONT><BR /><FONT color="#3366FF"> IS [NOT] INITIAL }</FONT><BR /><FONT color="#3366FF"> | { CONTEXT_NODE_EXISTS(...)</FONT><BR /><FONT color="#3366FF"> IS [NOT] INITIAL } ...</FONT></P><P> </P><P data-unlink="true"><SPAN><STRONG><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_dcl_function.htm" target="_self" rel="noopener noreferrer">SACF_CHECK_IN_USE</A> </STRONG><FONT color="#000000">(7.56)</FONT> </SPAN></P><P>Enabling/Disabling of Access Conditions Based on the State of SACF. This setting can be used to enable or disable entire condition sets.</P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>GRANT SELECT ON cds_entity
WHERE
SACF_CHECK_IN_USE (NAME => NEW_AUTH_SWITCH ) IS INITIAL
AND
( element ) = ASPECT PFCG_AUTH( OLD_AUTH, F )
OR
SACF_CHECK_IN_USE( NAME => NEW_AUTH_SWITCH ) IS NOT INITIAL
AND
( element ) = ASPECT PFCG_AUTH( NEW_AUTH, F );</code></pre><P> </P><P> </P><P> </P><P> </P><P><STRONG><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abencds_f1_dcl_function.htm#!ABAP_VARIANT_2@2@" target="_blank" rel="noopener noreferrer">OPTIONAL_ELEMENT_EXISTS </A></STRONG>(7.56)</P><P>With this DCL function, existence of the given CDS element in the protected entity can be queried at runtime. Based on the outcome of the check, larger condition blocks in the access control can then be enabled or disabled.</P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>GRANT SELECT ON cds_entity
WITH OPTIONAL ELEMENTS (itemState DEFAULT FALSE )
WHERE
OPTIONAL_ELEMENT_EXISTS( NAME => itemState ) IS INITIAL
AND
toItem.state = 'A'
OR
OPTIONAL_ELEMENT_EXISTS( NAME => itemState ) IS NOT INITIAL
AND
itemState = 'A';</code></pre><P> </P><P> </P><P> </P><P> </P><P><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_dcl_function.htm" target="_blank" rel="noopener noreferrer"><STRONG>DCL function SWITCH_RUNTIME_STATE</STRONG></A> (7.58)</P><P><FONT color="#3366FF">{ SWITCH_RUNTIME_STATE( NAME => switch_name )</FONT><BR /><FONT color="#3366FF"> IS [NOT] INITIAL }</FONT></P><P>Retrieves the runtime state of a switch in the Switch Framework (SFW). If state is “on” then IS NOT INITIAL returns TRUE.</P><P>Can only be used for switches <U>not</U> of type <EM>Feature Toggle.</EM></P><P> </P><P data-unlink="true"><SPAN><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_dcl_function.htm" target="_blank" rel="noopener noreferrer"><EM><STRONG>DCL function TOGGLE_RUNTIME_STATE</STRONG></EM></A> (7.58) </SPAN></P><P><FONT color="#3366FF">{ TOGGLE_RUNTIME_STATE( NAME => toggle_name )</FONT><BR /><FONT color="#3366FF"> IS [NOT] INITIAL }</FONT> </P><P>Behaves like SWITCH_RUNTIME_STATE at runtime. Can only be used for switches of type <EM>Feature Toggle</EM>.</P><P> </P><P><STRONG><FONT color="#0000FF"><EM>CONTEXT_NODE_EXISTS</EM></FONT></STRONG></P><P>Reserved for use by SAP.</P><P> </P><H2 id="toc-hId--1127969468">G. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_dcl_role_conditions.htm" target="_blank" rel="noopener noreferrer"><SPAN>Boolean</SPAN></A> (7.53)</H2><P>New Boolean predicates TRUE and FALSE can now be used as part of an access condition.</P><P> </P><H2 id="toc-hId--1324482973"><SPAN>H. VOID</SPAN> (7.53)</H2><P>Defines that the access condition in question is ignored.</P><H2 id="toc-hId--1520996478"><SPAN> </SPAN></H2><H2 id="toc-hId--1717509983">I. <A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_dcl_ifthenelse.htm" target="_blank" rel="noopener noreferrer">IF…THEN…ELSE</A> (7.57)</H2><P>Can now be used as part of an access condition.</P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-abap"><code>GRANT SELECT ON cds_entity
WHERE
IF
(
( $PARAMETERS.P1 = 'NEW' OR $PARAMETERS.P1 = 'MODERN' )
AND
( ) = ASPECT PFCG_AUTH( S_DEMO )
)
THEN
{
A_NEW = 1 AND ( B_NEW ) = ASPECT PFCG_AUTH( S_DEMO, F1 )
}
ELSE
{
A_OLD = 1 AND ( B_OLD ) = ASPECT PFCG_AUTH( S_OLD, F1 )
};</code></pre><P> </P><P> </P><P> </P><P> </P><P> </P>2025-01-17T05:45:21.145000+01:00https://community.sap.com/t5/application-development-blog-posts/creating-spro-node-for-flight-view-clusters-in-sap/ba-p/13988550Creating SPRO Node for Flight View Clusters in SAP2025-01-17T15:28:34.468000+01:00Khan-Muskanhttps://community.sap.com/t5/user/viewprofilepage/user-id/1451082<P><SPAN class=""><SPAN class="">This blog post provides a beginner-friendly introduction to the concept of creating a custom SPRO node </SPAN><SPAN class="">and assigning a custom view cluster to it</SPAN><SPAN class="">.</SPAN></SPAN></P><P><FONT size="5"><STRONG><SPAN>Introduction</SPAN></STRONG></FONT></P><P><SPAN class=""><SPAN class="">In SAP, </SPAN><SPAN class="">SPRO node</SPAN><SPAN class="">s </SPAN><SPAN class="">provi</SPAN><SPAN class="">de</SPAN><SPAN class=""> an organized way to access an</SPAN><SPAN class="">d </SPAN><SPAN class="">mainta</SPAN><SPAN class="">in</SPAN><SPAN class=""> configuration tasks within SAP systems. This blo</SPAN><SPAN class="">g </SPAN><SPAN class="">demonstrat</SPAN><SPAN class="">es</SPAN><SPAN class=""> how to create a custom SPRO node for a view cluster based on flight-related data.</SPAN></SPAN></P><P><FONT size="5"><STRONG><SPAN>Scenario Overview</SPAN></STRONG></FONT></P><P><SPAN class=""><SPAN class="">Imagine you are tasked with managing flight-related configuration data stored in SAP tables such as </SPAN></SPAN><SPAN class=""><SPAN class="">SFLIGHT</SPAN></SPAN><SPAN class=""><SPAN class=""> (flight schedule), </SPAN></SPAN><SPAN class=""><SPAN class="">SCARR</SPAN></SPAN><SPAN class=""><SPAN class=""> (airline details), and </SPAN></SPAN><SPAN class=""><SPAN class="">SPFLI</SPAN></SPAN><SPAN class=""><SPAN class=""> (flight connection). You aim to create a view cluster displaying and </SPAN><SPAN class="">maintaining</SPAN><SPAN class=""> this data and link it to a custom SPRO node for seamless navigation.</SPAN></SPAN></P><P><SPAN>T-code to create SPRO Node: - SIMGH.</SPAN></P><P><SPAN>T-code to create View Cluster: - SE54.</SPAN></P><P><FONT size="5"><STRONG><SPAN class=""><SPAN class="">Step-by-Step Implementation</SPAN></SPAN></STRONG></FONT></P><P><FONT size="4"><STRONG>1. Create the View Cluster: -</STRONG></FONT></P><P><SPAN><FONT size="4">Step1.</FONT> Go to T-Code SE11 and create a maintenance view. Provide the name and click on the create button.</SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_0-1737090434334.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213261iCF00AAB3B9C3A63F/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_0-1737090434334.png" alt="KhanMuskan_0-1737090434334.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step2.</FONT> Select the Maintenance view radio button and click on </SPAN><SPAN class="">the Copy</SPAN><SPAN class=""> button.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_0-1737091666852.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213263i6DCF8D166C027A4F/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_0-1737091666852.png" alt="KhanMuskan_0-1737091666852.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step3.</FONT> Provide the description and in the </SPAN><SPAN class="">Table/Join condition</SPAN><SPAN class=""> tab provide ‘</SPAN><SPAN class="">SCARR’ as table name and click on View Fields.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_1-1737091708191.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213264i9A6000B5B5CD6FE2/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_1-1737091708191.png" alt="KhanMuskan_1-1737091708191.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step4.</FONT> All the key fields are automatically added to the view. To add more </SPAN><SPAN class="">fields,</SPAN><SPAN class=""> click on the button Table fields.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_0-1737091787719.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213265i8EA4E849C57EFCC2/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_0-1737091787719.png" alt="KhanMuskan_0-1737091787719.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step5.</FONT> Select some fields and click on </SPAN><SPAN class="">the Copy</SPAN><SPAN class=""> button to add.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_1-1737091816442.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213266iB5896FF0F8155B5B/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_1-1737091816442.png" alt="KhanMuskan_1-1737091816442.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step6.</FONT> All the selected fields of the table are added to the view. now activate the view.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_2-1737091841894.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213267i020E92D5228557C5/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_2-1737091841894.png" alt="KhanMuskan_2-1737091841894.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step7.</FONT> Creating the Table maintenance generator. Navigate along the highlighted path.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_3-1737091874629.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213268i24DE477CAA3FF43F/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_3-1737091874629.png" alt="KhanMuskan_3-1737091874629.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step8.</FONT> Provide the function group name, screen </SPAN><SPAN class="">number</SPAN><SPAN class=""> and click on the create button to complete the TMG and then go back.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_0-1737091969136.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213270iD5FB34BDC624E317/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_0-1737091969136.png" alt="KhanMuskan_0-1737091969136.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step9.</FONT> Now click on the Contents button</SPAN></SPAN><SPAN class=""><SPAN class="">.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_1-1737092059283.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213271iA0BC2545C2637889/image-size/medium?v=v2&px=400" role="button" title="KhanMuskan_1-1737092059283.png" alt="KhanMuskan_1-1737092059283.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step10.</FONT> It shows all the records.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_2-1737092358593.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213272i338D497A646F7110/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_2-1737092358593.png" alt="KhanMuskan_2-1737092358593.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step11.</FONT> Follow the above shown steps to create another maintenance view ‘ZMUK_SPFLI</SPAN><SPAN class="">’.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_3-1737092390199.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213273i10D7C26CF354A0C7/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_3-1737092390199.png" alt="KhanMuskan_3-1737092390199.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step12.</FONT> Table Fields.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_4-1737092420960.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213274i90A0E2D581153F61/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_4-1737092420960.png" alt="KhanMuskan_4-1737092420960.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step</SPAN><SPAN class="">13</SPAN></FONT><SPAN class=""><FONT size="4">.</FONT> Create </SPAN><SPAN class="">TMG (</SPAN><SPAN class="">Table maintenance generator).</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_5-1737092457793.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213275i13495CE7C8DB9A8E/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_5-1737092457793.png" alt="KhanMuskan_5-1737092457793.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step1</SPAN><SPAN class="">4</SPAN></FONT><SPAN class=""><FONT size="4">.</FONT> Follow the above shown steps to create another maintenance view ‘ZMUK_SFLIGHT</SPAN><SPAN class="">’.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_6-1737092490741.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213276iE80F21BCC91B1B34/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_6-1737092490741.png" alt="KhanMuskan_6-1737092490741.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step1</SPAN><SPAN class="">5</SPAN></FONT><SPAN class=""><FONT size="4">.</FONT> Table Fields.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_7-1737092519783.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213277iBEB606E76DCD1104/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_7-1737092519783.png" alt="KhanMuskan_7-1737092519783.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step</SPAN><SPAN class="">16</SPAN></FONT><SPAN class=""><FONT size="4">.</FONT> Create </SPAN><SPAN class="">TMG (</SPAN><SPAN class="">Table maintenance generator).</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_8-1737092553350.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213278i962274BEAE0DF8D8/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_8-1737092553350.png" alt="KhanMuskan_8-1737092553350.png" /></span></P><P><FONT size="4"><STRONG><SPAN class=""><SPAN class="">2. Steps to Create View Cluster: -</SPAN></SPAN></STRONG></FONT></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step</SPAN><SPAN class="">1</SPAN><SPAN class="">.</SPAN></FONT><SPAN class=""> Go to SE54 t-code</SPAN><SPAN class="">.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_0-1737092744427.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213280i973DD81E485E2C2E/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_0-1737092744427.png" alt="KhanMuskan_0-1737092744427.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step</SPAN><SPAN class="">2</SPAN></FONT><SPAN class=""><FONT size="4">.</FONT> Click on the Edit View Cluster Button.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_0-1737093009239.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213281iC246A0373F7D1DDF/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_0-1737093009239.png" alt="KhanMuskan_0-1737093009239.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step3.</FONT> Provide the View Cluster Name and click on the Create button.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_1-1737093039558.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213282i0835E232B17E6974/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_1-1737093039558.png" alt="KhanMuskan_1-1737093039558.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step</SPAN><SPAN class="">4</SPAN></FONT><SPAN class=""><FONT size="4">.</FONT> Under the Header Entry, provide short text and double click on Object Structure.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_2-1737093091330.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213283i93B00CF4143BA43B/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_2-1737093091330.png" alt="KhanMuskan_2-1737093091330.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step</SPAN><SPAN class="">5</SPAN></FONT><SPAN class=""><FONT size="4">.</FONT> Under Object Structure Click on New Entries Button.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_3-1737093131270.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213284i2091A8659DAB145E/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_3-1737093131270.png" alt="KhanMuskan_3-1737093131270.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step6</SPAN></FONT><SPAN class=""><FONT size="4">.</FONT> </SPAN><SPAN class="">Now provide the three above created maintenance view in hierarchical manner. Provide </SPAN><SPAN class="">a</SPAN><SPAN class=""> short text for all. Set the position. Select the view ‘ZMUK_SCARR’ as the start</SPAN><SPAN class="">.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_4-1737093259374.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213285iEB242D691048E8C3/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_4-1737093259374.png" alt="KhanMuskan_4-1737093259374.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step7.</FONT> Now select the first line and click on </SPAN><SPAN class="">the Field</SPAN><SPAN class="">-dependence button.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_5-1737093285662.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213286iAA60C6238BD9CF24/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_5-1737093285662.png" alt="KhanMuskan_5-1737093285662.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step8.</FONT> Now select the second line and click on </SPAN><SPAN class="">the Field</SPAN><SPAN class="">-dependence button.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_6-1737093333527.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213287iCF81DEED3A1CE035/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_6-1737093333527.png" alt="KhanMuskan_6-1737093333527.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step9.</FONT> Now select the third line and click on the Field-dependence button.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_7-1737093361890.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213288i11BBB6935C77AE1B/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_7-1737093361890.png" alt="KhanMuskan_7-1737093361890.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step10. </FONT>In the Header Entry section, click on the Activate button.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_8-1737093395165.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213289i0CE408A13587ACA1/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_8-1737093395165.png" alt="KhanMuskan_8-1737093395165.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step11.</FONT> Go back and Click on the TEST button to test the View Cluster.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_9-1737093425543.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213290i205F07CCBF5C3E81/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_9-1737093425543.png" alt="KhanMuskan_9-1737093425543.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step12.</FONT> Now the records from ‘ZMUK_SCARR’ </SPAN><SPAN class="">are</SPAN><SPAN class=""> displayed.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_10-1737093452020.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213291i314EA728E31B7F1C/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_10-1737093452020.png" alt="KhanMuskan_10-1737093452020.png" /></span></P><P><FONT size="4"><STRONG><SPAN class=""><SPAN class="">3. Steps to Create SPRO Node and assign the above created view cluster: -</SPAN></SPAN></STRONG></FONT></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step1. </SPAN></FONT><SPAN class="">Let’s</SPAN><SPAN class=""> decide the node under which we can add this table as a sub-node. Go to </SPAN><SPAN class="">T-code</SPAN><SPAN class="">- SPRO.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_0-1737093674159.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213292i7E23A89E27E5F394/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_0-1737093674159.png" alt="KhanMuskan_0-1737093674159.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step2.</FONT> Click on SAP Reference IMG.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_1-1737093701794.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213293i6ED2406B9E50F7D1/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_1-1737093701794.png" alt="KhanMuskan_1-1737093701794.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step</SPAN><SPAN class="">3</SPAN></FONT><SPAN class=""><FONT size="4">.</FONT> We figured out </SPAN><SPAN class="">that</SPAN><SPAN class=""> we will add this customizing view cluster under the </SPAN><SPAN class="">Structure (</SPAN><SPAN class="">Node</SPAN><SPAN class=""><span class="lia-unicode-emoji" title=":disappointed_face:">😞</span></SPAN> <SPAN class="">‘</SPAN><SPAN class="">Product Compliance</SPAN><SPAN class="">’</SPAN><SPAN class="">.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_2-1737093798109.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213294i2992062D2B7CD246/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_2-1737093798109.png" alt="KhanMuskan_2-1737093798109.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step</SPAN><SPAN class="">4</SPAN></FONT><SPAN class=""><FONT size="4">.</FONT> Go to T</SPAN><SPAN class="">-</SPAN><SPAN class="">code:</SPAN><SPAN class=""> SIMGH.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_3-1737093828109.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213297iF81129E8D3241C57/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_3-1737093828109.png" alt="KhanMuskan_3-1737093828109.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step5.</FONT> Click on the F4 </SPAN><SPAN class="">button</SPAN><SPAN class=""> against IMG Structure.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_4-1737093857439.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213301iBA03B5A1FAB331FD/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_4-1737093857439.png" alt="KhanMuskan_4-1737093857439.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step6.</FONT> Grom the search criteria. provide ‘Product compliance’ and click on Execute button.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_5-1737093882129.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213302iBDABBC57762062AE/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_5-1737093882129.png" alt="KhanMuskan_5-1737093882129.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step7.</FONT> Select our decided structure “Product Compliance</SPAN><SPAN class="">”.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_6-1737093915508.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213303i0A2410F9E4163BE9/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_6-1737093915508.png" alt="KhanMuskan_6-1737093915508.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step8.</FONT> Now click on the Edit button.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_7-1737093943394.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213304i1483DC8B7C72AA2D/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_7-1737093943394.png" alt="KhanMuskan_7-1737093943394.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step9.</FONT> Now click on </SPAN></SPAN><SPAN class=""><SPAN class="">the Continue</SPAN><SPAN class=""> button.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_8-1737094082749.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213305iA34355B90A4B7CC7/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_8-1737094082749.png" alt="KhanMuskan_8-1737094082749.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step</SPAN><SPAN class="">10</SPAN></FONT><SPAN class=""><FONT size="4">.</FONT> Select the Structure ‘Product Compliance’ and click on the highlighted button</SPAN></SPAN><SPAN class=""><SPAN class=""> (Insert structure node as sub nodes)</SPAN></SPAN><SPAN class=""><SPAN class="">.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_9-1737094119313.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213306i79ABAC1CED6AC856/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_9-1737094119313.png" alt="KhanMuskan_9-1737094119313.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step11. </SPAN></FONT><SPAN class="">Provide the </SPAN><SPAN class="">N</SPAN><SPAN class="">ode text and click on continue.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_10-1737094161901.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213307i5F122D740AA5B0B1/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_10-1737094161901.png" alt="KhanMuskan_10-1737094161901.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step12. </SPAN></FONT><SPAN class="">The node has been added to the structure.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_11-1737094189263.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213309i6676DE4CBCF92FDF/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_11-1737094189263.png" alt="KhanMuskan_11-1737094189263.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step13.</FONT> </SPAN><SPAN class="">Select the </SPAN><SPAN class="">Sub-</SPAN><SPAN class="">node and click on Activity.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_0-1737094509643.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213311iDE8C52C132B212FB/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_0-1737094509643.png" alt="KhanMuskan_0-1737094509643.png" /></span></P><P><SPAN><FONT size="4">Step14.</FONT> Provide the ID ‘ZVCL_SPRO_MAPPING’, Name ‘SPRO view Cluster Assignment’.</SPAN></P><P><SPAN>Under the ‘Document’ tab, provide the document name ‘ZVCL_SPRO_MAPPING _DOC’ and click on Create button.</SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_1-1737094543602.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213314i0628C792F803A1FC/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_1-1737094543602.png" alt="KhanMuskan_1-1737094543602.png" /></span></P><P>Scroll a bit to the right to find the create button.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_2-1737094559158.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213315i79791824945C9BCA/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_2-1737094559158.png" alt="KhanMuskan_2-1737094559158.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step15. </SPAN></FONT><SPAN class="">Click on Allow.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_3-1737094609754.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213317i6557D9765B9A1600/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_3-1737094609754.png" alt="KhanMuskan_3-1737094609754.png" /></span></P><P><FONT size="4"><SPAN class="">Step</SPAN><SPAN class="">16</SPAN><SPAN class="">. </SPAN></FONT><SPAN class="">Maintain some help document for the user for F1 purpose and activate it. Go Back.</SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_4-1737094643881.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213318iAEDD3EBCA0762535/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_4-1737094643881.png" alt="KhanMuskan_4-1737094643881.png" /></span></P><P><SPAN>When Clicked on Activate button, It will ask for package and TR, provide it and save it. And then Go back.</SPAN><SPAN> </SPAN></P><P><SPAN><FONT size="4">Step17.</FONT> Now click on Maint.Objects tab as highlighted.</SPAN><SPAN> </SPAN></P><P><SPAN><FONT size="4">Step18.</FONT> Provide the Maintenance Object: ID ‘ZVCL_SPRO_MAINTAIN’ and Name ‘Maintaining View Cluster Integration’.</SPAN><SPAN> </SPAN></P><P><SPAN>Under the assigned Object section, provide View Cluster name ‘ZVC_FLIGHT_DEMO’ as Customizing Object, Select Type As ‘C’, and Transaction as SM34. Save it and Go Back.</SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_5-1737094681580.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213319i722D2D1A71549716/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_5-1737094681580.png" alt="KhanMuskan_5-1737094681580.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step</SPAN><SPAN class="">19</SPAN></FONT><SPAN class=""><FONT size="4">.</FONT> The Node appears under the structure “Product Compliance” as follows. Click on the highlighted part in red color to test it.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_6-1737094708705.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213320iDBB290D17D524AE2/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_6-1737094708705.png" alt="KhanMuskan_6-1737094708705.png" /></span></P><P><FONT size="4"><SPAN class="">Step20. </SPAN></FONT><SPAN class="">Provide the input as </SPAN><SPAN class="">AA (</SPAN><SPAN class="">Airline number) and click on Continue.</SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_7-1737094735095.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213321iDF1CBA6A3F0A5B47/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_7-1737094735095.png" alt="KhanMuskan_7-1737094735095.png" /></span></P><P><SPAN class=""><SPAN class=""><FONT size="4">Step21.</FONT> </SPAN><SPAN class="">Provide the connection number and click on Continue.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_8-1737094758229.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213322iBE9913A39F78BBB4/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_8-1737094758229.png" alt="KhanMuskan_8-1737094758229.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step22.</SPAN> </FONT><SPAN class="">Click on the new entries tab.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_9-1737094781635.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213323i848B185E925AF161/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_9-1737094781635.png" alt="KhanMuskan_9-1737094781635.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step23.</SPAN></FONT> <SPAN class="">Provide some entry and click on Save.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_10-1737094806843.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213324i7C25E8CCD9A55D13/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_10-1737094806843.png" alt="KhanMuskan_10-1737094806843.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step24. </SPAN></FONT><SPAN class="">Go back and click on Save.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_11-1737094833042.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213325iB9524379E33E6789/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_11-1737094833042.png" alt="KhanMuskan_11-1737094833042.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step</SPAN><SPAN class="">25</SPAN></FONT><SPAN class=""><FONT size="4">.</FONT> To check if Node is created successfully, go to SPRO transaction</SPAN></SPAN><SPAN class=""><SPAN class=""> and</SPAN><SPAN class=""> Click on SAP reference IMG.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_12-1737094858209.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213326iAB77EC096578A18A/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_12-1737094858209.png" alt="KhanMuskan_12-1737094858209.png" /></span></P><P><SPAN class=""><FONT size="4"><SPAN class="">Step</SPAN><SPAN class="">26</SPAN><SPAN class="">. </SPAN></FONT><SPAN class="">Expand</SPAN> <SPAN class="">the</SPAN> <SPAN class="">‘</SPAN><SPAN class="">Product Compliance’</SPAN><SPAN class=""> Node and the created object appears here. <SPAN class=""><SPAN class="">Execute it</SPAN><SPAN class=""> to </SPAN><SPAN class="">maintain</SPAN><SPAN class=""> the data.</SPAN></SPAN></SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KhanMuskan_13-1737094888064.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213327iA4D932F09F3DDFA6/image-size/large?v=v2&px=999" role="button" title="KhanMuskan_13-1737094888064.png" alt="KhanMuskan_13-1737094888064.png" /></span></P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P><SPAN class=""> </SPAN></P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P>2025-01-17T15:28:34.468000+01:00https://community.sap.com/t5/application-development-blog-posts/file-handling-in-rap-unmanaged/ba-p/13988554File Handling In RAP ( Unmanaged )2025-01-17T15:28:55.820000+01:00sanjay22https://community.sap.com/t5/user/viewprofilepage/user-id/1535416<P><SPAN class=""><SPAN class="">File uploads let you add file handling functionality to your applications inside the framework of SAP's Rapid Application Programming (RAP) </SPAN><SPAN class="">methodology</SPAN><SPAN class="">. This gives customers the ability to upload a variety of file formats, including photos, Excel spreadsheets, PDFs, and more.</SPAN></SPAN></P><P><SPAN class=""><SPAN class="">SAP's Rapid Application Programming (RAP) architecture allows you to integrate file handling functionality into your applications through file uploads. Users can now upload a variety of file kinds, including PDFs, Excel spreadsheets, photos, and more.</SPAN></SPAN></P><P><SPAN class=""><SPAN class=""><SPAN class=""><SPAN class="">OData streams are now supported by the RAP framework thanks to the most recent release of SAP BTP ABAP 2208. You may now make your RAP application capable of handling and </SPAN><SPAN class="">maintaining</SPAN><SPAN class=""> Large Objects (LOBs</SPAN><SPAN class="">).This</SPAN><SPAN class=""> feature enables media handling by giving end users the ability to upload external files in a variety of file formats, including PDF, XLSX, binary, and others.</SPAN></SPAN></SPAN></SPAN></P><P><SPAN class=""><SPAN class=""><SPAN class=""><SPAN class=""><SPAN class=""><SPAN class="">In this Blog we will explore how to upload and handle Large Object such as PDF or Binary files without the need to extend the RAP application in BAS.</SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></P><P><SPAN class=""><SPAN class=""><SPAN class=""><SPAN class=""><SPAN class=""><SPAN class=""><SPAN class="">Large objects are </SPAN><SPAN class="">modelled</SPAN> <SPAN class="">by means of</SPAN><SPAN class=""> the following fields: </SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></P><UL><LI><SPAN>Attachment </SPAN><SPAN> </SPAN></LI></UL><UL><LI><SPAN>Mime type </SPAN><SPAN> </SPAN></LI></UL><UL><LI><SPAN>Filename</SPAN><SPAN> </SPAN></LI></UL><P><SPAN><SPAN class="">The field Attachment </SPAN><SPAN class="">contains</SPAN><SPAN class=""> the LOB itself in a RAWSTRING format and is technically bound to the field Mime type and Filename using semantics annotation.</SPAN></SPAN></P><P><SPAN><SPAN class=""><SPAN class="">Mime type </SPAN><SPAN class="">represents</SPAN><SPAN class=""> the content type of the attachment uploaded and the values for the fields Mime type and Filename are derived from the field Attachment by the RAP framework based on the maintained CDS annotations. No attachment can exist without its mime type and vice versa.</SPAN></SPAN></SPAN></P><P><SPAN><SPAN class=""><SPAN class=""><SPAN class=""><SPAN class="">For example, when a TEXT file is uploaded the Mime type field will be derived and populated with ‘APPLICATION/txt’.</SPAN></SPAN></SPAN></SPAN></SPAN></P><P><SPAN><SPAN class=""><SPAN class=""><SPAN class=""><SPAN class=""><SPAN class="">Step </SPAN><SPAN class="">1 :</SPAN> <SPAN class="">Create the data element of raw string Datatype for the field that stores the file attachment in the Table.</SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_1-1737095963931.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213334iF224C97528C05AE7/image-size/large?v=v2&px=999" role="button" title="sanjay22_1-1737095963931.png" alt="sanjay22_1-1737095963931.png" /></span></P><P><SPAN class=""><SPAN class="">Step </SPAN><SPAN class="">2 </SPAN><SPAN class="">:</SPAN><SPAN class=""> Creati</SPAN><SPAN class="">ng the Database table using below fields.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_2-1737096033031.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213335iD65CDC01F457D080/image-size/large?v=v2&px=999" role="button" title="sanjay22_2-1737096033031.png" alt="sanjay22_2-1737096033031.png" /></span></P><P><SPAN class=""><SPAN class="">Step </SPAN><SPAN class="">3</SPAN><SPAN class=""> :</SPAN> </SPAN><SPAN class=""><SPAN class="">Create the Interface view on Above Database table.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_3-1737096079836.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213336i05104752704EF7E5/image-size/large?v=v2&px=999" role="button" title="sanjay22_3-1737096079836.png" alt="sanjay22_3-1737096079836.png" /></span></P><UL><LI><SPAN>@Semantics.mimeType:</SPAN> <SPAN>true</SPAN><SPAN> => Use the above annotations to Handle the field as Mime Type by Internal Framework and to store the attached file which is usually large data.</SPAN></LI></UL><UL><LI><SPAN> </SPAN><SPAN>@Semantics.largeObject</SPAN> <SPAN>:</SPAN> <SPAN>{</SPAN> <SPAN>mime Type:</SPAN> <SPAN>'mime type',</SPAN> <SPAN>file Name:</SPAN> <SPAN>'filename',</SPAN><SPAN> </SPAN>content Disposition Preference: <SPAN>#ATTACHMENT</SPAN> <SPAN>}</SPAN><SPAN> => In this annotations we have to pass the mime type field name and the field which stores the file name.</SPAN></LI></UL><P><SPAN><SPAN class=""><SPAN class="">Step </SPAN><SPAN class="">4</SPAN><SPAN class=""> :</SPAN><SPAN class=""> Create the </SPAN><SPAN class="">Projection View on Interface View.</SPAN></SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_0-1737096789935.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213341i9D39F2D891DD0245/image-size/large?v=v2&px=999" role="button" title="sanjay22_0-1737096789935.png" alt="sanjay22_0-1737096789935.png" /></span></P><P><SPAN class=""><SPAN class="">Step </SPAN><SPAN class="">5</SPAN><SPAN class=""> :</SPAN><SPAN class=""> Create the meta data extension for the created consumption view.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_1-1737097033139.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213344i28524E0FE13E49F2/image-size/large?v=v2&px=999" role="button" title="sanjay22_1-1737097033139.png" alt="sanjay22_1-1737097033139.png" /></span></P><P><SPAN class=""><SPAN class="">Step </SPAN><SPAN class="">6</SPAN><SPAN class=""> :</SPAN><SPAN class=""> create the behavior definition for </SPAN><SPAN class="">Interface View </SPAN><SPAN class="">and choose the Implementation type as </SPAN></SPAN><SPAN class=""><SPAN class="">Unmanaged</SPAN></SPAN><SPAN class=""><SPAN class="">. </SPAN></SPAN><SPAN class=""><SPAN class=""><SPAN class=""><SPAN class="">For Media handling it is mandatory to create the OData v4 and with Draft functionality.</SPAN></SPAN></SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_0-1737097882486.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213350i07229CE33F696DF2/image-size/large?v=v2&px=999" role="button" title="sanjay22_0-1737097882486.png" alt="sanjay22_0-1737097882486.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_1-1737098266763.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213352i1B25F9F76A399AD6/image-size/large?v=v2&px=999" role="button" title="sanjay22_1-1737098266763.png" alt="sanjay22_1-1737098266763.png" /></span> </P><P><SPAN class="">Draft table for </SPAN><SPAN class="">the persistent Table.</SPAN></P><P><SPAN class=""><SPAN class="">Step </SPAN><SPAN class="">7 :</SPAN><SPAN class=""> Create the Implementation class for the behavior definition</SPAN><SPAN class=""> for CRUD operation</SPAN><SPAN class="">.</SPAN></SPAN></P><P> </P><pre class="lia-code-sample language-abap"><code>CLASS lhc_zr_sm_t_file_hand DEFINITION INHERITING FROM cl_abap_behavior_handler.
PRIVATE SECTION.
METHODS get_instance_authorizations FOR INSTANCE AUTHORIZATION
IMPORTING keys REQUEST requested_authorizations FOR zr_sm_t_file_hand RESULT result.
METHODS create FOR MODIFY
IMPORTING entities FOR CREATE zr_sm_t_file_hand.
METHODS update FOR MODIFY
IMPORTING entities FOR UPDATE zr_sm_t_file_hand.
METHODS delete FOR MODIFY
IMPORTING keys FOR DELETE zr_sm_t_file_hand.
METHODS read FOR READ
IMPORTING keys FOR READ zr_sm_t_file_hand RESULT result.
METHODS lock FOR LOCK
IMPORTING keys FOR LOCK zr_sm_t_file_hand.
ENDCLASS.
CLASS lhc_zr_sm_t_file_hand IMPLEMENTATION.
METHOD get_instance_authorizations.
ENDMETHOD.
METHOD create.
zcl_sm_unmanaged_crud=>get_instance( )->create(
EXPORTING
entities = entities
CHANGING
mapped = mapped
failed = failed
reported = reported
).
ENDMETHOD.
METHOD update.
zcl_sm_unmanaged_crud=>get_instance( )->update(
EXPORTING
entities = entities
CHANGING
mapped = mapped
failed = failed
reported = reported
).
ENDMETHOD.
METHOD delete.
CALL METHOD zcl_sm_unmanaged_crud=>get_instance( )->delete(
EXPORTING
keys = keys
CHANGING
mapped = mapped
failed = failed
reported = reported
).
ENDMETHOD.
METHOD read.
zcl_sm_unmanaged_crud=>get_instance( )->read(
EXPORTING
keys = keys
CHANGING
result = result
failed = failed
reported = reported
).
ENDMETHOD.
METHOD lock.
ENDMETHOD.
ENDCLASS.
CLASS lsc_ZR_SM_T_FILE_HAND DEFINITION INHERITING FROM cl_abap_behavior_saver.
PROTECTED SECTION.
METHODS finalize REDEFINITION.
METHODS check_before_save REDEFINITION.
METHODS save REDEFINITION.
METHODS cleanup REDEFINITION.
METHODS cleanup_finalize REDEFINITION.
ENDCLASS.
CLASS lsc_ZR_SM_T_FILE_HAND IMPLEMENTATION.
METHOD finalize.
ENDMETHOD.
METHOD check_before_save.
ENDMETHOD.
METHOD save.
zcl_sm_unmanaged_crud=>get_instance( )->save_data(
CHANGING
reported = reported
).
ENDMETHOD.
METHOD cleanup.
ENDMETHOD.
METHOD cleanup_finalize.
ENDMETHOD.
ENDCLASS.</code></pre><P> </P><P> </P><P><SPAN class=""><SPAN class="">Step </SPAN><SPAN class="">8 :</SPAN><SPAN class=""> Create the API class for the Implementation class.</SPAN></SPAN></P><P> </P><pre class="lia-code-sample language-abap"><code>CLASS zcl_sm_unmanaged_crud DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
TYPES: tt_std_create TYPE TABLE FOR CREATE zr_sm_t_file_hand,
tt_std_update TYPE TABLE FOR UPDATE zr_sm_t_file_hand,
tt_mapped_early TYPE RESPONSE FOR MAPPED EARLY zr_sm_t_file_hand,
tt_failed_early TYPE RESPONSE FOR FAILED EARLY zr_sm_t_file_hand,
tt_reported_early TYPE RESPONSE FOR REPORTED EARLY zr_sm_t_file_hand,
tt_mapped_late TYPE RESPONSE FOR MAPPED LATE zr_sm_t_file_hand,
tt_reported_late TYPE RESPONSE FOR REPORTED LATE zr_sm_t_file_hand,
tt_keys_read TYPE TABLE FOR READ IMPORT zr_sm_t_file_hand,
tt_keys_delete TYPE TABLE FOR DELETE zr_sm_t_file_hand,
tt_read_result TYPE TABLE FOR READ RESULT zr_sm_t_file_hand.
CLASS-METHODS get_instance RETURNING VALUE(ret_student) TYPE REF TO zcl_sm_unmanaged_crud.
METHODS: create IMPORTING entities TYPE tt_std_create
CHANGING mapped TYPE tt_mapped_early
failed TYPE tt_failed_early
reported TYPE tt_reported_early,
read IMPORTING keys TYPE tt_keys_read
CHANGING result TYPE tt_read_result
failed TYPE tt_failed_early
reported TYPE tt_reported_early,
update IMPORTING entities TYPE tt_std_update
CHANGING mapped TYPE tt_mapped_early
failed TYPE tt_failed_early
reported TYPE tt_reported_early,
delete IMPORTING keys TYPE tt_keys_delete
CHANGING mapped TYPE tt_mapped_early
failed TYPE tt_failed_early
reported TYPE tt_reported_early,
save_data CHANGING reported TYPE tt_reported_late.
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-DATA: go_instance TYPE REF TO zcl_sm_unmanaged_crud,
gt_create TYPE TABLE OF zsm_t_file_hand,
gt_update TYPE TABLE OF zsm_t_file_hand,
gr_delete TYPE RANGE OF zr_sm_t_file_hand-DocumentId,
gs_file TYPE zsm_t_file_hand.
ENDCLASS.
CLASS zcl_sm_unmanaged_crud IMPLEMENTATION.
METHOD get_instance.
ret_student = COND #( WHEN go_instance IS BOUND THEN go_instance
ELSE NEW #( ) ).
ENDMETHOD.
METHOD create.
gt_create = CORRESPONDING #( entities MAPPING FROM ENTITY ).
LOOP AT entities ASSIGNING FIELD-SYMBOL(<lfs_entities>).
IF gt_create IS NOT INITIAL.
gt_create[ 1 ]-client = sy-mandt.
gt_create[ 1 ]-last_changed_by = sy-uname.
GET TIME STAMP FIELD DATA(lv_timestamp).
gt_create[ 1 ]-last_changed_at = lv_timestamp.
mapped-zr_sm_t_file_hand = VALUE #( ( %cid = <lfs_entities>-%cid
%key = <lfs_entities>-%key
%is_draft = <lfs_entities>-%is_draft ) ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD save_data.
IF gt_create IS NOT INITIAL.
INSERT zsm_t_file_hand FROM TABLE _create.
CLEAR gt_create[].
ELSEIF gt_update IS NOT INITIAL.
UPDATE zsm_t_file_hand FROM TABLE _update.
CLEAR gt_update[].
ELSEIF gr_delete IS NOT INITIAL.
DELETE FROM zsm_t_file_hand WHERE document_id IN _delete.
CLEAR gr_delete[].
ENDIF.
ENDMETHOD.
METHOD update.
DATA : lt_update_x TYPE STANDARD TABLE OF zsm_ts_boolean,
lt_update TYPE STANDARD TABLE OF zsm_t_file_hand.
lt_update = CORRESPONDING #( entities MAPPING FROM ENTITY ).
lt_update_x = CORRESPONDING #( entities MAPPING FROM ENTITY USING CONTROL ).
IF lt_update IS NOT INITIAL.
*
SELECT * FROM zsm_t_file_hand FOR ALL ENTRIES IN _update
WHERE document_id = _update-document_id
INTO TABLE (lt_result_old).
ENDIF.
GET TIME STAMP FIELD DATA(lv_timestamp).
gt_update = VALUE #(
FOR x = 1 WHILE x LE lines( lt_update )
LET ls_control_flag = VALUE #( lt_update_x[ x ] OPTIONAL )
ls_new = VALUE #( lt_update[ x ] OPTIONAL )
ls_old = VALUE #( lt_result_old[ document_id = ls_new-document_id ] OPTIONAL )
IN
(
client = sy-mandt
document_id = COND #( WHEN ls_control_flag-document_id IS INITIAL
THEN ls_old-document_id )
filename = COND #( WHEN ls_control_flag-filename IS NOT INITIAL
THEN ls_new-filename ELSE ls_old-filename )
attachment = COND #( WHEN ls_control_flag-attachment IS NOT INITIAL
THEN ls_new-attachment ELSE ls_old-attachment )
mimetype = COND #( WHEN ls_control_flag-mimetype IS NOT INITIAL
THEN ls_new-mimetype ELSE ls_old-mimetype )
created_at = COND #( WHEN ls_control_flag-created_at IS INITIAL
THEN ls_old-created_at )
created_by = COND #( WHEN ls_control_flag-created_by IS INITIAL
THEN ls_old-created_by )
last_changed_at = COND #( WHEN ls_control_flag-last_changed_at IS INITIAL
THEN lv_timestamp )
last_changed_by = COND #( WHEN ls_control_flag-last_changed_by IS INITIAL
THEN sy-uname )
) ).
ENDMETHOD.
METHOD read.
SELECT * FROM zsm_t_file_hand FOR ALL ENTRIES IN
WHERE document_id = -DocumentId
INTO TABLE (lt_result).
result = CORRESPONDING #( lt_result MAPPING TO ENTITY ).
ENDMETHOD.
METHOD delete.
DATA: lt_delete TYPE STANDARD TABLE OF zsm_t_file_hand.
lt_delete = CORRESPONDING #( keys MAPPING FROM ENTITY ).
gr_delete = VALUE #(
FOR ls_delete IN lt_delete
sign = 'I' option = 'EQ' ( low = ls_delete-document_id )
).
ENDMETHOD.
ENDCLASS.</code></pre><P> </P><P> </P><P>Step 7 : create the behavior definition for the Projection View.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_0-1737098826915.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213356iDE6C43058D97EEF7/image-size/large?v=v2&px=999" role="button" title="sanjay22_0-1737098826915.png" alt="sanjay22_0-1737098826915.png" /></span></P><P><SPAN class=""><SPAN class="">Step </SPAN><SPAN class="">8</SPAN><SPAN class=""> :</SPAN><SPAN class=""> Create the Service definition</SPAN><SPAN class=""> for the consumption view.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_1-1737098906787.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213359i0EF4E3BFB4353FF2/image-size/large?v=v2&px=999" role="button" title="sanjay22_1-1737098906787.png" alt="sanjay22_1-1737098906787.png" /></span></P><P><SPAN class=""><SPAN class="">Step </SPAN><SPAN class="">9</SPAN><SPAN class=""> :</SPAN><SPAN class=""> Create the Service Binding for Created Service definition and Choose the Binding type as </SPAN></SPAN><SPAN class="">OData V</SPAN><SPAN class="">4</SPAN><SPAN class=""> ,</SPAN><SPAN class="">activate and publish the service</SPAN><SPAN class="">.</SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_2-1737098953938.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213360i6C2B89ED521FFD7B/image-size/large?v=v2&px=999" role="button" title="sanjay22_2-1737098953938.png" alt="sanjay22_2-1737098953938.png" /></span></P><P>Preview the Application and click on create to upload the file.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_0-1737099647005.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213364i361C2B1E2BAE7D63/image-size/large?v=v2&px=999" role="button" title="sanjay22_0-1737099647005.png" alt="sanjay22_0-1737099647005.png" /></span></P><P><SPAN class=""><SPAN class="">Click on upload icon near to the attachment field,</SPAN><SPAN class=""> select the file,</SPAN> <SPAN class="">file</SPAN><SPAN class=""> name will be auto filled </SPAN><SPAN class="">and</SPAN><SPAN class=""> fill the Mime type</SPAN><SPAN class=""> manually</SPAN><SPAN class="">.</SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_1-1737099684894.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213367i2EB65C040A21E06C/image-size/large?v=v2&px=999" role="button" title="sanjay22_1-1737099684894.png" alt="sanjay22_1-1737099684894.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_3-1737099810705.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213369i87EBE064560E4CD8/image-size/large?v=v2&px=999" role="button" title="sanjay22_3-1737099810705.png" alt="sanjay22_3-1737099810705.png" /></span></P><P> </P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sanjay22_4-1737099820369.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/213371iA6E04F65B64633E0/image-size/large?v=v2&px=999" role="button" title="sanjay22_4-1737099820369.png" alt="sanjay22_4-1737099820369.png" /></span></P><P> </P><P> </P>2025-01-17T15:28:55.820000+01:00https://community.sap.com/t5/technology-blogs-by-sap/unlock-your-future-prove-your-abap-cloud-readiness-today/ba-p/13990888Unlock Your Future: Prove Your ABAP Cloud Readiness Today!2025-01-20T13:34:03.019000+01:00Johannhttps://community.sap.com/t5/user/viewprofilepage/user-id/137238<P>In the fast-evolving tech landscape, staying ahead means embracing the future. And in the world of ABAP development, that future is ABAP Cloud.</P><P><STRONG>What is ABAP Cloud?</STRONG></P><P>ABAP Cloud is the cutting-edge evolution in ABAP development. It's your gateway to creating cloud-ready business applications, services, and extensions that stand the test of time. Imagine harnessing the power of Core Data Services (CDS) for seamless data modelling, the ABAP RESTful Application Programming Model (RAP) for streamlined service development, and a cloud-optimized ABAP language that makes your business logic soar.</P><P>This all-encompassing programming model caters to both the SAP Business Technology Platform and SAP S/4HANA, working harmoniously across public cloud, private cloud, and on-premise environments. It's not just the next step—it's the future.</P><P><STRONG>Get Certified and Stand Out</STRONG></P><P>Ready to showcase your ABAP Cloud expertise? The <A href="https://learning.sap.com/certifications/sap-certified-associate-back-end-developer-abap-cloud" target="_blank" rel="noopener noreferrer">SAP Certified Associate - Back-End Developer - ABAP Cloud</A> certification is your ticket to proving your prowess. But how do you prepare for this transformative exam?</P><P><STRONG>Explore Your Training Options</STRONG></P><P>Whether you're a fan of interactive classroom experiences or prefer the flexibility of e-learning, SAP has you covered.</P><P>If you appreciate the benefits of classroom training, you can prepare for the certification with the classroom training courses <A href="https://training.sap.com/course/s4d400" target="_blank" rel="noopener noreferrer">S4D400 (Basic ABAP Programming)</A>, <A href="https://training.sap.com/course/s4d401" target="_blank" rel="noopener noreferrer">S4D401 (Intermediate ABAP Programming)</A> and <A href="https://training.sap.com/course/s4d430" target="_blank" rel="noopener noreferrer">S4D430 (Data Modelling in ABAP Dictionary and ABAP Core Data Services)</A> - as shown in the curriculum map below. Building on <A href="https://training.sap.com/course/s4d430" target="_blank" rel="noopener noreferrer">S4D430</A>, the free e-learning <A href="https://learning.sap.com/learning-journeys/practicing-clean-core-extensibility-for-sap-s-4hana-cloud" target="_blank" rel="noopener noreferrer">Practicing Clean Core Extensibility for SAP S/4HANA Cloud</A> covers the remaining content required for the exam.</P><P><STRONG> </STRONG></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Johann_0-1737376246920.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/214402i099854EFF44F3D4E/image-size/medium?v=v2&px=400" role="button" title="Johann_0-1737376246920.png" alt="Johann_0-1737376246920.png" /></span></P><P> </P><P><BR /> </P><P><STRONG>In-Depth Knowledge:</STRONG> Even though the 5-day classroom training course <A href="https://training.sap.com/course/s4d437" target="_blank" rel="noopener noreferrer">S4D437 (Building Transactional Apps with the ABAP RESTful Application Programming Model)</A> - also shown in the curriculum map - isn't included in the exam, it's a goldmine for those serious about mastering the ABAP RESTful Application Programming Model. We highly recommend it!</P><P><STRONG>E-Learning Flexibility: </STRONG><STRONG>For those who prefer learning at their own pace, there are excellent alternatives. </STRONG>Instead of attending the classroom training courses <A href="https://training.sap.com/course/s4d400" target="_blank" rel="noopener noreferrer">S4D400</A>, <A href="https://training.sap.com/course/s4d401" target="_blank" rel="noopener noreferrer">S4D401</A> and <A href="https://training.sap.com/course/s4d430" target="_blank" rel="noopener noreferrer">S4D430</A>, you can alternatively work through the free e-learning <A href="https://learning.sap.com/learning-journeys/acquire-core-abap-skills" target="_blank" rel="noopener noreferrer">Acquiring Core ABAP Skills</A>. It covers the entirety of the three classroom training courses, allowing you to study whenever and wherever you want.<BR /><BR /><STRONG>Mix and Match Your Learning Path</STRONG></P><P>Flexibility is key. Combine classroom and e-learning approaches to fit your schedule and learning style. For example, attend <A href="https://training.sap.com/course/s4d400" target="_blank" rel="noopener noreferrer">S4D400</A> in person, then switch to the e-learning <A href="https://learning.sap.com/learning-journeys/acquire-core-abap-skills" target="_blank" rel="noopener noreferrer">Acquiring Core ABAP Skills</A> to cover the content of <A href="https://training.sap.com/course/s4d401" target="_blank" rel="noopener noreferrer">S4D401</A> and <A href="https://training.sap.com/course/s4d430" target="_blank" rel="noopener noreferrer">S4D430</A> — it's entirely your call. The e-learning content is carefully designed to mirror classroom training, so you won't miss a beat.</P><P><STRONG>Your Path, Your Future</STRONG></P><P>Chart your own course to ABAP Cloud certification. Take control of your learning journey, prove your skills, and unlock unparalleled opportunities in the tech world.</P><P>Ready to embark on this exciting journey? Your future in ABAP Cloud awaits!</P><P>This article has been created by Christoph Knecht</P>2025-01-20T13:34:03.019000+01:00https://community.sap.com/t5/application-development-blog-posts/sending-multiple-documents-via-email/ba-p/13990423Sending Multiple Documents Via Email2025-01-21T19:02:43.392000+01:00Faizan_khan1https://community.sap.com/t5/user/viewprofilepage/user-id/1451076<P><FONT size="5"><STRONG><SPAN>Introduction:</SPAN></STRONG><SPAN> </SPAN></FONT></P><P><SPAN>Sending a single attachment via email in SAP ABAP is straightforward, thanks to built-in functionality. However, sending multiple attachments is more complex, involving challenges like proper encoding, and maintaining the email structure. In this blog, we’ll explore the steps to overcome these complexities and successfully send multiple attachments in a single email. By the end, you’ll have a clear understanding of how to handle multiple files and ensure they’re correctly delivered.</SPAN></P><P><SPAN><FONT size="5"><STRONG><SPAN class=""><SPAN class="">Data </SPAN><SPAN class="">Declarations: </SPAN></SPAN></STRONG></FONT></SPAN></P><P> </P><pre class="lia-code-sample language-abap"><code>DATA: lo_send_request TYPE REF TO cl_bcs. "VALUE IS INITIAL.
CLASS cl_bcs DEFINITION LOAD.
DATA: lo_document TYPE REF TO cl_document_bcs . "VALUE IS INITIAL. "document object
DATA : it_text TYPE bcsy_text. "Table for body
DATA : wa_text LIKE LINE OF it_text. "work area for message body
DATA: lo_sender TYPE REF TO if_sender_bcs. "VALUE IS INITIAL. "sender
DATA: lo_recipient TYPE REF TO if_recipient_bcs." VALUE IS INITIAL. "recipi</code></pre><P> </P><UL><LI><STRONG><SPAN>Data declarations</SPAN></STRONG><SPAN> are made for various objects that will be used to send emails </SPAN><SPAN> </SPAN></LI><LI><SPAN>it_text is an internal table used for storing the body content of the email.</SPAN><SPAN> </SPAN></LI><LI><SPAN>lo_sender and lo_recipient will store the sender and recipient details for the email.</SPAN><SPAN> </SPAN></LI><LI><SPAN>Data related to attachments (it_mara, it_sflight) is declared to hold material data and flight data, which will later be attached to the email as files.</SPAN></LI></UL><P> </P><pre class="lia-code-sample language-abap"><code>
PARAMETERS p_mtart TYPE mara-mtart. "material type input
PARAMETERS p_CARRID TYPE Sflight-carrid. " Airline code input
PARAMETERS : p_email TYPE UNAME. "Email input
PARAMETERS: p_sub TYPE char50. "email subject
</code></pre><P> </P><P><SPAN>The selection screen gathers user input for:</SPAN><SPAN> </SPAN></P><UL><LI><SPAN>p_mtart</SPAN><SPAN>: Material type to filter the MARA table.</SPAN><SPAN> </SPAN></LI><LI><SPAN>p_carrid</SPAN><SPAN>: Airline code to filter the Sflight table.</SPAN><SPAN> </SPAN></LI><LI><SPAN>p_email</SPAN><SPAN>: Recipient's email address.</SPAN><SPAN> </SPAN></LI><LI><SPAN>p_sub</SPAN><SPAN>: Subject for the email.</SPAN><SPAN> </SPAN></LI></UL><P> </P><pre class="lia-code-sample language-abap"><code>DATA : it_mara TYPE TABLE OF mara,
wa_mara TYPE mara.
DATA : it_sflight TYPE TABLE OF Sflight,
wa_sflight TYPE Sflight.
</code></pre><P> </P><UL><LI><STRONG><SPAN>it_mara</SPAN></STRONG><SPAN>: This is an internal table (TABLE OF mara) that will hold multiple rows of material data fetched from the MARA table.</SPAN><SPAN> </SPAN></LI><LI><STRONG><SPAN>wa_mara</SPAN></STRONG><SPAN>: This is a work area (TYPE mara) used to temporarily store a single row of data from the MARA</SPAN><SPAN> </SPAN></LI><LI><STRONG><SPAN>it_sflight</SPAN></STRONG><SPAN>: This is an internal table (TABLE OF Sflight) that will store multiple rows of flight data fetched from the Sflight table.</SPAN><SPAN> </SPAN></LI><LI><STRONG><SPAN>wa_sflight</SPAN></STRONG><SPAN>: This is a work area (TYPE Sflight) used to temporarily hold a single row of flight</SPAN><SPAN> </SPAN></LI></UL><P> </P><pre class="lia-code-sample language-abap"><code>DATA : lv_string TYPE string,
lv_string_flight TYPE string,
lv_data_string TYPE string,
lv_data_string_flight TYPE string,
lv_xstring TYPE xstring,
lv_xstring_flight TYPE xstring. </code></pre><P> </P><UL><LI><STRONG><SPAN>l</SPAN></STRONG><STRONG><SPAN>v_string</SPAN></STRONG><SPAN>: A string variable used to store concatenated data related to material information during the loop over it_mara.</SPAN><SPAN> </SPAN></LI><LI><STRONG><SPAN>lv_string_flight</SPAN></STRONG><SPAN>: A string variable used to store concatenated data related to flight details during the loop over it_sflight.</SPAN><SPAN> </SPAN></LI></UL><UL><LI><STRONG><SPAN>lv_data_string</SPAN></STRONG><SPAN>: A string variable that accumulates all concatenated material data (from lv_string). This data will be used to create the email attachment for material information.</SPAN><SPAN> </SPAN></LI><LI><STRONG><SPAN>lv_data_string_flight</SPAN></STRONG><SPAN>: A string variable that accumulates all concatenated flight data (from lv_string_flight). This data will be used to create the email attachment for flight information. </SPAN><SPAN> </SPAN></LI><LI><STRONG><SPAN>lv_xstring</SPAN></STRONG><SPAN>: This variable is used to store the material data in binary format (XSTRING). The data stored in lv_data_string will be converted into lv_xstring before it is used as an email attachment.</SPAN><SPAN> </SPAN></LI><LI><STRONG><SPAN>lv_xstring_flight</SPAN></STRONG><SPAN>: Similar to lv_xstring, this variable stores the flight data in binary format (XSTRING). The data stored in lv_data_string_flight will be converted into lv_xstring_flight for the email attachment.</SPAN></LI></UL><P> </P><pre class="lia-code-sample language-abap"><code>DATA: lit_binary_content TYPE solix_tab,
lit_binary_content_flight TYPE solix_tab,
l_attsubject TYPE sood-objdes. </code></pre><P> </P><UL><LI><STRONG><SPAN>lit_binary_content</SPAN></STRONG><SPAN>: This is a table of type solix_tab, which will hold the binary content of the material data attachment after conversion from lv_xstring using SCMS_XSTRING_TO_BINARY.</SPAN><SPAN> </SPAN></LI><LI><STRONG><SPAN>lit_binary_content_flight</SPAN></STRONG><SPAN>: Similar to lit_binary_content, this table holds the binary content of the flight data attachment after conversion from lv_xstring_flight to binary format.</SPAN><SPAN> </SPAN></LI><LI><STRONG><SPAN>l_attsubject</SPAN></STRONG><SPAN>: This variable holds the subject or name for the email attachment. It is typically used to give a descriptive name to the file being attached to the email</SPAN><SPAN> </SPAN></LI></UL><P><SPAN><FONT size="5"><STRONG><SPAN class=""><SPAN class="">Creating Email Object (</SPAN><SPAN class="">lo_send_request)</SPAN></SPAN></STRONG></FONT></SPAN></P><P> </P><pre class="lia-code-sample language-abap"><code>lo_send_request = cl_bcs=>create_persistent( ). </code></pre><P> </P><P><SPAN class=""><SPAN class="">This line creates a persistent email object using the class </SPAN><SPAN class="">cl_bcs</SPAN><SPAN class="">. The </SPAN><SPAN class="">create_persistent</SPAN><SPAN class=""> method initializes the object that will be used to send the email.</SPAN></SPAN><SPAN class=""> </SPAN></P><P><FONT size="5"><STRONG><SPAN class=""><SPAN class=""><SPAN class="">Message Body </SPAN><SPAN class="">Creation :</SPAN></SPAN></SPAN></STRONG></FONT></P><P> </P><pre class="lia-code-sample language-abap"><code>wa_text-line = '<HTML><BODY>'.
APPEND wa_text TO it_text.
wa_text-line = 'Dear Recepient,'.
APPEND wa_text TO it_text.
wa_text-line = '<br></br>'.
APPEND wa_text TO it_text.
wa_text-line = 'Please find the Flight Details And Material Data as requested in the attachment.'.
APPEND wa_text TO it_text.
wa_text-line = '<br></br>'.
APPEND wa_text TO it_text.
wa_text-line = 'Thanks & Regards , Sender'.
APPEND wa_text TO it_text.
wa_text-line = '</BODY></HTML>'.
APPEND wa_text TO it_text.
CLEAR wa_text.
</code></pre><P> </P><UL><LI><SPAN>This section creates the body content for the email in HTML format.</SPAN><SPAN> </SPAN></LI><LI><SPAN>The body text includes a greeting, an explanation of the attachments, and a closing message.</SPAN><SPAN> </SPAN></LI><LI><SPAN>The content is stored in the it_text internal table, which will later be used as the </SPAN><SPAN>email body.</SPAN><SPAN> </SPAN></LI></UL><P><FONT size="5"><STRONG><SPAN class=""><SPAN class="">Create Document for Email:</SPAN></SPAN><SPAN class=""> </SPAN></STRONG></FONT></P><P> </P><pre class="lia-code-sample language-abap"><code>lo_document = cl_document_bcs=>create_document(
EXPORTING "create document
i_type = 'HTM' "Type of document HTM, TXT etc
i_text = it_text "email body internal table
i_subject = p_sub ). "email subject here p_sub input parameter
* Pass the document to send request
lo_send_request->set_document( lo_document ). </code></pre><P> </P><P><SPAN class=""><SPAN class="">This block creates a document object for the email using </SPAN><SPAN class="">cl_document_bcs</SPAN><SPAN class="">. It specifies that the document type is HTML (</SPAN><SPAN class="">i_type</SPAN><SPAN class=""> = 'HTM'</SPAN><SPAN class="">), assigns the email body (</SPAN><SPAN class="">i_text</SPAN><SPAN class=""> = </SPAN><SPAN class="">it_text</SPAN><SPAN class="">), and sets the email subject (</SPAN><SPAN class="">i_subject</SPAN><SPAN class=""> = </SPAN><SPAN class="">p_sub</SPAN><SPAN class="">).</SPAN></SPAN><SPAN class=""> </SPAN></P><P><SPAN class=""><FONT size="5"><STRONG><SPAN class=""><SPAN class="">Attach Material Data (from MARA table):</SPAN></SPAN></STRONG></FONT><SPAN class=""> </SPAN></SPAN></P><P> </P><pre class="lia-code-sample language-abap"><code>SELECT * FROM mara INTO TABLE it_mara UP TO 100 ROWS
WHERE mtart = p_mtart.
LOOP AT it_mara INTO wa_mara.
CONCATENATE wa_mara-matnr wa_mara-mtart wa_mara-meins wa_mara-mbrsh wa_mara-matkl INTO lv_string SEPARATED BY
cl_abap_char_utilities=>horizontal_tab.
CONCATENATE lv_data_string lv_string INTO lv_data_string SEPARATED BY cl_abap_char_utilities=>newline.
ENDLOOP. </code></pre><P> </P><UL><LI><SPAN>The SELECT query retrieves material data from the MARA table based on the material type (p_mtart).</SPAN><SPAN> </SPAN></LI><LI><SPAN>It then loops through the retrieved data and concatenates relevant fields (material number, type, unit, etc.) into a string lv_string. The string is then added to lv_data_string, which will be used as the attachment content.</SPAN><SPAN> </SPAN></LI></UL><P><SPAN><FONT size="5"><STRONG><SPAN class=""><SPAN class="">Convert String to XSTRING and Binary:</SPAN></SPAN></STRONG></FONT><SPAN class=""> </SPAN></SPAN></P><P> </P><pre class="lia-code-sample language-abap"><code>CALL FUNCTION 'HR_KR_STRING_TO_XSTRING'
EXPORTING
unicode_string = lv_data_string
* OUT_LEN =
IMPORTING
xstring_stream = lv_xstring
EXCEPTIONS
invalid_codepage = 1
invalid_string = 2
OTHERS = 3.
IF sy-subrc <> 0.
IF sy-subrc = 1 .
ELSEIF sy-subrc = 2 .
WRITE:/ 'invalid string ' .
ENDIF.
ENDIF. </code></pre><P> </P><UL><LI><SPAN>The function HR_KR_STRING_TO_XSTRING is called to convert the string lv_data_string into an xstring (binary format).</SPAN><SPAN> </SPAN></LI><LI><SPAN>The result is stored in lv_xstring.</SPAN><SPAN> </SPAN></LI></UL><P> </P><pre class="lia-code-sample language-abap"><code>CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_xstring
TABLES
binary_tab = lit_binary_content. </code></pre><P> </P><P><SPAN class=""><SPAN class="">The function </SPAN><SPAN class="">SCMS_XSTRING_TO_BINARY</SPAN><SPAN class=""> is used to convert the </SPAN><SPAN class="">xstring</SPAN><SPAN class=""> (</SPAN><SPAN class="">lv_xstring</SPAN><SPAN class="">) into binary content (</SPAN><SPAN class="">lit_binary_content</SPAN><SPAN class="">), which can be used as an attachment.</SPAN></SPAN><SPAN class=""> </SPAN></P><P><FONT size="5"><STRONG><SPAN class=""><SPAN class=""><SPAN class="">Add Attachment to Email:</SPAN></SPAN><SPAN class=""> </SPAN></SPAN></STRONG></FONT></P><P> </P><pre class="lia-code-sample language-abap"><code>add attachment
CLEAR l_attsubject .
CONCATENATE 'MaterialData_Excel' sy-datum INTO l_attsubject.
* Create Attachment
TRY.
lo_document->add_attachment( EXPORTING
i_attachment_type = 'XLS'
i_attachment_subject = l_attsubject
i_att_content_hex = lit_binary_content ).
CATCH cx_document_bcs INTO DATA(lx_document_bcs).
ENDTRY. </code></pre><P> </P><UL><LI><SPAN>A new subject for the attachment is created (l_attsubject).</SPAN><SPAN> </SPAN></LI><LI><SPAN>The add_attachment method is used to attach the material data (lit_binary_content) as an Excel file (i_attachment_type = 'XLS') to the email.</SPAN><SPAN> </SPAN></LI></UL><P><FONT size="5"><STRONG><SPAN class=""><SPAN class="">Set Sender for the Email:</SPAN></SPAN></STRONG></FONT></P><P> </P><pre class="lia-code-sample language-abap"><code>TRY.
lo_sender = cl_sapuser_bcs=>create( sy-uname ). "sender is the logged in user
* Set sender to send request
lo_send_request->set_sender(
EXPORTING
i_sender = lo_sender ).
ENDTRY. </code></pre><P> </P><UL><LI><SPAN>The cl_sapuser_bcs=>create method creates the sender object using the logged-in user (sy-uname).</SPAN><SPAN> </SPAN></LI><LI><SPAN>The set_sender method is used to associate the sender with the email.</SPAN><SPAN> </SPAN></LI></UL><P><FONT size="5"><STRONG><SPAN class=""><SPAN class="">Attach Flight Data (from </SPAN><SPAN class="">Sflight</SPAN><SPAN class=""> table):</SPAN></SPAN><SPAN class=""> </SPAN></STRONG></FONT></P><P> </P><pre class="lia-code-sample language-abap"><code>SELECT * FROM sflight INTO TABLE it_sflight UP TO 100 ROWS
WHERE carrid = p_carrid.
LOOP AT it_sflight INTO wa_sflight.
CONCATENATE wa_sflight-carrid wa_sflight-connid wa_sflight-currency wa_sflight-fldate wa_sflight-planetype INTO lv_string_flight SEPARATED BY
cl_abap_char_utilities=>horizontal_tab.
CONCATENATE lv_data_string_flight lv_string_flight INTO lv_data_string_flight SEPARATED BY cl_abap_char_utilities=>newline.
ENDLOOP. </code></pre><P> </P><UL><LI><SPAN>Similar to the material data section, this block retrieves flight data from the Sflight table based on the airline code (p_carrid).</SPAN><SPAN> </SPAN></LI><LI><SPAN>The relevant flight details are concatenated into a string and stored in lv_data_string_flight.</SPAN><SPAN> </SPAN></LI></UL><P><FONT size="5"><STRONG><SPAN class=""><SPAN class="">Convert Flight Data to XSTRING and Binary:</SPAN></SPAN><SPAN class=""> </SPAN></STRONG></FONT></P><P> </P><pre class="lia-code-sample language-abap"><code>CALL FUNCTION 'HR_KR_STRING_TO_XSTRING'
EXPORTING
* codepage_to = '8300'
unicode_string = lv_data_string_flight
* OUT_LEN =
IMPORTING
xstring_stream = lv_xstring_flight
EXCEPTIONS
invalid_codepage = 1
invalid_string = 2
OTHERS = 3.
IF sy-subrc <> 0.
IF sy-subrc = 1 .
ELSEIF sy-subrc = 2 .
WRITE:/ 'invalid string ' .
ENDIF.
ENDIF.
***Xstring to binary
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_xstring_flight
TABLES
binary_tab = lit_binary_content_flight. </code></pre><P> </P><P><SPAN class=""><SPAN class="">This process is identical to </SPAN><SPAN class="">the material</SPAN><SPAN class=""> data conversion. The same functions (</SPAN><SPAN class="">HR_KR_STRING_TO_XSTRING</SPAN><SPAN class=""> and </SPAN><SPAN class="">SCMS_XSTRING_TO_BINARY</SPAN><SPAN class="">) are used to convert the flight data into binary format.</SPAN></SPAN><SPAN class=""> </SPAN></P><P><FONT size="5"><STRONG><SPAN class=""><SPAN class=""><SPAN class="">Add Flight Data Attachment:</SPAN></SPAN><SPAN class=""> </SPAN></SPAN></STRONG></FONT></P><P> </P><pre class="lia-code-sample language-abap"><code>*add attachment
CLEAR l_attsubject .
CONCATENATE 'Flight_data' sy-datum INTO l_attsubject.
* Create Attachment
TRY.
lo_document->add_attachment( EXPORTING
i_attachment_type = 'XLS'
i_attachment_subject = l_attsubject
i_att_content_hex = lit_binary_content_flight ).
CATCH cx_document_bcs INTO DATA(lx_document_bcs_flight).
ENDTRY. </code></pre><P> </P><UL><LI><SPAN>A new subject for the attachment is created (l_attsubject).</SPAN><SPAN> </SPAN></LI><LI><SPAN>The add_attachment method is used to attach the material data (lit_binary_content) as an Excel file (i_attachment_type = 'XLS') to the email</SPAN></LI></UL><P> </P><pre class="lia-code-sample language-abap"><code> TRY.
lo_sender = cl_sapuser_bcs=>create( sy-uname ). "sender is the logged in user
lo_send_request->set_sender(
EXPORTING
i_sender = lo_sender ).
ENDTRY.</code></pre><P> </P><P><SPAN class=""><SPAN class="">He</SPAN><SPAN class="">re </SPAN><SPAN class="">are defining</SPAN><SPAN class=""> the </SPAN><SPAN class="">sender</SPAN> <SPAN class="">name ,</SPAN><SPAN class=""> using SY-UNAME we </SPAN><SPAN class="">are defining</SPAN><SPAN class=""> that </SPAN><SPAN class="">the user who has logged </SPAN><SPAN class="">in he</SPAN><SPAN class=""> is </SPAN><SPAN class="">sender .</SPAN></SPAN><SPAN class=""> </SPAN></P><P><SPAN class=""><FONT size="5"><STRONG><SPAN class=""><SPAN class="">Set Recipient for the Email:</SPAN></SPAN></STRONG></FONT><SPAN class=""> </SPAN></SPAN></P><P> </P><pre class="lia-code-sample language-abap"><code>DATA(lo_bcs) = cl_bcs=>create_persistent( ).
DATA(lo_user) = cl_sapuser_bcs=>create( i_user = 'HANAUSER15').
lo_bcs->add_recipient( EXPORTING i_recipient = lo_user ).
TRY.
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_user
i_express = 'X' ).
ENDTRY. </code></pre><P> </P><P><SPAN class=""><SPAN class="">A recipient is added to the email using </SPAN><SPAN class="">cl_sapuser_bcs</SPAN><SPAN class="">. Here, the recipient is hardcoded as </SPAN><SPAN class="">HANAUSER15</SPAN><SPAN class="">, but it can be replaced with </SPAN><SPAN class="">p_email</SPAN><SPAN class=""> (email parameter) for dynamic recipient </SPAN><SPAN class="">selection</SPAN><SPAN class="">.</SPAN></SPAN><SPAN class=""> </SPAN></P><P><SPAN class=""><FONT size="5"><STRONG><SPAN class=""><SPAN class="">Send the Email</SPAN><SPAN class="">:</SPAN></SPAN></STRONG></FONT><SPAN class=""> </SPAN></SPAN></P><P> </P><pre class="lia-code-sample language-abap"><code>TRY.
CALL METHOD lo_send_request->set_send_immediately
EXPORTING
i_send_immediately = p_send. "here selection screen input p_send
ENDTRY.
TRY.
** Send email
lo_send_request->send(
EXPORTING
i_with_error_screen = 'X' ).
COMMIT WORK.
IF sy-subrc = 0. "mail sent successfully
WRITE 'Mail sent successfully'.
ENDIF.
ENDTRY. </code></pre><P> </P><UL><LI><SPAN>The send method is called to send the email with all attachments and content.</SPAN><SPAN> </SPAN></LI><LI><SPAN>The COMMIT WORK ensures that the changes are committed to the database.</SPAN><SPAN> </SPAN></LI><LI><SPAN>A success message is displayed if the email is sent successfully.</SPAN><SPAN> </SPAN></LI></UL><P> </P><P><SPAN><SPAN class=""><SPAN class="">After activating and executing the code we can see the input screen </SPAN></SPAN></SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Faizan_khan1_0-1737354728921.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/214214iFBF4A828D365D0C0/image-size/large?v=v2&px=999" role="button" title="Faizan_khan1_0-1737354728921.png" alt="Faizan_khan1_0-1737354728921.png" /></span></P><P><SPAN class=""><SPAN class="">After executing </SPAN></SPAN><SPAN class=""> </SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Faizan_khan1_1-1737354868500.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/214215iA5A19BC7539E8A5C/image-size/large?v=v2&px=999" role="button" title="Faizan_khan1_1-1737354868500.png" alt="Faizan_khan1_1-1737354868500.png" /></span><SPAN> </SPAN></P><P><SPAN>After executing this we can see the mail in T-CODE </SPAN><STRONG><SPAN>SBWP </SPAN></STRONG><SPAN> </SPAN></P><P><SPAN>Once we open </SPAN><STRONG><SPAN>SBWP </SPAN></STRONG><SPAN>t-code () we will get a pop up notification</SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Faizan_khan1_2-1737354907422.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/214216i44DCAFCE879040AF/image-size/large?v=v2&px=999" role="button" title="Faizan_khan1_2-1737354907422.png" alt="Faizan_khan1_2-1737354907422.png" /></span></P><P><SPAN class=""><SPAN class="">In the inbox we can see the mails that we have </SPAN><SPAN class="">received</SPAN> </SPAN><SPAN class=""> </SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Faizan_khan1_3-1737354956518.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/214217i434FD2FE39300073/image-size/large?v=v2&px=999" role="button" title="Faizan_khan1_3-1737354956518.png" alt="Faizan_khan1_3-1737354956518.png" /></span></P><P><SPAN class=""><SPAN class="">When we open the </SPAN><SPAN class="">Mail</SPAN><SPAN class=""> we can see that we have 2 attachments with the E-MAIL </SPAN></SPAN><SPAN class=""> </SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Faizan_khan1_0-1737355044006.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/214218i11914965E92560ED/image-size/large?v=v2&px=999" role="button" title="Faizan_khan1_0-1737355044006.png" alt="Faizan_khan1_0-1737355044006.png" /></span></P>2025-01-21T19:02:43.392000+01:00https://community.sap.com/t5/technology-blogs-by-sap/the-2025-sap-developer-survey-is-live-contribute-now/ba-p/13993753The 2025 SAP Developer Survey is Live - Contribute Now2025-01-23T03:52:59.925000+01:00rileyraineyhttps://community.sap.com/t5/user/viewprofilepage/user-id/8919<P><FONT size="4"><SPAN><STRONG>Attention SAP Developers!<BR /></STRONG><BR /><EM>The 2025 SAP Developer Insights Survey starts today and will be running through the first week in March. It will take about twelve minutes of your time to complete.</EM></SPAN></FONT></P><P><FONT size="4"><SPAN>2025 marks the sixth consecutive year for this survey. </SPAN><STRONG>If you design, develop, or test software for SAP applications, platforms, or data: we have questions for you.</STRONG></FONT></P><H3 id="toc-hId-1209375491"><FONT size="4"><A href="https://sapinsights.eu.qualtrics.com/jfe/form/SV_6AxTBFzfczfuoJg" target="_self" rel="nofollow noreferrer noopener"><STRONG>Take the 2025 SAP Developer Survey now</STRONG></A></FONT></H3><P><FONT size="4">As always, the survey data in anonymous. The information we gather is important to us. It is a key resource we use to understand who you are and what you do. These data play an important role in shaping channels, programs, and to focus new content on your needs.</FONT><BR /><BR /><FONT size="4"><SPAN>We also publish the results back to you. If you are curious, have a look at the </SPAN><A href="https://community.sap.com/t5/technology-blogs-by-sap/the-2024-developer-insights-survey-the-report/ba-p/13686151" target="_blank">report describing last year’s survey results.</A></FONT><BR /><BR /><FONT size="4"><SPAN>The survey period begins today, January 23rd. It will continue for six weeks, ending around March 7th. Our report on this 2025 survey will be released a few weeks after that.</SPAN></FONT><BR /><BR /><FONT size="4"><SPAN>Help us help the SAP Community. Your contribution is important.</SPAN></FONT></P>2025-01-23T03:52:59.925000+01:00