on 02-03-2014 6:23 AM
Hi Experts,
I have created few functions in BRFplus and added code in ABAP for calling them.
At the first run output comes properly, but in case i make any change in the ABAP code then output is not coming as expected,
then everytime i have to go to BRFplus function , i have to make some change there and re-activate it.
Then output can be seen in ABAP.
Kindly let me know what is the solution for this problem.
Regards ,
Khushbu
Whenever you execute a BRF+ function the context values are changed. What I suspect here is the previous buffers were not cleared during the execution second time which may result in wrong output. Whenever you make any change to the function in brf+ workbench it triggers generation of new abap class and it invalidates the previous buffer. That could be the reason for you to get right results after a change. Please implement the note 1912092 which should solve this issue. If it doesn't then I would advice you to open a customer message with SAP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anbusivam,
yes i got your point,but can you look at below code.Its happening when my output is table type.Its working perfect for single output from BRFplus.
It could be because of underlined command .I am creating w_t as of my Z table at run time.
can you suggest.
c_id contains function id.
DATA: ls_plant TYPE if_fdt_types=>element_text,
ls_lgnum TYPE i,
ls_mat TYPE if_fdt_types=>element_text,
ls_us TYPE if_fdt_types=>element_text,
ls_cntrl TYPE if_fdt_types=>element_text,
ls_res TYPE if_fdt_types=>element_text,
w_t TYPE REF TO data,
dref_tab LIKE TABLE OF w_t.
TRY.
CLEAR : lo_context,
lo_function,
lo_result.
MOVE: '000000000082084596' TO ls_mat,
'1706' TO ls_plant,
'X' TO ls_us,
'X' TO ls_cntrl.
*"GET BRFPlus Function
lo_function ?=
cl_fdt_factory=>if_fdt_factory~get_instance( )->get_function('c_id').
*" set BRFlus function context(Input variable)
lo_context = lo_function->get_process_context( ).
lo_context->set_value( iv_name = 'MATNR' ia_value = ls_mat ).
lo_context->set_value( iv_name = 'WERKS' ia_value = ls_plant ).
lo_context->set_value( iv_name = 'ZPROD_US' ia_value = ls_us ).
lo_context->set_value( iv_name = 'ZCONTROL' ia_value = ls_cntrl ).
* " Process the BRFplus function
lo_function->process( EXPORTING io_context = lo_context
IMPORTING eo_result = lo_result ).
CREATE DATA w_t TYPE STANDARD TABLE OF zctdg.
ASSIGN w_t->* TO <d_ref>.
lo_result->get_value( IMPORTING er_value = w_t ).
lo_result->get_value( IMPORTING ea_value = <d_ref> ).
CATCH cx_fdt INTO lx_fdt.
ENDTRY.
Hi Anbusivam,
yes its giving correct output for the same code ,
but if i leave code and run it on another day then i cannot see value in the object w_t.
Can you directly tell me how to resolve the buffering issue for this , implementing note can take time as i haven't done it before.
Cant i add some command?
Hi Anbusivam,
I have raised request for implementing note , as it needs appoval.Meanwhile i would like to ask one question.The issue is happening only ofr the BRFfunctions those are having result object as table.
For the below BRF+ Funtion , i never face this issue. This function is having single element in Result object.
C_id contain functions id.
TRY.
*"GET BRFPlus Function
lo_function ?=
cl_fdt_factory=>if_fdt_factory~get_instance( )->get_function('c_id').
*" set BRFlus function context(Input variable)
lo_context = lo_function->get_process_context( ).
lo_context->set_value( iv_name = 'MAIL_ID' ia_value = ls_mail).
* " Process the BRFplus function
lo_function->process( EXPORTING io_context = lo_context
IMPORTING eo_result = lo_result ).
lo_result->get_value( IMPORTING ea_value = ls_lgnum ).
IF ls_lgnum EQ 1.
COMMIT WORK.
ENDIF.
CATCH cx_fdt INTO lx_fdt.
ENDTRY.
Can you explain why it is so?
Regards,
Khushbu
Exact reason can be found only by debugging. You may debug your code once to know how the values are returned from the function by adding a breakpoint in the generated code while executing second time with table type result. You can get the generated code from report FDT_GENERATION_TOOL. You can get the abap class that is generated by providing function id & selecting display single function option. Add a breakpoint inside PROCESS_PURE method which will contain the exact coding for the rules you modeled. This will give exact idea where the issue lies. You may also step into lo_result->get_value.
Hi Experts
As suggested by you we have implemented SAP note 1912092 in our box but still our issue is not resolved.
Issue is:
We have many BRFplus functions with the output as a table
----------------------------------------------------------------------------
Function 1.
Input parameters: Matnr (element)
Mat_grp_check (element(boolean))
Statm (element)
Werks (element)
Ouptut: Z_ZCTDE (table)
---------------------------------------------------------------------------
Now i have called this function in ABAP as below
-----------------------------------------------------------------------------
DATA: lo_function TYPE REF TO if_fdt_function,
lo_context TYPE REF TO if_fdt_context,
lo_result TYPE REF TO if_fdt_result,
e_wa_dref TYPE REF TO data,
lx_fdt TYPE REF TO cx_fdt.
DATA: lo_message TYPE REF TO cx_fdt.
FIELD-SYMBOLS: <fs_any> TYPE any,
<fs_is_final> TYPE STANDARD TABLE,
<fs_message> TYPE if_fdt_types=>s_message.
DATA: ls_werks TYPE if_fdt_types=>element_text,
ls_matnr TYPE if_fdt_types=>element_text,
ls_statm TYPE if_fdt_types=>element_text,
ls_grp TYPE if_fdt_types=>element_boolean,
w_t TYPE REF TO data.
FIELD-SYMBOLS : <d_ref> TYPE ANY TABLE,
<d_ref1> TYPE zctde.
CLEAR : ls_werks,
ls_matnr,
ls_statm,
ls_grp.
MOVE : inp_data-werks TO ls_werks,
inp_data-matnr TO ls_matnr,
'X' TO ls_statm.
TRY.
*"GET BRFPlus Function
lo_function ?= cl_fdt_factory=>if_fdt_factory~get_instance( )->get_function('001E0B8362C21ED39FCE26B763418104').
*" set BRFlus function context(Input variable)
lo_context = lo_function->get_process_context( ).
lo_context->set_value( iv_name = 'MATNR' ia_value = ls_matnr ).
lo_context->set_value( iv_name = 'STATM' ia_value = ls_statm ).
lo_context->set_value( iv_name = 'WERKS' ia_value = ls_werks ).
* " Process the BRFplus function
lo_function->process( EXPORTING io_context = lo_context
IMPORTING eo_result = lo_result ).
CREATE DATA w_t TYPE STANDARD TABLE OF zctde.
ASSIGN w_t->* TO <d_ref>.
lo_result->get_value( IMPORTING er_value = w_t ).
lo_result->get_value( IMPORTING ea_value = <d_ref> ).
CATCH cx_fdt INTO lx_fdt.
ENDTRY.
lo_function ?= cl_fdt_factory=>if_fdt_factory~get_instance( )->get_function('001E0B8362C21ED39FCE26B763418104').
*" set BRFlus function context(Input variable)
lo_context = lo_function->get_process_context( ).
lo_context->set_value( iv_name = 'MATNR' ia_value = ls_matnr ).
lo_context->set_value( iv_name = 'STATM' ia_value = ls_statm ).
lo_context->set_value( iv_name = 'WERKS' ia_value = ls_werks ).
* " Process the BRFplus function
lo_function->process( EXPORTING io_context = lo_context
IMPORTING eo_result = lo_result ).
CREATE DATA w_t TYPE STANDARD TABLE OF zctde.
ASSIGN w_t->* TO <d_ref>.
lo_result->get_value( IMPORTING er_value = w_t ).
lo_result->get_value( IMPORTING ea_value = <d_ref> ).
CATCH cx_fdt INTO lx_fdt.
ENDTRY.
------------------------------------------------------------------------------------------
Now what is happening , the moment i created the BRF function and added the code and executed the porgram then after the execution of RED highlighted statement , one entry is coming in W_T
I have attached the screenshot of the debugger with the name sucess_run.
But in case i create some other function or test some other function in BRF or i execute the program on next day or after few hours , then the output does not come in the table.
I have noticed one more thing that there is a tab of CODE GERENATION, and it gets cleared whenever i make any change in the function.
For example i have another function and coded in the same way as mentioned above , for that this code generation tab is filled and screensot is attached.
And while i execute this function i could not see any output. but the moment i go and make any change in the BRF function , i can see the output and this tab also get cleared.
And in some cases previous function get stopped working and the recently changed function only gives the output.
Kindly suggest what is the solution for this problem as the note is already implemented.
Regards,
Khushbu Agarwal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Khushbu,
This should not happen. Can you elaborate on exactly what are you changing in code and what output is not coming properly after making that change? Also, what is the expected output that you get only for the 1st time (before changing the code) ?
Thanks,
Anindya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.