<?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: how to access a structure field dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945634#M943589</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;PRE&gt;&lt;CODE&gt;
ASSIGN COMPONENT comp OF STRUCTURE struc TO &amp;lt;comp&amp;gt;. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;[Assigning Components of Structures to a Field Symbol|http://help.sap.com/saphelp_nw70/helpdata/EN/fc/eb3923358411d1829f0000e829fbfe/frameset.htm]&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA gs_mara TYPE mara.
DATA gv_fieldname TYPE fieldname VALUE 'MATNR'.
FIELD-SYMBOLS &amp;lt;gv_fieldvalue&amp;gt; TYPE ANY.

ASSIGN COMPONENT gv_fieldname OF STRUCTURE gs_mara TO &amp;lt;gv_fieldvalue&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards Rudi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Jun 2008 11:44:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-05T11:44:57Z</dc:date>
    <item>
      <title>how to access a structure field dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945630#M943585</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 structure say lt_struc which has some 10 fields.&lt;/P&gt;&lt;P&gt;i have a variable lv_field which holds the field name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how do i fetch the field value for the field name stored in the variable lv_field from the structure lt_struc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with regards&lt;/P&gt;&lt;P&gt;kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2008 09:33:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945630#M943585</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-05T09:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to access a structure field dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945631#M943586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didnt understand what exactly you want for dynamically fetching values you can use FIELD-SYMBOLS for fetching the values&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2008 09:36:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945631#M943586</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-05T09:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to access a structure field dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945632#M943587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the Field Symbols.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Field-symbols: &amp;lt;f_fs&amp;gt; type any,
                        &amp;lt;f_f1&amp;gt; type any,
                        &amp;lt;f_f2&amp;gt; type any,
                         &amp;lt;f_f3&amp;gt; tye any.

Loop at lt_struc assigning &amp;lt;f_fs&amp;gt;.
ASSIGN COMPONENT 1 OF STRUCTURE &amp;lt;f_fs&amp;gt; TO &amp;lt;f_f1&amp;gt;.
ASSIGN lv_field TO &amp;lt;f_fs2&amp;gt;.
&amp;lt;f_fs1&amp;gt; = &amp;lt;f_fs2&amp;gt;.
endloop.&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;Kannaiah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2008 09:37:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945632#M943587</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-05T09:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to access a structure field dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945633#M943588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually i will not be knowing which field to access before hand from the structure. only at run time i will get to know which field to access.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it is something like i have the field name stored in a variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Request to provide code in detail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2008 11:42:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945633#M943588</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-05T11:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to access a structure field dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945634#M943589</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;PRE&gt;&lt;CODE&gt;
ASSIGN COMPONENT comp OF STRUCTURE struc TO &amp;lt;comp&amp;gt;. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;[Assigning Components of Structures to a Field Symbol|http://help.sap.com/saphelp_nw70/helpdata/EN/fc/eb3923358411d1829f0000e829fbfe/frameset.htm]&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA gs_mara TYPE mara.
DATA gv_fieldname TYPE fieldname VALUE 'MATNR'.
FIELD-SYMBOLS &amp;lt;gv_fieldvalue&amp;gt; TYPE ANY.

ASSIGN COMPONENT gv_fieldname OF STRUCTURE gs_mara TO &amp;lt;gv_fieldvalue&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards Rudi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2008 11:44:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945634#M943589</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-05T11:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to access a structure field dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945635#M943590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; Let me be simple in explaining the what I want:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: itab type (DDIC structure Name).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now this DDIC structure Name has 5 fields: f1,f2,f3,f4&amp;amp;f5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want:&lt;/P&gt;&lt;P&gt;Data: lv_temp type string.&lt;/P&gt;&lt;P&gt;Field-symbols: &amp;lt;lv_dynamic_field&amp;gt; type ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lv_temp = itab-&amp;lt;lv_dynamic_field&amp;gt;.  - is this the correct one ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here lv_dynamic_field can have any field name like f1 or f2 or f3......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you got the issue now ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2008 13:23:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945635#M943590</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-05T13:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to access a structure field dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945636#M943591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data: l_fldname type string.&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;fs1&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l_fldname = assign the fieldname of the internal table to this string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign (l_fldname) to &amp;lt;fs1&amp;gt;.&lt;/P&gt;&lt;P&gt;now you can use this field symbol &amp;lt;fs1&amp;gt; for your further processing. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this would help you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2008 21:54:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945636#M943591</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-05T21:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to access a structure field dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945637#M943592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rudi, I followed your solution and it worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you all for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With regards,&lt;/P&gt;&lt;P&gt;kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2008 05:03:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-a-structure-field-dynamically/m-p/3945637#M943592</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-06T05:03:12Z</dc:date>
    </item>
  </channel>
</rss>

