2

Implementing Function Import through an extension of RAP Unmanaged Query: Part 2

 1 year ago
source link: https://blogs.sap.com/2022/11/30/implementing-function-import-through-an-extension-of-rap-unmanaged-query-part-2/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
November 30, 2022 3 minute read

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.

1-88.png

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

2-51.png

Variant Qualifiers are same which we have defined in the root entity.

3-45.png

After this configuration below code snipper would be added to application manifest.

4-38.png

Now let us implement the function import for a custom action via extension.

Guided development > List Report Page > Custom Action using extensions

5-27.png

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.

6-24.png

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.

7-29.png

 Code in extension controller:-

8-26.png

One user fills in the required fields and clicks on proceed button of the fragment, call to function import happens.

9-40.png
10-18.png

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.

11-19.png

Let’s click on ‘Create Planned Substitution’. These are the parameters from the abstract entities we have defined in the data model.

12-18.png

Let’s Click on ‘Activate Substitution’. This screen is the fragment we have defined and subsequently it calls the function import.

13-17.png

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 @Parichay Patra

More on this topic, you can refer to below links:-
– Q&A
– Blogs


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK