Skip to Content

Introduction –

BRFplus is a webdynpro application delivered by SAP from Netweaver 7.0 onwards and it brings a new way to design and develop business rules outside from ABAP program. In the following section, I am giving a sample scenario and I will demonstrate how I have used BRFplus to implement that business rule.

Scenario –

We are planning to calculate customer price differently for low-quantity metal trades i.e. 0 to 50 ozt. So the condition will be:

If quantity = 0 to 50, unit = OZT, and Metal = Gold, Silver, Platinum, Palladium then customer price = Quote price * 1.10

Otherwise, quantity = 0 to 50, unit = OZT, and Metal = Rhodium, Ruthenium, Iridium, the customer price = Quote Price * 1.70.

Solution –

   1. Execute transaction code BRFPLUS once logged in to SAP.

   2. This will open up a web page that looks like following. First we need to create an application if not created already. This can be done by going to the repository tab in the navigation panel and clicking on the button ‘Create Application’ or from the Workbench menu.

/wp-content/uploads/2015/09/brfplus1_794576.png

   3. Next step would be to create a function and this can be achieved by right clicking on the application and choose function like the following –

/wp-content/uploads/2015/09/crt_func_794577.png

   4. The signature of the function is developed by creating 3 elements viz. metal, quote price in ounce and quantity in unit OZT and the result data object will be the customer price.

/wp-content/uploads/2015/09/crt_func2_794578.png

   5. Next, ruleset needs to be assigned to the function. Please click ‘Assigned Rulesets’ tab in the screenshot above and click on the ‘create ruleset’ button.            Give a name to the new ruleset and you will get the following screen.

/wp-content/uploads/2015/09/ruleset_794585.png

    6. Now create a decision table by right clicking on the TMS_PM application and choose the following context menu.

  /wp-content/uploads/2015/09/decision_table_794586.png

  7. Create the following condition column and result column details in the decision table –

/wp-content/uploads/2015/09/decision_table_settings_794587.png

8. Besides, create the following context variable from the context variable already created inside the function CALCULATE_CUSTOMER_PRICE in step 3.         This will be used in the decision table –

/wp-content/uploads/2015/09/decision_table_context_794588.png

9. After the decision table has been created, create the following entries in the decision table like the following screen shot –

/wp-content/uploads/2015/09/decision_table_content_794589.png

10. Now go to the Repository and expand the ruleset and click on the ruleset Automatic Customer Price.

/wp-content/uploads/2015/09/ruleset_navigate_794590.png

11. Click on Insert Rule button in the bottom left corner of the screen and you need to enter the context value(CUSTOMER_PRICE) and decision table(DTAB_CUST_PRICE) created earlier and finally it will look like below –

/wp-content/uploads/2015/09/new_rule_794591.png

12. That completes the BRF rule creation for this requirement. Now we need to call the rule from ABAP program. BRF function can be called from ABAP program and the code can be generated from report FDT_TEMPLATE_FUNCTION_PROCESS. You need to get the id of the BRF function which can be found as ID in the general tab which is shown below –

/wp-content/uploads/2015/09/function_794592.png

13. Copy the ID and then execute report FDT_TEMPLATE_FUNCTION_PROCESS and in the selection screen paste the ID to the function id parameter field and execute. This will provide the template code ready to be used –

/wp-content/uploads/2015/09/gen_template_794593.png

14. The code is pasted in a FM and the context variables are replaced by importing/exporting parameter values of the function module and then activated.

Test –

  1. Passing metal = AU, quantity = 10 OZT, Quote price = 100 USD and the output comes 110 USD

/wp-content/uploads/2015/09/fm_result2_794594.png

2. Passing metal = IR, quantity = 10 OZT, Quote price = 100 USD and the output comes 170 USD.

/wp-content/uploads/2015/09/fm_result_794595.png

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply