<?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 FIELD-SYMBOL: Reading a column dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/field-symbol-reading-a-column-dynamically/m-p/3320328#M795360</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to get dynamically a column value from a field-symbol structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Building a a field-symbol and assing values to its columns it is ok. &lt;/P&gt;&lt;P&gt;Reading it dynamically is showing to be the fun stuff.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me show you some example-code of what i'm trying to do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1) starting point:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* building field-symbol structure and value assign
...
ASSIGN COMPONENT 'MY_COLUMN'   OF STRUCTURE &amp;lt;DYN_WA_MY_TABLE&amp;gt; TO &amp;lt;L_FIELD&amp;gt;. 
&amp;lt;L_FIELD&amp;gt; = 'this is my value'.
...
* end building field-symbol


*Reading field symbol column by name (the good stuff)

data: my_column_name(10) type C, my_column_value(100) type C.

my_column_name = 'MY_COLUMN'. "the name of the column I want to read

my_column_value = &amp;lt;DYN_WA_MY_TABLE&amp;gt;-[my_column_name].


* my_column_value must have 'this is my value'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps. But this was the best way I've found to show you my issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your attention.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code Formatted by: Alvaro Tejada Galindo on Jan 28, 2008 6:17 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Jan 2008 19:53:47 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-28T19:53:47Z</dc:date>
    <item>
      <title>FIELD-SYMBOL: Reading a column dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/field-symbol-reading-a-column-dynamically/m-p/3320328#M795360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to get dynamically a column value from a field-symbol structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Building a a field-symbol and assing values to its columns it is ok. &lt;/P&gt;&lt;P&gt;Reading it dynamically is showing to be the fun stuff.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me show you some example-code of what i'm trying to do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1) starting point:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* building field-symbol structure and value assign
...
ASSIGN COMPONENT 'MY_COLUMN'   OF STRUCTURE &amp;lt;DYN_WA_MY_TABLE&amp;gt; TO &amp;lt;L_FIELD&amp;gt;. 
&amp;lt;L_FIELD&amp;gt; = 'this is my value'.
...
* end building field-symbol


*Reading field symbol column by name (the good stuff)

data: my_column_name(10) type C, my_column_value(100) type C.

my_column_name = 'MY_COLUMN'. "the name of the column I want to read

my_column_value = &amp;lt;DYN_WA_MY_TABLE&amp;gt;-[my_column_name].


* my_column_value must have 'this is my value'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps. But this was the best way I've found to show you my issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your attention.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code Formatted by: Alvaro Tejada Galindo on Jan 28, 2008 6:17 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2008 19:53:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/field-symbol-reading-a-column-dynamically/m-p/3320328#M795360</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-28T19:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: FIELD-SYMBOL: Reading a column dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/field-symbol-reading-a-column-dynamically/m-p/3320329#M795361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this way&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
report  zars no standard page heading
        line-size 170
        line-count 65(4).

data : begin of itab occurs 0,
    my_column1 type c value '1',
    my_column2 type c value '2',
    my_column3 type c value '3',
    my_column4 type c value '4',
    my_column5 type c value '5'.
data : end of itab.
data : i_components  like rstrucinfo occurs 0 with header line.
field-symbols:     &amp;lt;fs&amp;gt; type any.

call function 'GET_COMPONENT_LIST'
  exporting
    program    = 'ZARS'
    fieldname  = 'ITAB'
  tables
    components = i_components.
read table i_components with key compname = 'MY_COLUMN1'.
if sy-subrc eq 0.
  assign component sy-tabix of structure itab to
                                           &amp;lt;fs&amp;gt;.
  write : &amp;lt;fs&amp;gt;.

endif.
read table i_components with key compname = 'MY_COLUMN2'.
if sy-subrc eq 0.
  assign component sy-tabix of structure itab to
                                           &amp;lt;fs&amp;gt;.
  write : &amp;lt;fs&amp;gt;.

endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2008 22:06:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/field-symbol-reading-a-column-dynamically/m-p/3320329#M795361</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2008-01-28T22:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: FIELD-SYMBOL: Reading a column dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/field-symbol-reading-a-column-dynamically/m-p/3320330#M795362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi. The code just works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But now I'm trying to put it on a Function.. I'm getting a  sy-subrc = 4 when I read table i_components.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same code, but changing the exporting program to sy-repid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'GET_COMPONENT_LIST'&lt;/P&gt;&lt;P&gt;  exporting&lt;/P&gt;&lt;P&gt;    program    = sy-repid&lt;/P&gt;&lt;P&gt;    fieldname  = 'ITAB'&lt;/P&gt;&lt;P&gt;  tables&lt;/P&gt;&lt;P&gt;    components = i_components.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 12:22:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/field-symbol-reading-a-column-dynamically/m-p/3320330#M795362</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-29T12:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: FIELD-SYMBOL: Reading a column dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/field-symbol-reading-a-column-dynamically/m-p/3320331#M795363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just knowledge sharing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works if the data is declared global to the Group Function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SOLVED.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 13:11:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/field-symbol-reading-a-column-dynamically/m-p/3320331#M795363</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-29T13:11:32Z</dc:date>
    </item>
  </channel>
</rss>

