Documente Academic
Documente Profesional
Documente Cultură
The documentation may have changed since you downloaded the PDF. You can always find the latest information on SAP Help Portal.
Note
This PDF document contains the selected topic and its subtopics (max. 150) in the selected structure. Subtopics from other structures are not included.
2014 SAP AG or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose
without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG
and its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials are provided by
SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be
liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express
warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. SAP and other
SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other
countries. Please see www.sap.com/corporate-en/legal/copyright/index.epx#trademark for additional trademark information and notices.
Table of content
PUBLIC
2014 SAP AG or an SAP affiliate company. All rights reserved.
Page 1 of 7
Table of content
1 Building a Tax Calculation Application
1.1 Creating an Application
1.2 Creating a Function
1.3 Creating Formula Expressions
1.4 Creating Value Range Expressions
1.5 Adding Values to the Decision Tree Expression
1.6 Simulating the Function
PUBLIC
2014 SAP AG or an SAP affiliate company. All rights reserved.
Page 2 of 7
Prerequisites
You have a basic knowledge of BRFplus.
Procedure
The tutorial consists of the following steps:
1.
2.
3.
4.
5.
6.
Creating an Application
Creating a Function
Creating Formula Expressions
Creating Value Range Expressions
Adding Values to a Decision Tree Expression
Simulating the Function
Next Step
Creating an Application
Result
Your application is created.
Next Step
Creating a Function
Procedure
1. Create a Function
1. In the Object Manager panel of the application that you just have created, under the Detail section, choose the Contained Objects tab.
The Contained Objects tab page appears.
2. Choose Function from the Type field and choose Create Object .
3. In the Object Creation dialog box that appears, enter Tax_Calculator in the Name field and choose Create and navigate to object .
The function is created and opens in the Object Manager panel.
2. Assign Top Expression to the Function
1. Under the Detail section on the Properties tab of the new application, select Functional Mode as Mode .
The Top Expression field appears.
2. Choose next to the Top Expression field.
3. In the context menu, choose Create ... .
4. In the Object Creation dialog box that appears, choose Decision Tree in the Type field and enter Tax_Calculation in the Name field.
5. Choose Create .
Top expression Tax_Calculation is now assigned to the Tax_Calculator function.
3. Assign Context Data Object to the Function
1. Under the Detail section, choose the Signature tab.
The Signature tab page opens.
PUBLIC
2014 SAP AG or an SAP affiliate company. All rights reserved.
Page 3 of 7
Procedure
1. To create the formula expression, you have to navigate to the application in the Object Manager panel. To do so, choose the Back button. (You could as
well choose the application from the Recently Used list.)
2. Under the Detail section, choose the Contained Objects tab.
The Contained Objects tab page opens.
3. Choose Expression from the Type field and choose Create Object .
4. In the Object Creation dialog that appears, choose Formula from the Type field.
5. Enter Calculate_tax_for_low_salary in the Name field.
6. Enter Amount to be paid in the Short Text field.
7. Choose Create and navigate to object .
You are navigated to the formula builder page.
PUBLIC
2014 SAP AG or an SAP affiliate company. All rights reserved.
Page 4 of 7
Calculate_Tax_for_med_salary
Payable_Tax_Amount
Calculate_Tax_for_high_salary
Payable_Tax_Amount
Formula
(25000 EUR * 0.1) + (Gross_Salary - 25000
EUR) * 0.2
(25000 EUR * 0.1) + (75000 EUR * 0.2) +
(Gross_Salary - 100000 EUR * 0.3)
Note
When you look at the fomulas in Expert Mode , amounts will be displayed, for example, as 25000$EUR. Don't let yourself get confused by the "$EUR" part.
The salary currency is Euro (currency code EUR), while the $ sign is inserted automatically by the system as an internal separator between the number and
the currency part of the amount. This is needed for the formula to be properly parsed by the system. If the currency in the example was US Dollars, the
formula editor would display this as $USD in Expert Mode .
Next Step
Creating Value Range Expressions
Note
It is sufficient to define only the ranges for low and medium incomes. This is because the structure of the decision tree makes it possible to implicitly define the
high income range as the negative branch for the tests against the two other ranges. The decision tree will then illustrate the simple logical thought that if a
given income is neither low nor medium, it can only be high.
Procedure
1. In the Object Manager panel, under Detail section, choose Contained Objects tab.
The Contained Objects tab page opens.
2. Choose Expression from the Type field and choose Create Object .
3. In the Object Creation dialog box that appears, choose Value Range in the Type field.
4. Enter Gross_Salary_is_low in the Name field and choose Create and navigate to object button.
The value range expression appears in the Object Manager panel.
5. Define the incoming parameter by choosing .
6. In the context menu, choose Other Context Parameter... .
7. In the Context Query dialog box that appears, select the GROSS_SALARY data object.
The data object is added as the incoming parameter for the value range expression.
PUBLIC
2014 SAP AG or an SAP affiliate company. All rights reserved.
Page 5 of 7
Incoming Parameter
Values
Gross_Salary_is_Medium
Next Step
Adding Values to the Decision Tree Expression
Procedure
1. In the Object Manager panel of the application, under the Detail section, choose the Contained Objects tab.
2. In the Contained Objects tab page, choose type Function and select TAX_CALCULATOR .
The TAX_CALCULATOR function opens in the Object Manager panel.
3. Choose TAX_CALCULATION expression in the Top Expression field.
The decision tree opens in the Object Manager panel.
6. Add conditions and results to the child node. For the first condition, a positive result indicates that the income in question falls into the range of low income.
PUBLIC
2014 SAP AG or an SAP affiliate company. All rights reserved.
Page 6 of 7
Because of that, we have to assign the corresponding tax calculation formula for low income to that child node:
1. In the context menu of the positive child node, choose
Set Result...
CALCULATE_TAX_FOR_LOW_SALARY .
The expression is added as the result of the child node.
2. In the context menu of the negative child node, we have still to decide if the income in question is medium or high. To model this decision, choose
Set Condition...
GROSS_SALARY_IS_MEDIUM .
The expression is added as the condition of the child node.
3. Similarly, add the following expressions as results to the decision tree.
CALCULATE_TAX_FOR_MED_SALARY
CALCULATE_TAX_FOR_HIGH_SALARY
Vorgehensweise
1. Activate the Tax Calculator function if it is still inactive.
Note
Simulating a function is only possible if the function to be run in simulation mode is active.
2. In the Object Manager panel, choose Start Simulation .
3. In the Simulation dialog box that appears, enter 35000 in the Gross Salary field and EUR in the Currency field.
4. Under Simulation Mode section, choose Show only Result and choose Run Simulation .
The amount to be paid as tax for the gross salary appears under the Result section. For a gross salary of 35000 Euros, the business rule calculates a tax
amount of 4500 Euros.
PUBLIC
2014 SAP AG or an SAP affiliate company. All rights reserved.
Page 7 of 7