Recently I was working on a new field for Fiori App My Travel and Expenses (F6190). That new field was supposed to influence another field value on the screen, but it did not. Below is a short description of how I made that work.
The business requirement was to add a Custom Field to the Receipt entity, which would be later use to recalculate another standard field (Tax Code) on the screen. The steps to accomplish this were as follows:
- Create a Value Help CDS entity
- Release the entity with C1 Contract for use in Key User Apps
- Create a Custom Field “Country” with mentioned Value Help for Business Context Travel Expense Receipt Data (TRAVELEXPENSERECEIPT)
- Enable the field for the UI and Publish
- Create Fiori Adaptation Project to include the field in required view
- Implement the backend logic for determination in the BAdI FIN_TRV_RECEIPT_CHECK
- Observe that after changing Country field Tax Code is not updated
The problem is that by default there is no side effects defined for the new Custom Field defined in Key User Extensibility apps. To solve this problem Behavior Extension must be created, in this case extension for C_TRAVELEXPENSE Behavior Definition:
extend behavior for TravelExpenseReceipt
{
side effects {
field zz1_country affects $self;
}
}
After introducing above code, changing the Country field results in additional request being sent from the Fiori app to retrieve updated values of the entity, including recalculated Tax Code.
