Once a travel is accepted, its booking fee must be read-only, Accept must be greyed out, and no new bookings may be added. Rejected travels must not get bookings either. Write your BDEF lines and your get_instance_features.
Say your answer out loud first.
Practise another way
I declare features : instance on the booking fee field, on the accept action and on the create-by-association for bookings.
In get_instance_features I read the status with EML in local mode and fill RESULT per instance. %field-BookingFee gets read-only, %action-acceptTravel gets disabled, and %assoc-_Booking gets disabled for accepted or rejected travels. Fiori greys the controls out, and the framework also refuses those requests.
BDEF. Dynamic control must be declared on each element (pattern from SAP's /DMO/R_TRAVEL_D):
field ( features : instance ) BookingFee;
action ( features : instance ) acceptTravel result [1] $self;
association _Booking { create ( features : instance ); with draft; }
Handler. The FOR INSTANCE FEATURES method receives the keys and a REQUEST structure. It returns one row per instance:
METHOD get_instance_features.
READ ENTITIES OF zr_travel IN LOCAL MODE
ENTITY Travel FIELDS ( OverallStatus ) WITH CORRESPONDING #( keys )
RESULT DATA(travels) FAILED failed.
result = VALUE #( FOR t IN travels
LET done = xsdbool( t-OverallStatus = 'A' OR t-OverallStatus = 'X' ) IN
( %tky = t-%tky
%field-BookingFee = COND #( WHEN t-OverallStatus = 'A'
THEN if_abap_behv=>fc-f-read_only
ELSE if_abap_behv=>fc-f-unrestricted )
%action-acceptTravel = COND #( WHEN t-OverallStatus = 'A'
THEN if_abap_behv=>fc-o-disabled
ELSE if_abap_behv=>fc-o-enabled )
%assoc-_Booking = COND #( WHEN done = abap_true
THEN if_abap_behv=>fc-o-disabled
ELSE if_abap_behv=>fc-o-enabled ) ) ).
ENDMETHOD.
Why each detail matters
IN LOCAL MODEreads without feature and authorization checks. It also sees the transactional buffer, so a status changed earlier in the same request counts.%tkycarries%is_draftin draft BOs. A draft and its active twin can therefore get different results.- Read only what the rule needs. The method also runs when the UI displays the list report or object page, to decide which buttons are active. A wide read on many rows costs time there.
failedfrom the read is passed on, so a missing instance is reported correctly.
Field constants are in if_abap_behv=>fc-f (for example read_only, unrestricted). Operation constants are in if_abap_behv=>fc-o (enabled, disabled). For update and delete the components are %update and %delete, or %features-%update as in SAP's keyword example.
What it is not. Instance feature control decides by the state of the data. It does not ask who the user is; that is authorization.
It does not explain why to the user; add a message where needed. Create itself cannot be instance-controlled, because no instance exists yet. Use global feature control for that.
Release note. Instance feature control for fields, actions and associations is available on SAP BTP ABAP environment (now SAP Business AI Platform, ABAP environment) and ABAP Platform 2022 or later.
Declares features : instance on each element, reads only the status IN LOCAL MODE, fills %field, %action and %assoc per %tky with the fc constants, and passes FAILED on.
Hides the button with a UI annotation only, or reads whole travels with bookings inside get_instance_features for every row.
Forgetting features : instance in the BDEF for that element. The result type then has no component for it, so the handler cannot control it (the code does not even compile), and the field or button stays unrestricted.
- Why can create not use instance feature control, and what do you use instead?
- The button is still active although the method returns disabled. What do you check?
- How does a draft instance get a different result from its active version?
6 official pages and 1 prep guide. Confidence: high. Checked 3 Dec 2026.
- Prep guide Gives the question.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.