Skip to Content
0
Dec 02, 2011 at 01:47 PM

How to access data from datatype TYPE REF TO DATA?

18314 Views

Hello community,

I have a more general question.

In a method I get a parameter that is of type 'TYPE REF TO DATA'.

In this object, there is a list of fieldnames and its values (name-value-pair).

When I debug I see the name and the values.

I implemented following to access the data:

" Define local structure
  TYPES:
    BEGIN OF S_VALUE_PAIR,
      NAME TYPE ANY,
      VALUE TYPE ANY,
    END OF S_VALUE_PAIR.
  
  " Define local table type  
  TYPES T_VALUE_PAIR TYPE S_VALUE_PAIR.
  
    
  FIELD-SYMBOLS <fs_value_pair> TYPE T_VALUE_PAIR.
  
  " (!!) Type conflict  
  ASSIGN IS_DATA TO <fs_value_pair>.

The problem is, that the structure if the data in the parameter is unknown or dynamically created.

So how can I access the data in this case?

Thank you and BR, Christian