on 08-21-2018 12:53 PM
Hi experts,
We created many BRF+ formula expressions. In a custom program, users can choose one of them to calculate price. The requirement is when a BRF+ formular is selected, custom program should display operands in formular, which are parameters of BRF+ function. Then users will know the things they should input.
I know if it is an abap function or abap method, with RTTS I can get its parameters dynimacally. But how to get BRF+ function parameters by ID?
I have found a solution.
Class CL_FDT_CONTEXT has a private attribute, MT_NAME_VALUE. I found parameters in this attribute.
Create a class enhancement to add new method for this class,
methods GET_MT_NAME_VALUES
exporting
value(ET_NAME_VALUE) type HASHED TABLE .
Assign MT_NAME_VALUE to the exporting parameter,
METHOD get_mt_name_values .
et_name_value = me->mt_name_value.
ENDMETHOD.
Then call GET_MT_NAME_VALUES in the program,
TYPES:
BEGIN OF s_name_id_value,
id TYPE if_fdt_types=>id,
name TYPE abap_parmname,
data_object_type TYPE if_fdt_types=>data_object_type,
value TYPE REF TO data,
value_set TYPE abap_bool,
END OF s_name_id_value .
TYPES:
t_name_id_value TYPE HASHED TABLE OF s_name_id_value
WITH UNIQUE KEY name .
DATA: t_name TYPE t_name_id_value.
DATA(lo_fuction) = cl_fdt_factory=>if_fdt_factory~get_instance(
)->get_function( '005056A4CCA61ED8A8924F0F3F4F1D98' ).
*
DATA(lo_context) = CAST cl_fdt_context( lo_fuction->get_process_context( ) ).
lo_context->get_mt_name_values( IMPORTING et_name_value = t_name ).
That's all.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.