Tasks: Create an own application (UI only) based on Custom Business Objects and Custom Catalog Extensions
Example: Manager wants to define bonus plans for employees.
Step 1: Creating the Custom Business Object “Bonus Plan”
Applications are based on business objects, therefore it all starts with creating a custom business object.
1. Start the Custom Business Object’s application by clicking its tile
2. Press the “New” action to start creation of a Custom Business Object
3. In the opening Pop Up fill in the Name. The other editable fields will get proposals automatically but can be changed.
4. Execute the “Create” action.
5. In the following view for editing the custom business object “Go to Fields and Logic” of the root node “Bonus Plan”
6. Create following fields
|field name||field properties||Tooltip|
|ID||Text of length 20, key field|
|Validity Start Date||Date|
|Validity End Date||Date|
|Low Bonus Assignment Factor||Number of length 4, decimals 2||Actual revenue must meet target more than that many times|
|High Bonus Assignment Factor||Number of length 4, decimals 2||Actual revenue must meet target more than that many times|
|Low Bonus Percentage||Quantity with Unit|
|High Bonus Percentage||Quantity with Unit|
|Is Consistent||Checkbox, Read Only|
|Employee ID||Text of length 12|
|Employee Name||Text of length 40|
The UI for maintaining fields looks as follows.
7. Go back via the application’s back button.
8. Check the System Administrative Data box to add standardized fields for “Created On”, “Created By”, “Last Changed On” and “Last Changed By”. These fields will be filled and updated automatically, so that you do not need to implement logic for this. Logic implementations for these fields even would be ignored.
9. Publish the Business Object “Bonus Plan”.
This creates the database persistence of the Business Object.
Step 2: Creating the UI for Custom Business Object Bonus Plan
To work with a business object you need a user interface. You will learn how to create that in this step.
1. Open the Bonus Plan in Custom Business Objects application. To be able to do changes to the lastly published version of the business object you need to start edit mode by executing the “Edit Draft” action.
2. Check the two boxes for UI Generation and Service Generation.
3. Publish the business object to trigger the generation of UIs (Master and Detail) and OData Service.
4. Now you make the UIs available as SAP Fiori Launchpad application by assigning it to a Business Catalog which corresponds to a group in Launchpad. From the Business Object’s structure view go to Custom Catalog Extension application by clicking the “Maintain Catalogs” action.
A new window will open.
5. Start adding a catalog with the “Add” action.
6. In the opening value help narrow down the result list by searching for “Extensibility”, select the Catalog with role ID “SAP_CORE_BC_EXT” and press “OK”.
7. Select the just added Catalog and publish it.
This step takes some minutes, the screen refreshes automatically and once the status switches from unpublished to published, you can close this application’s window and proceed.
8. Back in the Custom Business Object application’s window, go to the SAP Fiori Launchpad via Home action.
9. Refresh the Browser window with key F5 for that the catalog extension becomes visible.
Now there is the Bonus Plan application’s tile in the Extensibility group.
10. Open the application by clicking its tile.
Step 3: Testing
1. Open the Bonus Plan application.
2. Create an object.
3. Enter following data
|Validity Start Date||01/01/2016|
|Validity End Date||31/12/2016|
|Target Amount||1000.00 EUR|
|Low Bonus Assignment Factor||1|
|High Bonus Assignment Factor||3|
Employee ID <any> shall be the one of a sales person that created sales orders with a Net Amount of more than 3000.00 EUR in 2016 and that are completed.
4. Save the Bonus Plan. The UI will automatically return from Bonus Plan Detail to Master, where you can see one entry in the list of bonus plans now.
Step 4: Adapting the UI of Bonus Plans
As the generated UIs only list all fields of a business object node, adapting the UI is an important task.
1. Open the Bonus Plan application
2. Press “Go” to get the list of all Bonus Plans
3. Open a bonus plan’s detail view. This is the screen that will be adapted.
4. Open user settings via the corresponding application’s menu action
5. Open the adaptation mode.
6. By right clicking onto UI elements you get options to adapt the UI. As these options are partly type dependent you might need to find the right element first to get the option you need.
Hover over the “General Information” area until it gets another background color and open the context menu via right click.
7. Create a new UI group and name it “Bonus Data”.
8. Movable elements can be recognized by a changing background color and the movement cursor. Drag the Validity Start Date field.
9. Drop it to the Bonus Data group.
10. Repeat drag and drop into Bonus Data group for the fields:
- Validity End Date
- Target Amount
- Low Bonus Assignment Factor
- High Bonus Assignment Factor
- Low Bonus Percentage
- High Bonus Percentage
- Employee ID
- Employee Name
11. Publish the UI adaptations.
12. Finally you only need to exit adaptation mode to work with the new layout.