cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP RAP - Instance Feature Control of a field in Action button - Update

0 Kudos
8,896

Hello All,

I have enabled buttons via RAP model. But my main requirement is to enable / disable a particular field based on certain condition within that Update action button.

Consider fields that appear on click of Edit are : Material, Material Description, WBS, Status.
Validation that i want is that if
Status = Created then WBS should be non - editable and Material to be editable and hence, Update should happen.

Status = Released then WBS and Material should be Editable and Update should work.

Basically, Action button should always be enabled, its the field within which need to be enable / disable.


Kindly suggest how to achieve this.

Thanks in advance!!

Shilpi

Accepted Solutions (0)

Answers (1)

Answers (1)

j_pavan_kumar
Product and Topic Expert
Product and Topic Expert

Hi Shilpa,

In behavior definition, mention the list of fields which needs to be enabled for dynamic field control and implement the behavior implementation for handling the feature control for the entity.

Pseudo code:

Enable the list of fields in behavior definition.

{
 field ( features : instance ) WBS, Material;
 ...
}

Handle the dynamic feature control for fields in behavior implementation.

result = VALUE #( FOR ls_wa IN lt_table
                 ( %tky  = ls_wa-%tky
                   %field-WBS  = COND #( WHEN ls_wa-Status = 'created'
                                        THEN if_abap_behv=>fc-o-disabled
                                        ELSE if_abap_behv=>fc-o-enabled ) 
                    ) ).
pailovesearth
Advisor
Advisor
0 Kudos

Note: if_abap_behv=>fc-o-enabled is for operation (actions) not for fields. 

For fields please use if_abap_behv=>fc-f-mandatory ( or readonly, unrestricted, all).

https://help.sap.com/docs/abap-cloud/abap-rap/instance-feature-control?version=s4_hana

 

Kostiantyn_K
Participant
0 Kudos

For me such approach generates dump "Handler not implemented; Method: INSTANCE_FEATURE, Involved Entities: ZC_XXXXXXXX"

I did everything correct as book described activated  class and behavior. Only difference from example /DMO/FLIGHT is that I added such behavior into associated entity not in the root entity. Have you had such problems?