cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP Fiori Elements Action button that invokes a CDS Function (not an Action)?

iperez-sofos
Participant
0 Likes
2,023

In a post that I recently wrote (https://answers.sap.com/questions/13710082/invoke-cap-cds-function-from-sap-fiori-element-ext.html?url_id=text-global-profile-inbox-qa-answer-published-to-question), a question has arisen that I have not been able to clarify in the comments and that I have decided to raise in a separate publication. It is precisely what I outline in the title of this post.

I am writing an SAP CAP + SAP Fiori Elements app, and I want to put, in my UI, a button that invokes/calls a CDS function (not an Action) defined in my CAP services.

From the examples I've seen, and from the responses I received in the post I quoted earlier, it is indicated to use annotations like the following:

{
$Type : 'UI.DataFieldForAction',
Action : 'AdminService.EntityContainer/sendmail', // --->> would it work if sendmail was a function?
Label : '{i18n>sendmail}'
},

However, here is my specific question: Does this work for CDS functions (ie sendmail was a function and not an action)?

Accepted Solutions (0)

Answers (1)

Answers (1)

gregorw
SAP Mentor
SAP Mentor
0 Likes

Hi Isaac,

I think you need to file an incident via SAP Support on this topic. The documentation for DataFieldForAction defines for the Action: "Qualified name of an Action, Function, ActionImport or FunctionImport in scope". So a function should also be supported. I've tried in my sample project and added an function to my Orders Entity:

feat: add call to function

Interresting thing is that this function isn't invoked when using SAPUI5 1.96. But it works when using SAPUI5 1.105.0. But there only with OData V2.

So I suggest you file an incident via SAP support providing my sample.

Best Regards
Gregor

smok1
Explorer
Tested this and functions doesn't seem to trigger in js handler in SAPUI5 v1.124.0, CDS V7.9.2. Actions and manually calling a function works