Part VI: Product@Bonus Plan
So far, we have created two applications. One to maintain employee specific Bonus Plans and a second to entitle bonuses for an employee. Until now the Bonus is only dependent on the net amount of completed sales orders.
Task: Reference standard business objects at custom business objects.
Example: At the Bonus Plan there shall be maintained products which are bonus relevant.
Having completed all preceding parts of SAP S/4HANA Extensibility Tutorial.
Step 1: Enhancing Bonus Plan’s structure
1. Start the Custom Business Object’s application by clicking its tile
2. Search for the Bonus Plan object and open its details by clicking its list item
3. Create a draft version to be able to do changes by executing “Edit Draft” action.
4. Create a new sub node by clicking the “New” action at the structure list
5. Name the sub node “Relevant Product”
6. Go to Fields and Logic of this new node.
7. Create following fields
|field name||field properties|
|Product ID||Text of length 20|
|Product Description||Text of length 255, read only|
8. Go back and publish.
This will enhance the persistence of bonus plans and their UI by a list of product IDs and description.
Step 2: Enhancing Bonus Plan’s logic
To fill the Description of relevant products, do following
1. Go to fields and Logic of the “Relevant Product” sub node
2. Enter the After Modification Event Logic
3. Implement following functionality:
Fill the product description
Hint: Use CDS view I_ProductDescription and filter with the current productid and language english.
SELECT i_productdescription~productdescription FROM i_productdescription INTO @relevantproduct-productdescription WHERE i_productdescription~product = @relevantproduct-productid AND i_productdescription~language = 'E'. ENDSELECT.
4. Publish the logic.
Step 3: Testing/ Creating Bonus Plan
1. Open the Bonus Plan application
2. Create a new Bonus Plan.
3. Enter following “General Information” > “General Information” data
4. Enter following “General Information” > “Bonus Data” 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|
|Low Bonus Percentage||10|
|High Bonus Percentage||20|
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. These sales orders shall also contain the product which got a Bonus Percentage in Step 1 of this tutorial part.
5. The new sub node “Relevant Product” of the custom business object leads to a new UI section with a table. Go to this section and execute the Add action. Enter your product from Step 1 of this tutorial part.
5. Save the Bonus Plan.