cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a BRF+ function in SAP BW

Former Member
0 Kudos

Hallo Experts,

i ve used the following Routine code to consume the BRF+ Fuction in SAP BW transformation. I get an error message saying that the first input value(ZINDCOST) is not assigned even if I have assigned the same. Can anyone show me the error in the code of calling the BRF+ function?

Thanks in advance.

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,

           lv_zcosts TYPE  /BIC/AZBRFADSO00-/BIC/ZCOSTS,

           lx_fdt  TYPE REF TO cx_fdt.

     FIELD-SYMBOLS <ls_message>   TYPE if_fdt_types=>s_message.

     " Get BRFplus function

     lo_function = CL_FDT_FACTORY=>IF_FDT_FACTORY~GET_INSTANCE(

     )->GET_FUNCTION( IV_ID = '0050568D00701EE38F8457ED6EBDFBF3' ).

     TRY.

       " Set the BRFplus function context ( input variables )

         lo_context = lo_function->get_process_context( ).

         lo_context->set_value( iv_name = 'INDCOSTS_A'  ia_value =

         SOURCE_FIELDS-/BIC/ZINDCOST ).

         lo_context->set_value( iv_name = 'LABORCOSTS_A'  ia_value =

         SOURCE_FIELDS-/BIC/ZLABCOST ).

         " Process the BRFplus function

         lo_function->process( EXPORTING io_context = lo_context

                               IMPORTING eo_result = lo_result ).

         " Retrieve the BRFplus function result

         lo_result->get_value( IMPORTING ea_value = lv_zcosts ).

       CATCH cx_fdt INTO lx_fdt.

     ENDTRY.

     RESULT = lv_zcosts.

Accepted Solutions (0)

Answers (2)

Answers (2)

MGrob
Active Contributor
0 Kudos

Hi

Try to assign your SOURCE_FIELDS-/BIC/ZINDCOST ahead ot the try.

l_indcost= SOURCE_FIELDS-/BIC/ZLABCOST.

...

     TRY.

       " Set the BRFplus function context ( input variables )

         lo_context = lo_function->get_process_context( ).

         lo_context->set_value( iv_name = 'INDCOSTS_A'  ia_value = l_indcost ).

...

have a look here: http://abapdevblog.blogspot.ch/2012/10/calling-brfplus-function-from-abap.html

hope that helps

Martin

former_member182470
Active Contributor
0 Kudos

You can post this in ABAP development forum.