...
- Within JavaScript too it is easier to get/set data in the model. The data in the app at run-time has the same structure as represented in the FAB/ABAP Data Model Note only that it is in JSON format. Here we know of it more as the ‘Model’, and we can access it via standard JavaScript Code or more efficiently use the FAB delivered functions.
For example: getField(“Orders”) will retrieve the array of Orders
Here the first Order contains 2 OrderItems and the second as 3.
You can access the OrderItems of the a particular index using the syntax getField("Orders/0/OrderItems")
Copying Data Model from Another App
Copying a Structure/Table:
- Create a new Structure or Table in your new Application named exactly like the one you wish to copy.
- Provide the Application Name of the Source App in the Reference FAB Project property.
- Provide the Structure name of the structure you are copying in the Reference Node property.
- Right click the Structure and select Add Fields from FAB Reference Project.
- The fields will be copied from the Source App.
Copying an Entire Data Model (From the Root Node)
- Set the Reference FAB Project as the Application Name of the source Application
- Right click the Structure and select Add Fields from FAB Reference Project.
- The fields will be copied from the Source App.
Sample FAB Application
Upload this XML file in the FAB Workbench (TCODE /IQX/FAB) View file
Create a class in SE24 with the name YCL_ADAM_DEMO_DATA_MODEL. Once created, switch the Class in Source Code-Based mode by clicking on then copy and paste the code from the file below. Activate the class
YCL_ADAM_DEMO_DATA_MODEL
Related articles
Filter by label (Content by label) | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...