Skip to Content

Fiori Elements : Hide actions by annotation

Hi all,

In my Object Page, I would like to control visibility of Actions like I already do with Field-Control for properties.

As I can see here (but I'm not sure) is with annotation I can do it like this:

sap:applicable-path="SOHeader/FcActionReject"

But it doesn't work. ActionVisible is a boolean property. Here is my annotation :

<FunctionImport Name="RejectDT" ReturnType="ZSD_DT_SRV.SOHeader" EntitySet="SOHeaders" m:HttpMethod="POST" sap:label="Rejeter" sap:action-for="ZSD_DT_SRV.SOHeader" sap:applicable-path="SOHeader/FcActionReject" />

Am I wrong ? I don't know what's going on.

Kind Regards,

Joseph

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Mar 08 at 12:25 PM

    Hi Joseph

    Ah... just realized you are trying to use Action Control as explained here:

    https://sapui5.hana.ondemand.com/#/topic/5b0b686a3b7a491a9ec654b4f1536fa8

    Ok in the example above you can see sap:applicable-path=IsActiveEntity

    IsActiveEntity is not a path .. it's a boolean true/false value.

    So in your example you would need to set sap:applicable-path="ActionVisible" where ActionVisible is a boolean value. If true then the button is active, if false, the button is visible but disabled,

    Good luck!

    Jocelyn

    Add comment
    10|10000 characters needed characters exceeded

    • Hello Jocelyn,

      Thanks you for your answer.

      In fact, the key to make it working is that the IsActiveEntity have to be on the EntitySet of the sap:action-for parameter.

      In my example I thougth it was a expression path and it that why it ddidn't work.

      To conclude, it's working because my FcActionReject property come from ZSD_DT_SRV.SOHeader entitySet :

      <FunctionImport Name="RejectDT" ReturnType="ZSD_DT_SRV.SOHeader" EntitySet="SOHeaders" m:HttpMethod="POST" sap:label="Rejeter" sap:action-for="ZSD_DT_SRV.SOHeader" sap:applicable-path="FcActionReject" />

      Regards

      Joseph

  • Mar 08 at 12:06 PM

    Hi Joseph, I understand what you are trying to do. At the moment this is not supported by annotations for actions.

    Please raise a SAP Incident as an Enhancement Request (use component CA-UI5-ST) asking for this to be considered for Fiori elements. We have had a similar request from another customer recently and it would promote this idea for roadmap consideration to have it as a formal enhancement request.

    You cannot currently hide (i.e. remove) a button through UI Adaptation at runtime either.

    Your best option at the moment would be to use UI Adaptation at Design Time - i.e. using the WYSWIG editor in the SAP Cloud Platform Web IDE similar to what is described in https://blogs.sap.com/2017/08/27/fiori-elements-export-to-microsoft-excel-via-the-ui-adaptation-editor/

    Rgds,

    Jocelyn

    Add comment
    10|10000 characters needed characters exceeded