Let's code ABAP | RESTful Application Programming Model (RAP) | CDS | Virtual Elements
HTML-код
- Опубликовано: 11 июл 2024
- In this video we build a SAP RUclips Tutorials App with ABAP and the ABAP RESTful Application Programming Model (RAP). You learn how to insert data into a table through an executable ABAP class and how to create all required artifacts to build a Business Service. We customize the UI with metadata extensions and we extend the projection view with a Virtual Element to display thumbnails.
Chapters in this video:
0:00 - Intro and Explanation
01:03 - Live Demo SAP RUclips Tutorials App
03:40 - Create Table in Dictionary
06:33 - Executable ABAP Class
07:19 - Insert data into table with ABAP
12:13 - Create CDS View Entity, Projection and Service
15:25 - Publish Business Service
16:00 - Adapt UI with Metadata Extensions
17:01 - Hide fields with Annotations
17:25 - Create clickable links
18:04 - Change field order of lineItems
21:39 - Create Virtual Element for Thumbnail Url
23:05 - Implement ABAP Class for Virtual Element Calculation
26:28 - Add thumbnails to listview
27:10 - Add thumbnail to header of object page
28:02 - Outro
Source Code of this SAP RUclips Tutorials App: www.blueantoinette.com/produc...
Related Videos:
- Extending SAP S/4HANA Cloud: • Extending SAP S/4HANA ...
- ABAP Environment in SAP BTP: • ABAP Environment in SA...
- Eclipse for ABAP Developers : • Eclipse for ABAP Devel...
About us:
- Homepage: www.blueantoinette.com/
- Contact us: www.blueantoinette.com/contac...
- Twitter: / blueantoinette_
- Consulting Hour: www.blueantoinette.com/produc...
Hashtags:
#abap #sap #rap - Наука
Thank you for the excellent series of videos!
I have noticed that most SAP RAP tutorials primarily focus on the "UI service," leaving a gap in coverage/documentation/examples for the "Web APIs" model.
This is particularly challenging when working with custom entities, as the APIs created are often not exact mirrors of a CDS.
In my opinion, while implementing a simple or even a complex read API in SAP RAP is relatively straightforward, creating or updating (POST/PUT/PATCH/...) is more complicated.
While there are restrictions in the SEGW methodology, they are not as extensive as those in RAP.
Thanks for your feedback and for sharing your findings here.
Very nice, thanks a lot.
Interesting with the thumbnails.
Is it possible to display the URL clickable in the object page (02:02 and 20:45)?
It is a pity that the SAP UUIDs are not real UUIDs. UUIDs should always be completely different so that it is not possible to infer other UUIDs from a known UUID. Unfortunately, ABAP only adds the value 2 in the fourth last byte. If I have the UUID of e.g. user 1, I can simply calculate the UUID of user 10. This is exactly what the UUID should prevent in comparison to the ID (integer). This is the case everywhere (JavaScript, PowerShell, Bash, C#, ...) but not in ABAP :-(
Regarding the clickable URLs at the object page you can try:
@UI.identification: [ {
position: 45,
type: #WITH_URL,
url: 'Url' -- Reference to element
} ]
Regarding the UUID issue you could try to reach out to SAP directly.
In my app it's not possible to click on the thumbnail in the object page to enlarge the picture. Any idea?
Did you add the headerinfo annotation as shown in this step? ruclips.net/video/BEbztssJlg8/видео.html
@@BlueAntoinette Yes, the Thumbnail was displayed in the object page. But it's not clickable.
@UI: {
headerInfo: {
title: {
type: #STANDARD,
value: 'Title'
},
imageUrl: 'Thumbnail'
}
I've tried it with 2 @UI.headerInfo... annotations too. Same result. Visible Thumbnail, no zoom possible.
Hm, I did nothing special to make it clickable. This worked out of the box in my case. Maybe it’s related to a different version of the framework on your hyperscaler, region or account.
@@BlueAntoinette We probably need to update our UI5 version on the S4 system. Elements will eventually become UI5 and if we have an old version, one or the other functionality will not be available.
Thanks for the quick reply anyway.
PS: Do you know how to implement an action that deletes a record? After deleting, I always get the object page with a 00000-0000-00000... entry (because the actual one is deleted). If I select >1 entries, I remain in the list view. Maybe you can make a short video if you have the solution. I couldn't find anything on the web.
PSPS: It is NOT the implementation of the DELETE functionality in an unmanaged scenario. I need an action with its own label (since the action was DELETED AND somewhere else was UPDATED, the label was "No Hit")
Regarding the delete issue, could you provide a reproducible sample? Hard for me to reproduce it otherwise.
Hello, do you have an idea how to filter on the calculated field within the view definition?
Example:
define root view entity xxxx
as projection on yyyyyy
{
key UUID,
@ObjectModel.virtualElementCalculatedBy: 'ABAP:ZCLASS_CALC'
virtual Testitest : abap.char( 10 )
} where Testitest = 'ABC'
This doesn't work because the column is unknown.
And if i try to filter within the class it raises a short dump because ct_calculated_data needs the same amount of entries as the it_original_data
Great question, maybe setting the filtering condition in @ObjectModel.filter.transformedBy: … helps
@@BlueAntoinette yeah i have tried that. But my problem is, that the calculated column is based on a function module and is not depending on any existing database column.
Well, if it is not depending on a database column, on what information does it get differentiated?
@@BlueAntoinette The calculation imports the values of three different columns to traverse a tree. Depending on different combinations a Boolean gets exported and displayed in the application.
But nevermind, i am pretty sure that I can’t solve my problem with the filter factory. According to the documentation, I need a real database column and that doesn’t work.
Thank you for your input ☺️