Skip to Content
Technical Articles
Author's profile photo Sumit Kumar Kundu

Fiori Elements – Object Page Table items: Context-based edit-ability

This blog post is to show how to make an item of an Object Page table editable or non-editable based on the context of the item itself.

The example is based on OData service version 2.0 metadata annotation. But applicable annotation for OData v4.0 is also mentioned.

The reference is taken from SAP documentation: Enabling Action Buttons in Tables on the Object Page

Update: For OData services built using ABAP Programming model for SAP Fiori, i.e., CDS view with BOPF enabled, there is another alternative approach to whatever depicted in this blog post to achieve the same (except ‘create’ entity operation). CDS annotation @ObjectModel has a variant ‘EXTERNAL_CALCULATION’ to achieve dynamic control over edit-ability/delete-ability of the entity based on condition. One needs to use methods SET_NODE_UPDATE_ENABLED or SET_NODE_DELETE_ENABLED of BO node determination implementation class as applicable.

Please refer here for more details on how to do this.

Thanks to Sitakant Tripathy  for pointing this out.

@ObjectModel: { 
                transactionalProcessingEnabled: true,
                createEnabled: 	true | false    -- no dynamic entity control support for creation operations
                deleteEnabled: 	'EXTERNAL_CALCULATION'
                updateEnabled: 	'EXTERNAL_CALCULATION'    
define view <ViewName> 
        as select from <data_source>



  1. The OData service in this example is created using ‘Reference Data Source’ option in SAP OData Service builder (SEGW). Following is a snippet of the item CDS entity which will be represented as a table in the ui of object page.
  2. Add following lines of code in method DEFINE of the MPC_EXT class.
METHOD define.
      lr_entity   TYPE REF TO /iwbep/if_mgw_odata_entity_typ.

    super->define( ).
    DATA(lr_entityset) = model->get_entity_set( 'ZCDS_I_SOS_HOME_ITEM' ).
    DATA(lr_anno) = lr_entityset->create_annotation( 'sap' ).
    IF lr_anno IS BOUND.
      lr_anno->add( iv_key = 'updatable-path' iv_value = 'zactive' ).
      lr_anno->add( iv_key = 'deletable-path' iv_value = 'zactive' ).



Here, property ‘zactive’ is a boolean field of the same entity type and controls the edit-ability.

Please note that the OData service in my case is of version 2.0. For OData v4.0, one may use local annotation too.

	<Annotation Term="Capabilities.UpdateRestrictions">
		<Record Type="Capabilities.UpdateRestrictionsType">
			<PropertyValue Property="Updatable" Path="zactive"/>

This will result in OData service metadata like below:

<EntityContainer Name="ZFIAP_SOS_HOME_SRV_Entities" m:IsDefaultEntityContainer="true" sap:supported-formats="atom json xlsx">
				<EntitySet Name="ZCDS_C_SOS_HOME_TP" EntityType="ZFIAP_SOS_HOME_SRV.ZCDS_C_SOS_HOME_TPType" sap:creatable="false" sap:deletable="false" sap:content-version="1"/>
				<EntitySet Name="ZCDS_I_SOS_HOME_ITEM" EntityType="ZFIAP_SOS_HOME_SRV.ZCDS_I_SOS_HOME_ITEMType" sap:content-version="1" sap:deletable-path="zactive" sap:updatable-path="zactive"/>
				<AssociationSet Name="assoc_D9749EB9F873E67DF6F0EBC9B059C454" Association="ZFIAP_SOS_HOME_SRV.assoc_D9749EB9F873E67DF6F0EBC9B059C454" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
					<End EntitySet="ZCDS_C_SOS_HOME_TP" Role="FromRole_assoc_D9749EB9F873E67DF6F0EBC9B059C454"/>
					<End EntitySet="ZCDS_I_SOS_HOME_ITEM" Role="ToRole_assoc_D9749EB9F873E67DF6F0EBC9B059C454"/>

Notice the sap:deletable-path and sap:updatable-path annotations applied to the entityset ZCDS_I_SOS_HOME_ITEM in the example above. For more information on sap annotations for OData v2.0, please refer to this page.

3.  Then the UI application is created using Fiori Elements template for ‘List Report Floorplan’.

For details on how to design and develop a fiori elements app using object page floorplan, refer to these blogs:

Fiori elements – How to Design an Object Page

Fiori elements – How to Develop an Object Page


The edit page has the line item editable where the property zactive = true.

Also the ‘Delete’ button is enabled when the line item is selected.

But for a different record where property zactive = false, Delete button is not enabled.


In this blog post, we saw how, by use of annotations, we can make the object page table line items can be made conditionally editable or non-editable. Similarly we can also apply this to conditionally create an associated entity on the object page by adding ‘sap:creatable-path’ annotation to the navigation property. We also observed different annotations for OData v2.0 vs v4.0.


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Sitakant Tripathy
      Sitakant Tripathy

      Hi Sumit,

      guess this was not BOPF driven and hence the need to tweak the Model. Hopefully this is same as  EXTERNAL_CALCULATION variant for the create/update/delete enabled annotations when the CDS is BOPF driven.



      Author's profile photo Mahesh Palavalli
      Mahesh Palavalli

      This looks similar to that but certain things will not work like if we want to do on calculations on fly without saving to the database then it is not possible here, which only only possible with the draft enabled cds.

      Author's profile photo Sitakant Tripathy
      Sitakant Tripathy

      Hi Mahesh,

      Ideally any editable element should be persisted otherwise no point of allowing edit :). For draft capabilities as well I guess we need persistence for draft data which is then converted into core application tables and draft is cleared.

      For true on the fly calculations in transient mode elements should be read only and we can resort to virtual elements within CDS definitions.



      Author's profile photo Sumit Kumar Kundu
      Sumit Kumar Kundu
      Blog Post Author

      Yes, EXTERNAL_CALCULATION addition to 'define view' scope is an alternative for BOPF-enabled CDS entities.

      Author's profile photo Jay Shen
      Jay Shen

      Hi Sumit,

      I really has a doubt about the enable the inline creation of table entries for apps, I just saw on below wiki that the inline creation only support the draft mode, but I have another strange that I can display and edit the table in the object page facet but when I want to create a entry from list page, the table and the facet disappears, I am wondering if that is also related to draft mode?


      Best Regards,


      Author's profile photo Wolfgang Röckelein
      Wolfgang Röckelein

      Hi Sumit Kumar Kundu ,

      thanks for the helpful Blog. How did you suppress the default


      when you do

      add( iv_key = 'deletable-path' iv_value = 'zactive' ).


      I have now both sap:deletable AND sap:deletable-path in the metadata...and this is according eg to not good....



      Author's profile photo Sumit Kumar Kundu
      Sumit Kumar Kundu
      Blog Post Author

      Hello Wolfgang,

      Sorry about this late response. I didn't have to do anything to make 'sap:deletable' annotaion suppressed. In my case, ABAP standard gateway framework could interpret the annotations well enough to produce the annotation 'sap:deletable-path' where applicable. I tested this with ABAP based OData v2.0. I think in your case, it may be an ABAP version issue (?)



      Author's profile photo Ashwin A
      Ashwin A


      Can i use this method for controling the list report table fields?
      Or is it restricted to the Object page.




      Author's profile photo Sumit Kumar Kundu
      Sumit Kumar Kundu
      Blog Post Author

      I think, yes you can.

      Author's profile photo Nagalakshmi butti
      Nagalakshmi butti


      How can we define table in object page with more than one record.