cancel
Showing results for 
Search instead for 
Did you mean: 

RAP Create button still enabled after disabling the feature

jacek_zebrowski3
Explorer
0 Kudos
2,121

Hi !

I have created global feature with intention to disable CREATE action - it all works fine but instead of hiding cerate button it is still enabled and when i click it i get popup saying that create action is disabled - any advice on how to disable/hide the create button ?

SAPUI5 Version is 1.96.1
Here is my implementation of get global features:

 

 

 

 METHOD get_global_features.
    DATA lv_allowed_create TYPE boole_d.

    lv_allowed_create = zcl_qm_claim=>get_global_create_allowed( ).
    IF lv_allowed_create = abap_false.

      result-%create =  if_abap_behv=>fc-o-disabled.
    ENDIF.
    result-%update = if_abap_behv=>fc-o-enabled.
  ENDMETHOD.

 

 

I discovered thet get_global_features method is not called... my behaviour is defined like this:

 

unmanaged implementation in class zbp_qm_claims_qmel unique;
with draft;
define behavior for ZQM_CLAIMS_QMEL
draft table zqm_qmel_draft
late numbering
lock master
total etag aedat
authorization master ( instance, global )
etag master aedat

{

  create ( features : global );
  update ( features : global );

  association _qmma { with draft; create; }

  field ( readonly ) qmnum, qmart;

  //COSTS
  field ( features : instance ) zzestimated, zzagreedsup, zzagreedmill,
  zzestimated_cur, zzagreedmill_cur, zzfinstatsup, zzfinstatmill,
  zzcrdbnote, zzcrnote, txt04;
  draft action Edit;

  determination setInitialValues on modify { create; }

}

 

 what do I do wrong ?

 

Accepted Solutions (1)

Accepted Solutions (1)

JessieCheah
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi there,

try using the annotation @ui.createHidden: true to hide the create button in addition to using global feature control to disable the operation.

This annotation is an entity annotation, that means in CDS view it goes above 

define view entity...

and in metadata extension, above

annotate view xxx with { ..

Hope this helps.

Regards,
Jessie

jacek_zebrowski3
Explorer
0 Kudos
Im sorry but above anotation is used to hide create button on table = not on global actions area
JessieCheah
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi there,

May I ask what do you mean by 'global action area'?

The annotation I mentioned (plus 2 others for Update and Delete) are used specifically to hide the standard CUD operations buttons, which are
- the create and delete that you see either at the List Report or if in the Object Page, at the tables
- and the update and delete at the top of the Object Page

Regards,
Jessie

jacek_zebrowski3
Explorer
0 Kudos
Well @ui.createHidden: true is not avaliable as annotation on entity level - what ABAP version should i have to use it ?
JessieCheah
Product and Topic Expert
Product and Topic Expert
0 Kudos

@ui.createHidden should be available from ABAP Cloud release 2302 and S/4 HANA OP 2023. If you say you are getting a syntax error when trying to use the annotation, you are probably on an older release. Unfortunately there is no other workaround from RAP or ABAP CDS at the moment, as this behavior is controlled by Fiori Elements, perhaps you could open a ticket with FE and they may have suggestions.

Regards,
Jessie

TylerFincham
Explorer
0 Kudos
this annotation indeed hides the create button. But it doesn't help triggering the get_global_features so we can control it dynamically.
d_schuitemaker62
Explorer
0 Kudos
I struggled with the same requirement, conditionally hide the Create button. I did not manage to do this, but got something which works the same. By using method get_global_features() you can conditionally say that the user is not authorized, and block him/her from creating an new entry.
d_schuitemaker62
Explorer
0 Kudos
To do this, do the following:
d_schuitemaker62
Explorer
0 Kudos
To do this, do the following: 1. Define create in your behaviour definition as: create ( features : global ); 2. Define this method in the Local Types part of your implementation class like this: METHODS get_global_features FOR GLOBAL FEATURES IMPORTING REQUEST requested_features FOR MissionNeeds RESULT result. 3. Implement like this: result-%create = COND #( WHEN sy-subrc = 0 THEN if_abap_behv=>auth-allowed ELSE if_abap_behv=>auth-unauthorized ).
d_schuitemaker62
Explorer
0 Kudos
This way, you can block the creation of an entry. Of course it would be better if you could make the button visible, but since RAP works with entities and here there is no entity I can understand that this is not easy to implement in RAP Fiori for SAP. In my opinion, this approach comes the closest to the desired behaviour.

Answers (0)