<?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: Internal table with data reference variable as component in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-with-data-reference-variable-as-component/m-p/7630849#M1571282</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abdul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;generic reference fieild like wa-col2 can not be used directly to put in values. Complete your code as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;field-symbols:
Data: 
   begin of wa,
  col1 type i,
  col2 type ref to data,
end of wa.
data itab like table of wa.

create data wa-col2 type p decimals 2.  &amp;lt;any&amp;gt; type any.
assign wa-col2-&amp;gt;* to &amp;lt;any&amp;gt;.
&amp;lt;any&amp;gt; = '123.45'." or an other type p compatible value
append wa to itab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Feb 2011 22:28:57 GMT</pubDate>
    <dc:creator>Clemenss</dc:creator>
    <dc:date>2011-02-18T22:28:57Z</dc:date>
    <item>
      <title>Internal table with data reference variable as component</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-with-data-reference-variable-as-component/m-p/7630848#M1571281</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 have a below structure and itab in my program and i have the issue mentioned below.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: begin of wa,&lt;/P&gt;&lt;P&gt;          col1 type i,&lt;/P&gt;&lt;P&gt;          col2 type ref to data,&lt;/P&gt;&lt;P&gt;        end of wa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data itab like table of wa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data wa-col2 type p decimals 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now my requirement is to fill the work area wa and append it to the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have used field symbols and references but i am not sucessful as the value of wa-col2 is getting overwritten  by the field symbol and it is not accomodating distinct values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kindly help me out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks &lt;/P&gt;&lt;P&gt;abdul hakim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Feb 2011 18:47:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-with-data-reference-variable-as-component/m-p/7630848#M1571281</guid>
      <dc:creator>abdul_hakim</dc:creator>
      <dc:date>2011-02-18T18:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table with data reference variable as component</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-with-data-reference-variable-as-component/m-p/7630849#M1571282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abdul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;generic reference fieild like wa-col2 can not be used directly to put in values. Complete your code as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;field-symbols:
Data: 
   begin of wa,
  col1 type i,
  col2 type ref to data,
end of wa.
data itab like table of wa.

create data wa-col2 type p decimals 2.  &amp;lt;any&amp;gt; type any.
assign wa-col2-&amp;gt;* to &amp;lt;any&amp;gt;.
&amp;lt;any&amp;gt; = '123.45'." or an other type p compatible value
append wa to itab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Feb 2011 22:28:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-with-data-reference-variable-as-component/m-p/7630849#M1571282</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2011-02-18T22:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table with data reference variable as component</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-with-data-reference-variable-as-component/m-p/7630850#M1571283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi clemens,&lt;/P&gt;&lt;P&gt;thanks for the help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my complete code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of wa,&lt;/P&gt;&lt;P&gt;          col1 type i,&lt;/P&gt;&lt;P&gt;          col2  type ref to data,&lt;/P&gt;&lt;P&gt;        end of wa.&lt;/P&gt;&lt;P&gt;data itab like table of wa.&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;create data wa-col2 type p decimals 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign wa-col2-&amp;gt;* to &amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;fs&amp;gt; = '123.45'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;fs&amp;gt; = '456.78'.&lt;/P&gt;&lt;P&gt;append wa to itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when i loop through itab the colum wa-col2 only contains 456.78 for both the records. the value 123.45 that i have passed for the first record is lost. how can get the values 123.45 for first record and 456.78 for the second record using this technique.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;abdul hakim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Abdul Hakim on Feb 19, 2011 4:02 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Feb 2011 09:02:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-with-data-reference-variable-as-component/m-p/7630850#M1571283</guid>
      <dc:creator>abdul_hakim</dc:creator>
      <dc:date>2011-02-19T09:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table with data reference variable as component</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-with-data-reference-variable-as-component/m-p/7630851#M1571284</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;Since you are dynamically creating data type for the work area wa-col2, your pointer is pointing the first record all the time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the solution is: Create data type for the work area for all the records like below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;create data wa-col2 type p decimals 2.
assign wa-col2-&amp;gt;* to &amp;lt;fs&amp;gt;.
&amp;lt;fs&amp;gt; = '123.45'.
append wa to itab.

create data wa-col2 type p decimals 2.
assign wa-col2-&amp;gt;* to &amp;lt;fs&amp;gt;.
&amp;lt;fs&amp;gt; = '456.78'.
append wa to itab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other choice is declaring wa-col2 globally as TYPE p DECIMALS 2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Feb 2011 11:41:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-with-data-reference-variable-as-component/m-p/7630851#M1571284</guid>
      <dc:creator>asik_shameem</dc:creator>
      <dc:date>2011-02-19T11:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table with data reference variable as component</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-with-data-reference-variable-as-component/m-p/7630852#M1571285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abdul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; create data wa-col2 type p decimals 2.&lt;/P&gt;&lt;P&gt;&amp;gt; assign wa-col2-&amp;gt;* to &amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;gt; &amp;lt;fs&amp;gt; = '123.45'.&lt;/P&gt;&lt;P&gt;&amp;gt; append wa to itab.&lt;/P&gt;&lt;P&gt;&amp;gt; &amp;lt;fs&amp;gt; = '456.78'.&lt;/P&gt;&lt;P&gt;&amp;gt; append wa to itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You create the dynamic data only once in the work area. The field-symbols assigned &lt;STRONG&gt;always&lt;/STRONG&gt; points to the same data object. First you move '123.45' to the data object, then '456.78'. In the itab, you have the same object reference stored in two records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Asik already showed, you have to create the data object for each internal table record. Before you create data for the reference col2, it points to nothing. If you create data only once, you have only one data object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Feb 2011 13:13:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-with-data-reference-variable-as-component/m-p/7630852#M1571285</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2011-02-19T13:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table with data reference variable as component</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-with-data-reference-variable-as-component/m-p/7630853#M1571286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Asik / Clemens,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot. It solved my problem. I was breaking my head for couple of days for this one.. Thanks again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Abdul Hakim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Feb 2011 07:46:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-with-data-reference-variable-as-component/m-p/7630853#M1571286</guid>
      <dc:creator>abdul_hakim</dc:creator>
      <dc:date>2011-02-20T07:46:46Z</dc:date>
    </item>
  </channel>
</rss>

