cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP RAP - Instance Feature control for delete

mhappe
Participant
0 Kudos
3,666

I try to add some feature control to my RAP model. I only want to allow the deletion of draft items (item is a child of my root node) which don't have an active instance yet.

When disallowing deletion, new items (drafts) could not be deleted as well, so this is not a good option.

So adding feature control for the delete function could be an option:

delete( features : instance);

But within the feature control method "get_instance_features", I only want to allow deletion for items which doesn't have an active entity. How to achieve this?


Within the ABAP Fiori programming model with BOPF there was field available called "hasactiveentity".

andre.fischer Any ideas?

Thanks in advance!

Mattijs

View Entire Topic
Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

I am disabling the edit button im my RAP Generator UI when the job for generating the repository objects has been scheduled.

There the action %action-edit is disabled or enabled based on the content of the field jobname in the entity rapbo.

But I assume you should be able to adapt it for your needs as follows:

%action-delete          = COND #( WHEN rapbo-%is_draft = if_abap_behv=>mk-on
                                  THEN if_abap_behv=>fc-o-enabled
                                  ELSE if_abap_behv=>fc-o-disabled )

cloud-abap-rap/zdmo_bp_i_rapgeneratorbo.clas.locals_imp.abap at main · SAP-samples/cloud-abap-rap · ...

line 609 ff.

result = VALUE #( FOR rapbo IN rapbos
                    ( %tky                   = rapbo-%tky

                      %field-packagename    = COND #( WHEN rapbo-packagename IS INITIAL
                                                      THEN if_abap_behv=>fc-f-mandatory
                                                      ELSE if_abap_behv=>fc-f-read_only )
                      %field-namespace      = COND #( WHEN rapbo-packagename IS NOT INITIAL
                                                      THEN if_abap_behv=>fc-f-mandatory
                                                      ELSE if_abap_behv=>fc-f-read_only )
                      %action-edit          = COND #( WHEN rapbo-jobname IS INITIAL
                                                      THEN if_abap_behv=>fc-o-enabled
                                                      ELSE if_abap_behv=>fc-o-disabled )
                      %action-createbo      = COND #( WHEN rapbo-%is_draft = if_abap_behv=>mk-off AND
                                                           rapbo-jobname IS INITIAL
                                                      THEN if_abap_behv=>fc-o-enabled
                                                      ELSE if_abap_behv=>fc-o-disabled )
0 Kudos

Hi Andre,

Is there a similar option available in ABAP Programming model for Fiori?

Below annotation makes 'Delete' enable. But if the instance should not be deleted for any particular condition, is there any similar way as in RAP to control this standard delete function?

If there is none, then plan B is to disable DELETE and add custom action

Thanks

Shabnam