generics - How to use exporting parameter with type ANY -


i have incoming deep structure in recursive method contains structures , tables, i'm working rtti check type, loop on , operation, in case found specific component.

if current component structure or table, method calls itself.

problem: import structure type any. far good. , want export type also.

and here struggle.

how can assign edited deep structure export parameter ?


method process_input.  data: lo_type_descr   type ref cl_abap_typedescr,       lo_struct_descr type ref cl_abap_structdescr,       lv_comp_found   type abap_bool.  field-symbols: <fs_table>     type table,                <fs_value>     type any.  lo_type_descr ?= cl_abap_typedescr=>describe_by_data( p_data =  im_input  ).  if lo_type_descr->type_kind eq cl_abap_typedescr=>typekind_struct2 or    lo_type_descr->type_kind eq cl_abap_typedescr=>typekind_struct1.   lo_struct_descr ?= cl_abap_structdescr=>describe_by_data( p_data =  im_input  ).   loop @ lo_struct_descr->components assigning field-symbol(<fs_comp>).     assign component sy-tabix of structure  im_input  <fs_value>.     lo_type_descr ?= cl_abap_typedescr=>describe_by_data( p_data = <fs_value> ).     lv_comp_found = abap_false.      if  lo_type_descr->type_kind eq cl_abap_typedescr=>typekind_struct2 or         lo_type_descr->type_kind eq cl_abap_typedescr=>typekind_struct1  or         lo_type_descr->type_kind eq cl_abap_typedescr=>typekind_table.       process_input(         exporting           im_input    = <fs_value>           im_list = im_list       ).     else.       read table im_list data(element) key service_part = <fs_comp>-name binary search.       if sy-subrc eq 0.         <fs_value> = 'test :)'.       endif.     endif.   endloop. elseif lo_type_descr->type_kind eq cl_abap_typedescr=>typekind_table.   assign  im_input <fs_table>.   loop @ <fs_table> assigning field-symbol(<fs_tab_index>).     lo_struct_descr ?= cl_abap_structdescr=>describe_by_data( p_data = <fs_tab_index> ).     loop @ lo_struct_descr->components assigning <fs_comp>.       assign component sy-tabix of structure <fs_tab_index> <fs_value>.       lo_type_descr ?= cl_abap_typedescr=>describe_by_data( p_data = <fs_value> ).       lv_comp_found = abap_false.        if  lo_type_descr->type_kind eq cl_abap_typedescr=>typekind_struct2 or           lo_type_descr->type_kind eq cl_abap_typedescr=>typekind_struct1  or           lo_type_descr->type_kind eq cl_abap_typedescr=>typekind_table.          process_input(           exporting             im_input = <fs_value>             im_list  = im_list         ).       else.         read table im_list element key service_part = <fs_comp>-name binary search.         if sy-subrc eq 0.           <fs_value> = 'test :)'.         endif.       endif.     endloop.   endloop. endif. reference of im_input lv_cont. ex_input = im_input. endmethod. 

generic export parameters working beautifully:

class lcl definition.  public section.   methods: process_input importing im_input type                          exporting ex_input type any. endclass. 

so problem lies elsewhere.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -