<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Accessing Data References in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/accessing-data-references/m-p/4815645#M1127063</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Jus check the below logic. This will help you out..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols &amp;lt;fs&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data dref type ref to data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data value1 type i value 1234.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get reference of value1 into dref.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign dref-&amp;gt;* to &amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write &amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Hakim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Abdul Hakim on Dec 2, 2008 5:42 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Dec 2008 10:41:59 GMT</pubDate>
    <dc:creator>abdul_hakim</dc:creator>
    <dc:date>2008-12-02T10:41:59Z</dc:date>
    <item>
      <title>Accessing Data References</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/accessing-data-references/m-p/4815644#M1127062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I' ve got a function with a changing-parameter typed as follows: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ch_r_data type ref to data&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my function I' m trying to assign either a string or a integer to this data reference - depending on some logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunatly, it' s not possilbe to directly assign a value to a generic typed data reference with&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ch_r_data-&amp;gt;* = 123.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; or &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ch_r_data-&amp;gt;* = 'abc'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anybody got an idea how to tackle that problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2008 10:34:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/accessing-data-references/m-p/4815644#M1127062</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-02T10:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Data References</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/accessing-data-references/m-p/4815645#M1127063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Jus check the below logic. This will help you out..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols &amp;lt;fs&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data dref type ref to data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data value1 type i value 1234.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get reference of value1 into dref.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign dref-&amp;gt;* to &amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write &amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Hakim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Abdul Hakim on Dec 2, 2008 5:42 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2008 10:41:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/accessing-data-references/m-p/4815645#M1127063</guid>
      <dc:creator>abdul_hakim</dc:creator>
      <dc:date>2008-12-02T10:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Data References</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/accessing-data-references/m-p/4815646#M1127064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Hakim!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for answer. To be honest, that' s not exactly what I meant. Let me explain the problem with an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types: begin of t_dtype,
              dtype type string,
              dref type ref to data,
           end of t_dtype.

class a definition.
  public section.
    methods: get_ref changing ch_r_data type t_dtype.
endclass.

class a implementation.
  method get_ref.
    if ch_r_data-dtype = 'string'.
      get reference of 'abc' into ch_r_data-dref.
      "  Won' t work cause 'abc' is gone when method is finished
      ch_r_data-dref-&amp;gt;* = 'abc'.
      " Compile error - can' t dereference generic type.
      field-symbols: &amp;lt;fs_data&amp;gt; type string.
      " what now?
    elseif ch_r_data-dtype = 'int'. 
      " Same problem
    endif.    
endmethod.

class b definition.
   public section.
     methods: main.
endclass.

class b implementation.
  method main.
    data: lr_a type ref to a,
             ls_dtype type t_dtype,
             l_string type string.
    create object lr_a.
    ls_dtype-dtype = 'string'.
    get reference of l_string into ls_dtype-dref.
    lr_a-&amp;gt;get_ref( changing ch_r_data = ls_dtype ).
  endmethod.
endclass.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope, the problem is now clearer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;T.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Würcher on Dec 2, 2008 12:40 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Würcher on Dec 2, 2008 12:49 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2008 11:39:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/accessing-data-references/m-p/4815646#M1127064</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-02T11:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Data References</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/accessing-data-references/m-p/4815647#M1127065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Had to create another fully-typed data reference variable inside the method with&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: lr_str type ref to string&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which I assigned the outside variables address via&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;lr_str = ch_r_data-dref&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then dereferrenced it for receiving the value with&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;lr_str-&amp;gt;* = 'abc'
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2008 18:40:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/accessing-data-references/m-p/4815647#M1127065</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-02T18:40:24Z</dc:date>
    </item>
  </channel>
</rss>

