cancel
Showing results for 
Search instead for 
Did you mean: 

BRF+ Not Distinguishing between Log message type.

srinidhi_r1
Discoverer
0 Kudos
387

Hi Experts,

I have created an BRF+ application with rule to validate some condition and throw error message.

I have created a log message of type error.

But when simulating the function with this rule, I am getting only message, without any message type.

Also in the generated code, there is no logic to identify message type

Do you have any suggestion to make BRF+ show the message as error?

Accepted Solutions (0)

Answers (3)

Answers (3)

shwetars
Product and Topic Expert
Product and Topic Expert
0 Kudos

your design looks correct to me.. neither is there any error on the BRF+ side...

have u already tested calling it from another class... can u share results from that call?

srinidhi_r1
Discoverer
0 Kudos

REPORT ztest_brf_mdm01.

CONSTANTS:lv_function_id TYPE if_fdt_types=>id VALUE 'BC305BCE60AA1EDEA2D41D9517A18DA3'.
DATA:lv_timestamp TYPE timestamp,
lt_name_value TYPE abap_parmbind_tab,
ls_name_value TYPE abap_parmbind,
lr_data TYPE REF TO data,
lx_fdt TYPE REF TO cx_fdt,
la_brgew TYPE if_fdt_types=>element_quantity,
la_ntgew TYPE if_fdt_types=>element_quantity.
FIELD-SYMBOLS <la_any> TYPE any.
GET TIME STAMP FIELD lv_timestamp.
ls_name_value-name = 'BRGEW'.
la_BRGEW-number = '34'.
la_BRGEW-unit = 'KG'.
GET REFERENCE OF la_BRGEW INTO lr_data.
ls_name_value-value = lr_data.
INSERT ls_name_value INTO TABLE lt_name_value.
CLEAR ls_name_value.
****************************************************************************************************
* Let BRFplus convert your data into the type BRFplus requires:
* Data object is bound to a DDIC type, so you can improve performance by passing a variable of that type.
* If you pass a variable of this type, you should indicate this by passing "abap_true" for parameter "iv_has_ddic_binding".
****************************************************************************************************
ls_name_value-name = 'NTGEW'.
la_NTGEW-number = '67'.
la_NTGEW-unit = 'KG'.
GET REFERENCE OF la_NTGEW INTO lr_data.
ls_name_value-value = lr_data.
INSERT ls_name_value INTO TABLE lt_name_value.
CLEAR ls_name_value.
****************************************************************************************************
* Create the data to store the result value after processing the function
* You can skip the following call, if you already have
* a variable for the result. Please replace also the parameter
* EA_RESULT in the method call CL_FDT_FUNCTION_PROCESS=>PROCESS
* with the desired variable.
****************************************************************************************************
cl_fdt_function_process=>get_data_object_reference( EXPORTING iv_function_id = lv_function_id
iv_data_object = '_V_RESULT'
iv_timestamp = lv_timestamp
iv_trace_generation = abap_false
IMPORTING er_data = lr_data ).
ASSIGN lr_data->* TO <la_any>.
TRY.
cl_fdt_function_process=>process( EXPORTING iv_function_id = lv_function_id
iv_timestamp = lv_timestamp
IMPORTING ea_result = <la_any>
CHANGING ct_name_value = lt_name_value ).

CATCH cx_fdt INTO lx_fdt.

ENDTRY.

WRITE: <la_any>.

This is the code I used which I got from code template.
When checked in debugger, <la_any> is just storing the message id

and no exceptions are raised


shwetars
Product and Topic Expert
Product and Topic Expert
0 Kudos

can u paste the final snapshot from simulation result

srinidhi_r1
Discoverer
0 Kudos

This is when I execute and display processing step. If I click on that message, then it is showing the details

But I need it to raise an exception so that when I call this BRF+ from another class, I can show the error message

shwetars
Product and Topic Expert
Product and Topic Expert
0 Kudos

from your snapshot it looks when BAL_LOG_ADD_* FM is called message type is correctly passed as 'E'.

srinidhi_r1
Discoverer
0 Kudos

But while simulating why is it not showing error?