Hi Francois,
What NW release are you on?
As of NW 703 there is a feature called "Code Template" in the function UI. In 702 there is a report (see transaction FDT_HELPERS where you can find it).
Sample code generated with the Code Template feature looks like this:
CONSTANTS:lv_function_id TYPE if_fdt_types=>id VALUE '00145EF433BE02DE819DC1A6A6E4106D'.
DATA:lv_timestamp TYPE timestamp,
lt_name_value TYPE abap_parmbind_tab,
ls_name_value TYPE abap_parmbind,
lr_data TYPE REF TO data,
lt_message TYPE if_fdt_types=>t_message,
lx_fdt TYPE REF TO cx_fdt,
lo_trace TYPE REF TO if_fdt_trace,
lo_lean_trace TYPE REF TO if_fdt_lean_trace,
la_item TYPE if_fdt_types=>element_text,
la_customer TYPE if_fdt_types=>element_text,
la_shelf_price TYPE if_fdt_types=>element_number,
la_promotion TYPE if_fdt_types=>element_text.
FIELD-SYMBOLS <la_any> TYPE any.
****************************************************************************************************
* All method calls within one processing cycle calling the same function must use the same timestamp.
* For subsequent calls of the same function, we recommend to use the same timestamp for all calls.
* This is to improve the system performance.
****************************************************************************************************
* If you are using structures or tables without DDIC binding, you have to declare the respective types
* by yourself. Insert the according data type at the respective source code line.
****************************************************************************************************
GET TIME STAMP FIELD lv_timestamp.
****************************************************************************************************
* Process a function and record trace data, passing context data objects via a name/value table.
****************************************************************************************************
* Prepare function processing:
****************************************************************************************************
ls_name_value-name = 'ITEM'.
la_ITEM = [INSERT CONTEXT VALUE HERE OR DELETE THE LINE].
GET REFERENCE OF la_ITEM INTO lr_data.
ls_name_value-value = lr_data.
INSERT ls_name_value INTO TABLE lt_name_value.
****************************************************************************************************
ls_name_value-name = 'CUSTOMER'.
la_CUSTOMER = [INSERT CONTEXT VALUE HERE OR DELETE THE LINE].
GET REFERENCE OF la_CUSTOMER INTO lr_data.
ls_name_value-value = lr_data.
INSERT ls_name_value INTO TABLE lt_name_value.
****************************************************************************************************
ls_name_value-name = 'SHELF_PRICE'.
la_SHELF_PRICE = [INSERT CONTEXT VALUE HERE OR DELETE THE LINE].
GET REFERENCE OF la_SHELF_PRICE INTO lr_data.
ls_name_value-value = lr_data.
INSERT ls_name_value INTO TABLE lt_name_value.
****************************************************************************************************
ls_name_value-name = 'PROMOTION'.
la_PROMOTION = [INSERT CONTEXT VALUE HERE OR DELETE THE LINE].
GET REFERENCE OF la_PROMOTION INTO lr_data.
ls_name_value-value = lr_data.
INSERT ls_name_value INTO TABLE lt_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_true
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
iv_trace_mode = if_fdt_constants=>gc_trace_mode_lean
"iv_trace_mode = if_fdt_constants=>gc_trace_mode_lean_required
IMPORTING ea_result = <la_any>
eo_trace = lo_trace
CHANGING ct_name_value = lt_name_value ).
lo_lean_trace ?= lo_trace.
lo_lean_trace->save( ).
CATCH cx_fdt into lx_fdt.
****************************************************************************************************
* You can check CX_FDT->MT_MESSAGE for error handling.
****************************************************************************************************
ENDTRY.
Regards,
Carsten