on 04-27-2022 12:06 PM
Hello Experts,
I have developed a Fiori App( List Report - Object Page ) using Fiori Elements and ABAP RAP Programming. I do not want the user to edit or delete any of the created instances.
managed implementation in class zbp_c_etn_entered_info unique;
strict;
define behavior for ZC_ETN_ENTERED_INFO alias etn_info
persistent table ztsdb
lock master
early numbering
authorization master ( instance )
//etag master <field_name>
{
field ( readonly ) Counter, Status , StatusDescription, ProjectJira , Ticket, TicketText,
WorkLogID , UnitOb , UnitConsulting , UnitAdditionalCosts ;
field ( mandatory : create ) WorkDate , ConsultingDocument , MessageText ;
create;
update;
// delete;
<br>
I was able to remove the 'Delete' button just by commenting
But I cannot remove the update button since I have determinations with Modify Entity with Update fields .
Ex.
MODIFY ENTITIES OF zc_etn_entered_info IN LOCAL MODE
ENTITY etn_info
UPDATE SET FIELDS WITH VALUE #( FOR xxx IN lt_xxxx
( %key = xxx-%key
Status = '10' "
%control = VALUE #( XXX = if_abap_behv=>mk-on )<br>
If I remove the Update command then it will throw runtime errors.
So long story short, How can i remove edit button from the object page ?
Hi PD,
if you want to have a dynamic behavior based on the content you have to use the key word ( features : instance ) for the operation update.
If you just want to disable the option that users can edit content that has been created the approach described above is the best.
Here you are able to create several projections. One that is offering the option to edit the date
projection;
define behavior for ZC_TESTFEATURESTP alias TestFeatures
{ use create;
use update;
use delete; }
and a second one that blocks the use of update
projection;
define behavior for ZC_TESTFEATURESTP alias TestFeatures
{ use create;
// use update;
use delete; }
When you are looking for a dynamic solution look at this:
managed;
define behavior for ZR_TESTFEATURESTP alias TestFeatures
implementation in class ZBP_R_TestFeatures unique
persistent table ZAIRPORT1
etag master LocalLastChangedAt
lock master
authorization master( global )
{
create;
update ( features : instance );
delete;
mapping for ZAIRPORT1
{
AirportID = AIRPORT_ID;
Name = NAME;
City = CITY;
Country = COUNTRY;
LocalLastChangedAt = LOCAL_LAST_CHANGED_AT;
}
}<br>
The you have to implement in your behavior implementation class the method get_instance_features( ).
CLASS lhc_TestFeatures DEFINITION INHERITING FROM cl_abap_behavior_handler.
PRIVATE SECTION.
METHODS get_global_authorizations FOR GLOBAL AUTHORIZATION
IMPORTING REQUEST requested_authorizations FOR TestFeatures RESULT result.
METHODS get_instance_features FOR INSTANCE FEATURES
IMPORTING keys REQUEST requested_features FOR TestFeatures RESULT result.
ENDCLASS.
CLASS lhc_TestFeatures IMPLEMENTATION.
METHOD get_global_authorizations.
ENDMETHOD.
METHOD get_instance_features.
READ ENTITIES OF zr_testfeaturestp IN LOCAL MODE
ENTITY TestFeatures
ALL FIELDS
WITH CORRESPONDING #( keys )
RESULT DATA(entities).
result = VALUE #( FOR entity IN entities
( %tky = entity-%tky
%update = COND #( WHEN entity-City IS INITIAL
THEN if_abap_behv=>fc-o-enabled
ELSE if_abap_behv=>fc-o-disabled )
) ).
ENDMETHOD.
ENDCLASS.<br>
As a result you will see the following:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
andre.fischer
In case we created a CDS view, generated a Business Object (BOPF) for it, exposed via OData using annotations and created Fiori Element List Report application based on this service.
How can we remove EDIT button from object page for such applications OR handle dynamic behavior based on the content.
By using projections you can create access to your entity without exposing certain capabilities. Your underlying BDEF could still be create, update and delete enabled, but the App you have built will be based on an projection on top of it which exposes on the projection layer only the create capability: https://help.sap.com/docs/BTP/923180ddb98240829d935862025004d6/6e7a10d30b74412a9482a80b0b88e005.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your approach is correct if you want to disable the option to update data at all.
If I understood PD correctly he is looking for a dynamic behavior.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.