|
1 | 1 | # TOC
|
2 | 2 | [Home](../../readme.md#exercises)
|
3 |
| -# Adapt the generated code |
4 |
| - |
| 3 | +# Exercise 2: Adapt the generated code |
| 4 | +## Introduction |
5 | 5 | In this exercise we will perform changes to the generated code so that our application becomes usable.
|
6 | 6 |
|
7 |
| -- _Projection view_: |
| 7 | +- [_Projection view_](#projection-view): |
8 | 8 | Here we will add value help definitions for the currency code and quantity units.
|
9 | 9 |
|
10 |
| -- _Metadata extension file_: |
| 10 | +- [_Metadata extension file_](#metadata-extension-file): |
11 | 11 | Since we use built-in ABAP data types rather than data elements we have to add UI annotations to provide a label for the columns in the list view and the fields in the object page.
|
12 | 12 |
|
13 |
| -- _Behavior Definition_ and _Behavior Implementation_: |
| 13 | +- [_Behavior Definition_](#behavior-definition) and [_Behavior Implementation_](#behavior-implementation): |
14 | 14 | Here we will make the semantic key field **InventoryID** _read_only_ and we will add a determination to the behavior definition and implement the same in the behavior implementation clas so that the semantic key field **InventoryID** will be filled automatically.
|
15 | 15 |
|
16 | 16 | ## Projection view
|
| 17 | +[^Top of page](#toc) |
17 | 18 |
|
18 | 19 | In the source code of the projection view ````ZRAP620_C_INVENTORYTP_### ```` we will add two value help definitions for the fields ````QuantityUnit```` and ````CurrencyCode````.
|
19 | 20 |
|
@@ -58,6 +59,7 @@ define root view entity ZRAP620_C_INVENTORYTP_###
|
58 | 59 | </details>
|
59 | 60 |
|
60 | 61 | ## Metadata extension file
|
| 62 | +[^Top of page](#toc) |
61 | 63 |
|
62 | 64 | Open the metadata extension file ````ZRAP620_C_INVENTORYTP_### ````. Replace the complete source code with the following code snippet and use search and replace to change the placeholder ````###````.
|
63 | 65 |
|
@@ -207,6 +209,7 @@ annotate view ZRAP620_C_INVENTORYTP_### with
|
207 | 209 | </details>
|
208 | 210 |
|
209 | 211 | ## Behavior definition
|
| 212 | +[^Top of page](#toc) |
210 | 213 |
|
211 | 214 | Open the behavior defintion ````ZRAP620_R_INVENTORYTP_### ```` and add the field **InventoryID** to the list of fields that are marked as readonly and add a determination **CalculateInventoryID** for the field **InventoryID**.
|
212 | 215 |
|
@@ -262,6 +265,7 @@ determination CalculateInventoryID on save { create; }
|
262 | 265 | </details>
|
263 | 266 |
|
264 | 267 | ## Behavior implementation
|
| 268 | +[^Top of page](#toc) |
265 | 269 |
|
266 | 270 | The behavior implementation class ````ZRAP620_BP_INVENTORYTP_###```` is automatically opened with the tab **Local Types** for the local handler class ````lcl_handler```` .
|
267 | 271 | The quick fix has added a method ````CalculateInventoryID```` with an (empty) implementation for the determination that shall calculate the semantic key InventoryID.
|
@@ -323,7 +327,8 @@ ENDMETHOD.
|
323 | 327 | </details>
|
324 | 328 |
|
325 | 329 | # Test your changes
|
326 |
| - |
| 330 | +[^Top of page](#toc) |
| 331 | + |
327 | 332 | After having performed all the changes mentioned above we can use the SAP Fiori Elements preview in ADT to test our updated implementation.
|
328 | 333 |
|
329 | 334 | <details>
|
|
0 commit comments