Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8430

Re: get element data throu Parameter or variable

$
0
0

Hi Tobias,

Please change your code as below

METHOD save_data .


  DATA xy_node TYPE string.

 

  DATA lo_nd_data TYPE REF TO if_wd_context_node.
  DATA lo_el_data TYPE REF TO if_wd_context_element.

  DATA lr_data TYPE REF TO data.

  FIELD-SYMBOLS: <fs_data> TYPE any.

 

 

  xy_node = table.

 

   TRANSLATE xy_node TO UPPER CASE.

 

  lo_nd_data = wd_context->get_child_node( name = xy_node ).
 
  "if lead index is not set, use index = 1
  lo_el_data = lo_nd_data->get_element( INDEX = 1 ).


  "  get all declared attributes
  lr_data = lo_el_data->get_static_attributes_ref( ).

  "return if data ref is not bound
  IF lr_data IS NOT BOUND.
    RETURN.
  ENDIF.

  ASSIGN lr_data->* TO <fs_data>.

  " return if field symbol is not assigned
  IF <fs_data> IS NOT ASSIGNED.
    return.
  ENDIF.

  CASE xy_node.
    WHEN 'BLUBB'.
      data ls_zblubb TYPE ZBLUBB.
      MOVE-CORRESPONDING <fs_data> to ls_zblubb.

      update ZBLUBB FROM ls_zblubb.
    WHEN 'BLAH'.

 

    WHEN OTHERS.
  ENDCASE.


ENDMETHOD.

Please note that this works as work area.. for reading data of type table, you need to change the code accordingly.


Viewing all articles
Browse latest Browse all 8430

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>