Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

Creating a Sample BRFPlus Application

Creating BRF Application For Calculation of Tax based on the Gross Salary

Flow Chart

1) Goto Tcode = BRFPLUS or BRF+ (BRFPlus Workbench)

2) Goto Context Menu and Create an BRF Application

3) Fill the details and choose Storage type

The following table summarizes how the storage type of an application affects the usage of
objects that belong to it:
Storage
Type

Client

Transport

Cross-Application Usage

System

clientindependent

transportable or
local

Can use system objects.

Customizing clientdependent

transportable or
local

Can use system and customizing objects.

Master Data clientdependent

local

Can use system, customizing, and master data


objects.

4) Goto Contained Objets Tab of the created appliaction,


Choose Type as Function and Create object

5) Enter funtion Name and Description

6) Under Properties tab Choose Mode : Functional Mode


Assign Top Expression : Create

7) Choose Decision Tree in Type


Enter Name and description

8) Goto Signature tab of the function and click Add New Data Objext

9) Choose Element in Type


Choose Amount in Element Type

10) In the Signature tab


for the Result data object Choose Create

11) Choose Element in Type


Choose Amount in Element Type

12) Click on the Created Application


goto Contained Objects tab, Choose Expression in Type, Formula in Expression Type

13) Enter Details

14) In the Result Data Object Choose Select


Choose ELE_PAYABLE_TAX_AMOUNT

15) Right Click in the Context and In the Insert Data object choose Select
Choose ELE_GROSS_SALARY

16) Press the * and then click on the Number button and enter 0.1
Save the Formula

Create the following formula expressions for the mid and high salary segments using the above
procedure.
Name of the Formula Expression Result Data Object

Formula

(25000 INR * 0.1) +


Fr_Calculate_Tax_for_med_salary ELE_Payable_Tax_Amount (Gross_Salary - 25000 INR) *
0.2
(25000 INR * 0.1) + (75000
Fr_Calculate_Tax_for_high_salary ELE_Payable_Tax_Amount INR * 0.2) + ((Gross_Salary 100000 INR) * 0.3)

Repeat Steps from 12 to 16 using above Information

17) Choose Contained objects tab, Choose Expression in Type and Value Range in Expression Type

18) Fill in the Details

19) Click on Set an incoming parameter and Choose ELE_GROSS_SALARY

20) Create Condition as Shown below

Create the following value range expression using the above procedure. Using steps 17 - 20
Name of the Value Range
Expression

Incoming Parameter

Vr_Gross_Salary_is_Medium

Choose value range as is less


Choose ELE_GROSS_SALARY data than
object.
Amount 100000 and INR as
the currency.

Values

21) Goto the Decision tree created before, Choose ELE_PAYABLE_TAX_AMOUNT as Result Data
Object, also Right Click on the Decision Tree choose Set Condition -> VR_GROSS_SALARY_IS_LOW

22) In the True Part assign FR_CALCULATE_TAX_FOR_LOW_SAL,


In the False Part Set Condition VR_GROSS_SALARY_IS_MEDIUM.

In the false Part Set Condition VR_GROSS_SALARY_IS_MEDIUM

In the True Part assign as shown below.

In the False Part assign as shown below.

Save and Activate all the Objects in the Application and the Application itself.
Note : Active Objects are indicated by the Green Icon besides the name of the object.

Now goto the function and Click on start Simulation,


i).Enter Amount Less than 25000 INR and Execute, we can see the Calculated Tax Amount
ii).Enter Amount Less than 100000 INR and Execute, we can see the Calculated Tax Amount
iii).Enter Amount Greater than 100000 INR and Execute, we can see the Calculated Tax Amount

Calling a BRFPlus Application from a program

Choose the Function Created, Open the General Screen, General tab and Copy the ID of the
Function, Paste this ID in the program, as shown below

REPORTzrp_calulate_tax_brf.

PARAMETERS:p_g_salTYPEnumc10.
DATA:lr_fuctionTYPEREFTOif_fdt_function,
lr_contextTYPEREFTOif_fdt_context,
lr_resultTYPEREFTOif_fdt_result,
lr_traceTYPEREFTOif_fdt_trace.
DATA:lr_messageTYPEREFTOcx_fdt.
DATA:ls_taxTYPEif_fdt_types=>element_amount,
ls_salaryTYPEif_fdt_types=>element_amount,
lt_tabnameTYPEtabname.
START-OF-SELECTION.
CLEAR:ls_tax.
ls_salary-number=p_g_sal.
ls_salary-currency='INR'.
TRY.
"GetBRFplusfunction
lr_fuction?=cl_fdt_factory=>if_fdt_factory~get_instance()>get_function('7427EA0D6A3B1ED3989AE1F2F7ECEC45').
"SettheBRFplusfunctioncontext(inputvariables)
lr_context=lr_fuction->get_process_context().
lr_context->set_value(iv_name='ELE_GROSS_SALARY'ia_value=ls_salary).
"ProcesstheBRFplusfunction
lr_fuction->process(
EXPORTING
io_context=lr_context"FDT:Context
iv_trace_mode='T'"TraceMode
IMPORTING
eo_result=lr_result"FDT:Result
eo_trace=lr_trace"FDT:Trace
).
lt_tabname=lr_trace->get_trace_db_table().
"RetrievetheBRFplusfunctionresult
lr_result->get_value(IMPORTINGea_value=ls_tax).
WRITEls_tax-number.
WRITEls_tax-currency.
ENDTRY.

You might also like