This is the second and final part of the blog
We continue completing the SQL statements to complete the exercise and test the solution.
If by any chance a rule is not in the right place, you move it up or down.
Now the rules are in the right execution order.
You can save. Also press Activate, which will give you the option of activating all referenced objects
Your Function is ready for testing.
To test out the Function, right-click on the function and choose.
Input a BP of somebody who is a Manager and select Show also Results of Intermediate Steps, the Run Simulation. You can also use the Import Test Data to import a file to test your Function.
The result shows that the entered BP is a Manager. The nice thing about the simulation is that you can see where in the processing a link was broken.
As you can see in PPOMA_CRM, the BP ending with 28 is a Manager. The Functon works fine.
Testing the function for BP ending with 44, the result is False. The BP is not a Manager.
Back in the function module, always using the Back to Workbench button, by expanding the Show More in the header, you get the Function ID, which is to be used when called in ABAP. That piece of information will be used in the next section.
That takes us to the final part of the blog.
2. How to call a BRFPlus function in an ABAP program. All the code below is standard, hence you need to define all the variables exactly as mentioned below. The only elements we provided are the ones in bold characters:
The BRFPlus unique identifier: 001E0BEA00C41EE39E93CE6349D5E0FC.
The BRFPlus Input Parameter name: BP_INPUT
The BRFPlus Input Parameter variable: lv_rfcrequestertype crmt_partner_no
The BRFPlus Output variable: lv_isteamlead type boolean.
You will need to add the code below to your ABAP program.
data: lo_factory type ref to if_fdt_factory,
lo_function type ref to if_fdt_function,
lo_context type ref to if_fdt_context,
lo_result type ref to if_fdt_result,
lv_result_string type string,
lx_fdt type ref to cx_fdt.
* Init BRFPlus
lo_factory = cl_fdt_factory=>if_fdt_factory~get_instance( ).
lo_function = lo_factory->get_function( iv_id = ‘001E0BEA00C41EE39E93CE6349D5E0FC‘ ).
lo_context = lo_function->get_process_context( ).
lo_context->set_value( iv_name = ‘BP_INPUT’ ia_value = lv_rfcrequester ).
lo_function->process( exporting io_context = lo_context
importing eo_result = lo_result ).
lo_result->get_value( importing ea_value = lv_isteamlead ).
catch cx_fdt into lx_fdt.
loop at lx_fdt->mt_message assigning <ls_message>.
write / <ls_message>–text.
* End of BRFPlus
Some bibliography for you.
1. BRFPlus – Business Rule management for ABAP Applications.
2. BRFPlus. There is this 1-2 days training in BRFplus you can get for free. Excellent material, well organized. There 3 sessions that tell you how that works.