Implementing Function Import through an extension of RAP Unmanaged Query: Part 2
In our previous section ( Part 1), we have created the backed data models, behavior and service for the query. In this part we shall proceed with the frontend application and shall extend the application to implement multiple views for the segmented buttons and the function import.
Once the application is created and if you run it, the segmented buttons will not appear on the screen and will behave the same way it was tested from the service binding.
To display different views against different tabs (i.e planned and unplanned), we must include the multiple view configuration via guided development.
Guided development > List Report Page > Configure Multiple views
Variant Qualifiers are same which we have defined in the root entity.
After this configuration below code snipper would be added to application manifest.
Now let us implement the function import for a custom action via extension.
Guided development > List Report Page > Custom Action using extensions
Once you have completed the extension configuration and applied the code snippets, manifest will be updated with below code and a custom extension controller with an empty function ( for the action ) will be created.
As per our requirement, we need to display a dialog for notification and after confirmation on the dialog the function import should be called.
For this we have created one xml fragment and calling the same on the press event of the custom action we have extended.
Code in extension controller:-
One user fills in the required fields and clicks on proceed button of the fragment, call to function import happens.
Few things to mention here:
- Entity name is the name of the static function which we have defined in the behavior definition.
- UrlParameters are the properties of the root entity because we have referred root entity for parameters in behavior definition.
- As we have a return table defined in the static function, oData will contain the return table. So we need to just refresh the table to display the updated records.
Now lets run the application to check the functionality.
Let’s click on ‘Create Planned Substitution’. These are the parameters from the abstract entities we have defined in the data model.
Let’s Click on ‘Activate Substitution’. This screen is the fragment we have defined and subsequently it calls the function import.
That’s the end of the topic. I thank you and appreciate that you have gone though the concept. I hope that adopting such hybrid approach would give more flexibility towards adding additional features to your applications with least amount of code. For any topic related to BTP, RAP, CAPM or Mobile Services please post a query and please let me know your comments/feedback.
You can follow me @My Profile