Thanks a lot for your help
However It did not work for me as it started giving error incompatible types
Here is my code
constants:lv_function_id type if_fdt_types=>id value '3440B5B078B21EE3BC9EB53C42F84A45'.
data:lv_timestamp type timestamp,
lt_name_value type abap_parmbind_tab,
ls_name_value type abap_parmbind,
lr_data type ref to data,
lv_counter type i value 0,
lr_target type ref to data,
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_z_string type if_fdt_types=>element_text,
lv_role_name type grac_role_name,
lv_result type string.
field-symbols <la_any> type any.
field-symbols <role_name> type grac_s_od_role_detail.
field-symbols <system> type string.
types:
begin of ys_access ,
role_name type string,
system_name type string,
end of ys_access .
types:
yt_access type table of ys_access .
field-symbols: <access_item> type table,
<ls_req_access> type ys_access.
data con_name type if_fdt_types=>element_text.
data ls_any type ys_access.
****************************************************************************************************
* 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 = 'Z_STRING'.
la_z_string = 'P1'.
get reference of la_z_string 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.
****************************************************************************************************
* Get context values after processing:
cl_fdt_function_process=>get_context_value( exporting iv_function_id = lv_function_id
iv_trace_generation = abap_true
iv_timestamp = lv_timestamp:
iv_data_object = '3440B5B078B21EE3BC9EFF599C110ADD' "Z_STRING
importing ev_data = lv_result ). " Suggested variable: la_z_string
create data lr_target type grac_s_od_role_detail.
* assign <la_any> to <role_name>.
assign lr_target->* to <la_any>.
loop at lt_name_value into ls_name_value.
if ls_name_value-name cs 'RESULT'.
assign ls_name_value-value to <la_any>.
ls_any = ls_name_value-value .
endif.
endloop.
access_item = <la_any>.
* assign ( )<la_any> to <access_item>.
* assign component 1 of structure <la_any> to <rolename>.
* assign <la_any> to <ls_req_access>.
* lr_target = <la_any>.
* assign lr_target->* to <role_name>.
* lv_role_name = <role_name>.
lv_result = lv_result.