on 09-15-2015 4:38 PM
Hello Community,
I'm having some problems with my brf+ function.
My function takes two Data Objects as input and processes some rules. The rules check if the input data have the right values and then calls a formula. The function should then provide the result of this calculation in the result data object.
Here the Context:
By simulating my function the rules and calculation work proper, but I get the following result in the end:
Why is my function not returning the value of ZRESULT and instead returning the value of my input data MAXVALUE?
I'm calling the function from abap with the following LoC and want to retrieve the calculated result:
TRY .
* Get BRFplus function
lo_fuction ?= cl_fdt_factory=>if_fdt_factory~get_instance( )->get_function( 'XXXXXXXXXXX' ).
lo_context = lo_fuction->get_process_context( ).
lo_context->set_value( iv_name = 'MAXVALUE' ia_value = norm_rel_val ).
lo_context->set_value( iv_name = 'WEIGHTEDRELEVANCE' ia_value = norm_rel_ovd ).
lo_fuction->process( EXPORTING io_context = lo_context
IMPORTING eo_result = lo_result ).
lo_result->get_value( IMPORTING ea_value = calc_result ).
WRITE calc_result.
CATCH cx_fdt INTO lo_message.
ENDTRY.
Do you have any hints, why my function does not return the result of the calculation? And am I retrieving the result from the function right with this code?
Thanks & Regards,
Dominik
Hi,
concerning your result in simulation mode: Can you check the results displayed in the upper part of the simulation mode screen (section above the section "processing steps"). There you should see your result data ZRESULT with the value you calculated as according to your screenshot all values are set corrrectly,
Concerning the mapping of your result data object: Do you do some manipulation of the object in the ruleset after callling the formula expression?
Concerning the call in ABAP: Please use the code template that you can create in the BRFplus workbench on function level -> Detail section -> Create Code Template
Your call is an old way to call a function and has performance drawbacks
Hope that helps
Cheers
Christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Christian,
Im not manipuliating any Data Objects in this example. The rulesets checks if one of the input Data Objects are not initial and sets them to 0 if they are. In this example their values are 0,001089 and 1, so nothing will be changed before the calculation. Rule for changing the ZRESULT Data Object is:
IF ZRESULT is initial
THEN Change ZRESULT after processing RELEVANCE_CALCULATION
After executing this rule the function returns without any changes.
I also used the debugger to have a look at which points the values are changed. Every Rule and Calculation works proper, exept the last step when returning the function. The function changes its value to the input-value although the Result Data Object has the right value.
Thanks for the hint with the creation of code templates, but in my Details-section there are only the Simulation und Debugger Buttons.
-EDIT- Found it. Had to change to expert mode. Thanks again!
Regards,
Dominik
Hi Dominik,
for the code template button you have to change the personalization and switch to "Expert mode". You are running in "simple mode" and the button is not visible.
Concerning the result value: the screenshot you attached shows the right value in the result data object:
So the workbench/simulation itself shows the right results. I would therefore say that the problem is in your ABAP code and this should be solved when using the code delivered by the code template.
BR
Christian
User | Count |
---|---|
77 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.