In this exercise, you will explore the value help provided in the application. In addition, you will adjust the user interface of the generated app: either directly by editing the UI metadata, or indirectly by adjusting the business object behavior.
Prerequisites
You completed the previous exercises. You created and filled the database table Z##FLIGHT (where ## is your group number) and generated the development objects for an OData UI service.
Task 1: Analyze the Value Help
Verify that a value help is offered for the Currency field on the Object Page. Examine where and how this value help is defined.
Steps
Launch the preview of the OData UI service.
Proceed as you have done in previous exercises.
Open the Object Page for a flight in edit mode.
Proceed as you have done in previous exercises.
Verify that a value help is available for the Currency field.
Open the value help for the Currency field displayed for the flight price.
Return to the development environment and explore the definition of the value help.
Task 2: Adjust the Behavior
Exclude the standard operations create and delete, and set the PlaneTypeID field to read-only .
Note
These changes should only apply to your OData UI service. The business object itself should still support the creation and deletion of flights, and the changing of the airplane type.
Steps
In the behavior projection for your service, disable the standard operations create and delete.
Open the behavior projection ZC_##FLIGHT (where ## is your group number).
Add comment markers in front of the statements use create; and use delete;.
To add the comment markers, proceed as usual: select the code rows you want to comment and press Ctrl + <.
Your code should then look like this:
123
// use create;
use update;
// use delete;
In the behavior projection of your business object, set the PlaneTypeID field to read-only.
In the behavior projection, add the following code:
1
field ( readonly ) PlaneTypeID;
Note
The precise position of the statement is not important. We suggest that you place it before the use... statements.
Activate the behavior projection.
Press Ctrl + F3 to activate the behavior projection.
Task 3: Adjust the UI Metadata
Hide the administrative fields from the UI. Make sure only CarrierID and ConnectionID are displayed as selection fields on the report list page. Change the field sequence on the Object Page so that PlaneTypeID is displayed before Price.
Steps
Edit the metadata extension of the projection view ZC_##Flight. Remove all UI annotations for the fields LocalCreatedBy, LocalCreatedAt, LocalLastChangedBy, LocalLastChangedAt, and LastChangedAt and replace them with @UI.hidden: true.
Open the metadata extension ZC_##FLIGHT, where ## is your group number.
Adjust the code as follows:
1234567891011121314
@UI.hidden: true
LocalCreatedBy;
@UI.hidden: true
LocalCreatedAt;
@UI.hidden: true
LocalLastChangedBy;
@UI.hidden: true
LocalLastChangedAt;
@UI.hidden: true
LastChangedAt;
Remove the @UI.selectionField annotation for all elements except for the elements CarrierID and ConnectionID.
Adjust the code as follows:
1234567891011121314151617181920212223
@UI.identification: [ {
position: 30
} ]
@UI.lineItem: [ {
position: 30
} ]
FlightDate;
@UI.identification: [ {
position: 40
} ]
@UI.lineItem: [ {
position: 40
} ]
Price;
@UI.identification: [ {
position: 50
} ]
@UI.lineItem: [ {
position: 50
} ]
PlaneTypeID;
Change the position of the PlaneTypeID field on the Object Page. Place it between FlightDate and Price.
Hint
The position on the Object Page is specified with annotation @UI.identification.
Change the value of annotation @UI.identification: [ { position: } ] for the PlaneTypeID element. Choose a value that lies between the values for the elements FlightDate and Price.
Adjust the code as follows:
1234567
@UI.identification: [ {
position: 35
} ]
@UI.lineItem: [ {
position: 50
} ]
PlaneTypeID;
Activate the metadata extension.
Press Ctrl + F3 to activate the metadata extension.
Task 4: Verify the Result
Restart the preview of the OData UI service and verify the changes to the user interface.
Steps
Restart the preview of the OData UI service.
Close the browser window or browser tab that contains the preview.
Open the ZUI_##FLIGHT_O4 Service Binding. In the Entity Set and Association list on the right-hand side, first choose the Flight entry and then choose Preview....
On the Report List Page, verify that the buttons Create and Delete have disappeared.
Proceed as you have done in previous exercises.
Make sure that no more administrative fields are displayed on the Report List Page.
Proceed as you have done in previous exercises.
Verify that - apart from the Editing Status field - only two selection fields are visible at the top of the Report List Page. Test their functionality.
Hint
Be aware that the selection fields support the entry of multiple values and ranges.
Enter a value in the selection field Airline ID (for example: LH) and choose Go.
Repeat with other values.
For any data set, navigate to the Object Page. Verify that the Delete button has disappeared.
Proceed as you have done in previous exercises.
Make sure that no more administrative fields are displayed on the Object Page.
Proceed as you have done in previous exercises.
Verify that the Plane Type field is displayed after the Flight Date field and before the Flight Price field.
Proceed as you have done in previous exercises.
Switch to edit mode and verify that the value of the Plane Type field cannot be changed.
Proceed as you have done in previous exercises.