RAP- CRUD Operations

Advertisements

Let’s get started with the post where we will design a Fiori App with basic CRUD operation on flight model data.

What are the steps involved in this exercise-

  • To create a DB table
  • To create a CDS View ( Interface view)
  • To create a consumption view
  • To create a metadata extension
  • To create a behavior definition for interface view
  • To create a behavior definition for consumption view
  • To create a service definition
  • To create a service binding

Before creating the first step, i am creating a new package but this is an optional step.

Saving in an existing TR but create a new TR if not so.

So the package is ready.

First setp is to create a Db table(flight model).

Proceed a below-

Provide name and description-

Save in a TR-

Below syntax appears-

Create a flight model table with few fields- Save and activate.

Now as a second step- lets create a CDS view.

Proceed as below-

Provide the CDS view name( this is called interface view in RAP).

Proceed as below selection-

The below syntax appears-

Provide the source which is the DB table and add all the fields of the table in the view and define suitable alias name for each field.

Add ‘ROOT-> as this is the root view.

Define a next view-

provide the name and description-

Select ‘Define View Entity’-

The below syntax appears-

This is the consumption view which is a projection on the interface view. Here we added annotations such as Searchable and enduser text for each of the fields. In addition set allow meta data extension as true as in next we are going to define a meta data extension for our fiori UI.

Define a Metadata Extension-

Provide the name and description-

Choose Annotate View-

Below syntax appears-

Add below annotations- In our fiori Ui, we want search. list ad details page with create, edit, delete operations. Here mostly we provide the positions to each of the fields in the list and details screen.

Next step is to define behavior definition to our Interface view-

Right click on the interface view and choose New Behavior Definition-

The system takes same name as the interface view and the implementation type is Managed- as the CRUD operations is going to be managed by the framework-

Teh below syntax appears-

Now we have to add few things to it- the Create, Update and Delete behaviors are supported and we need to provide the mapping of the fields between the DB table and the interface view fields as we have defined alias names in the interface view.

One more thing is- the system suggested a class name which is not yet created but if we are adding other actions, validations or determinations then we can create this class and implement those but as we are dealing with only CRUD operations then its not mandatory to create the class. We just leave it as it is at the moment.

below is the projection view-

let’s create a behavior definition for this as well-

provide the description and others the system takes automatically.

The below syntax appears-

just provide the alias name and use etag.

Next step is to create a Service Definition-

Provide name and description.

Continue-

The below syntax appears-

Provide the consumption view name-

Next step is t create a service binding for the service definition-

Provide a name, description and Binding type- we can choose OData V2/V4 UI. Let’s select as below-

Provide the service definition for which binding is to be created.

Below screen appears-

Activate and then the publish button is enabled.

Click on Publish and the system takes little time to publish the service in cloud foundry.

Select the Entity and Preview-

5So here is the Fiori UI. Click go and no result found.

let’s create.

here is the screen-

provide info and create.

Go back-

try other buttons-

From list navigate to details page.

Edit-

Save.

Delete-


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s