- For RAP we use BTP S/4 HANA Free trial version for creating RAP Application.
- In this application will show you creating Read Application in RAP.
- Step
1: Create Basic Interface CDS View
- Step 2: Provide CDS View name, Description detail
- Step 3: Select template as below
- Step 4: CDS view created as below (add root key word and for Quantity and Amount field always define the Relation using Semantics annotation as we can see the line no 14 in the below image:
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Basic Inte view for Flight Connection'
@Metadata.ignorePropagatedAnnotations: true
define root view entity ZI_CONNECTION_R
as select from /dmo/connection
{
key carrier_id as CarrierId,
key connection_id as ConnectionId,
airport_from_id as AirportFromId,
airport_to_id as AirportToId,
departure_time as DepartureTime,
arrival_time as ArrivalTime,
@Semantics.quantity.unitOfMeasure: 'DistanceUnit'
distance as Distance,
distance_unit as DistanceUnit
}
- Step 5: On top of the basic view create consumption view as below, (Provide Consumption CDS view, description and in reference object kindly provide your basic interface view):
- Step 6: Select projection view template as below and click on finish
- Step 7: Add root key word in projection view and for quantity and amount column kindly provide unit reference field using annotation semantic as show in below
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Consuption view for Flight connection'
@Metadata.ignorePropagatedAnnotations: true
@Metadata.allowExtensions: true
define root view entity ZC_CONNECTION_R
as projection on ZI_CONNECTION_R
{
key CarrierId,
key ConnectionId,
AirportFromId,
AirportToId,
DepartureTime,
ArrivalTime,
@Semantics.quantity.unitOfMeasure: 'DistanceUnit'
Distance,
DistanceUnit
}
- Step 8: Create Service definition, right click on the Consumption CDS view and click on Service definition
- Step 9: Provide definition and description detail
- Step 10: Select service definition as below and click on finish
- Step 11: Service definition is created successfully and provide allis name if possible, as below
- Step 12: On top off the service definition create Service binding, Right click on Service definition and click on Service binding
- Step 13: Provide service binding name, description and Binding Type as below
- Step 14: First activate service binding and publish service and again activate the service
- Step 15: Select the Entity Set highlighted in step 14 and click on Preview, First we have to unhide all field by click on Setting button and then click on Go button
- In this simple Read application we just see the application data now, If you want to see selection field where we can applied filtration condition and when we click on go button then all the filtered records should display on the screen for that we have to write the annotation
- Note: For better practices will create Metadata extension and write all the annotation inside the meta data extension.
- Before creating
Metadata extension kindly add one more annotation in Consumption view
- Create Extension view
- Provide Metadata extension name and description detail as below:
- Select Metadata Annotate Entity as below:
- Metadata Extension as show below:
- Metadat Extension Code:
@Metadata.layer: #CORE
@UI.headerInfo: { typeName: 'Flight Detail',
typeNamePlural: 'Flight Detail'}
annotate entity ZC_CONNECTION_R with
{
@UI.selectionField: [{position: 10 }]
@UI.lineItem: [{ position: 10, label: 'Flight ID' }]
@UI.identification: [{ position: 10 }]
CarrierId;
@UI.selectionField: [{position: 20 }]
@UI.lineItem: [{ position: 20, label: 'Airline ID' }]
ConnectionId;
@UI.selectionField: [{position: 30 }]
@UI.lineItem: [{ position: 30, label: 'Departure From' }]
AirportFromId;
@UI.selectionField: [{position: 40 }]
@UI.lineItem: [{ position: 40, label: 'Destination To' }]
AirportToId;
@UI.lineItem: [{ position: 50, label: 'Departure Time' }]
DepartureTime;
@UI.lineItem: [{ position: 60, label: 'Arrival Time' }]
ArrivalTime;
@UI.lineItem: [{ position: 70, label: 'Distance' }]
Distance;
@UI.hidden: true
DistanceUnit;
}
- Output:
No comments:
Post a Comment