In this section, you will learn how to control field properties in the behavior definition and how to adjust the UI in the metadata extension.
After completing this lesson, you will be able to:
In this section, you will learn how to control field properties in the behavior definition and how to adjust the UI in the metadata extension.
In the behavior definition of your projection set the fields CityFrom, CityTo, CountryFrom, and CountryTo to read-only.
Open the behavior definition Z##_R_CONNECTION (where ## is your group number.
Enter the following code in the behavior definition. The precise position is not important. We suggest that you place it immediately after the existing field
statement:
Activate the behavior definition.
Rearrange the fields in the app so that they appear in the following order:
10 | CarrierID |
---|---|
20 | ConnectionID |
30 | AirportFromID |
40 | AirportToID |
50 | CityFrom |
60 | CityTo |
70 | CountryFrom |
80 | CountryTo |
Open the metadata extension Z##_C_CONNECTION where ## is your group number. Where necessary, change the value of the annotation @UI.identification: [ { position: } ]
so that it corresponds to the value in the table.
Activate the metadata extension.
In this section, we will learn about providing value help to the users. Watch this video to learn more.
Create a CDS View Entity called Z##_I_CarrierVH.
Choose File → New → Other.
Type data into the filter field to restrict the number of objects offered.
Double-click Data Definition.
Ensure that the package is correct, enter the name Z##_I_CarrierVH where ## is your group number. Enter a description and the referenced object /DMO/AIRLINE.
Choose Next.
Mark the appropriate transport request and chose Next.
Mark the template Define View Entity and choose Finish.
Ensure that the view contains only the fields carrier_id (with alias CarrierID) and name (with alias Name).
Delete the fields currency_code to last_changed_at. The view definition should now look like this:
Add @UI.lineItem
annotations so that the system displays the data when the user starts the value help.
Add the annotations so that your source code looks like this:
Activate the CDS View Entity.
Choose Ctrl + F3.
In the projection view Z##_C_CONNECTION (where ## is your group number) attach the value help to the field CarrierID. Use the annotation @Consumption.valueHelpDefinition
. For the attribute name use the CDS View Entity Z##_I_CarrierVH, and for the attribute element, use the field CarrierID.
Open the data definition Z##_C_CONNECTION and add the following annotation before the element CarrierID. Replace ## with your own group:
Activate the data definition.
Choose Ctrl + F3.
Log in to track your progress & complete quizzes