<?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: loop into loop with dynamic field name in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-into-loop-with-dynamic-field-name/m-p/12263033#M1987197</link>
    <description>&lt;P&gt;You need ASSIGN COMPONENT. I've removed the prefixes and replaced your variables with slightly more meaningful names.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT hrp9229 INTO hrp9229_record.
  LOOP AT otype_fields INTO field .
    ASSIGN COMPONENT field-fieldname OF STRUCTURE hrp9229_record
      TO FIELD-SYMBOL(&amp;lt;field_value&amp;gt;).
    IF &amp;lt;field_value&amp;gt; = 'X'.
        ev_descript_data = ev_descript_data &amp;amp;&amp;amp; ','  &amp;amp;&amp;amp; 
                        field-Field_description.
    ENDIF.
  ENDLOOP.
ENDLOOP&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 25 Aug 2020 12:17:09 GMT</pubDate>
    <dc:creator>matt</dc:creator>
    <dc:date>2020-08-25T12:17:09Z</dc:date>
    <item>
      <title>loop into loop with dynamic field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-into-loop-with-dynamic-field-name/m-p/12263031#M1987195</link>
      <description>&lt;P&gt;hi all,&lt;/P&gt;
  &lt;P&gt;i'm Software developer, and now i learn abap for do task in my work.&lt;/P&gt;
  &lt;P&gt;TL:DR - problem with loop table in another table with dynamic fields.&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;THE PROBLEM: &lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;i have 2 tables like this:&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;TABLE 1&lt;/STRONG&gt;: HR table with many colums and row..&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;TABLE 2 : &lt;/STRONG&gt;&lt;BR /&gt;table with list of columns that i need to read from table 1&lt;/P&gt;
  &lt;P&gt;see this image:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1837759-tables.png" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;in &lt;STRONG&gt;table 1&lt;/STRONG&gt;,&lt;/P&gt;
  &lt;P&gt; i need loop all row,&lt;/P&gt;
  &lt;P&gt; and i need to check all the fields from&lt;STRONG&gt; table 2&lt;/STRONG&gt;.&lt;/P&gt;
  &lt;P&gt;.if have &lt;STRONG&gt;"X"&lt;/STRONG&gt; in the field, i need print the field description from &lt;STRONG&gt;table 2.&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;i try do it with nested loop (loop table 1, and each loop iteration loop table 2 and check all the fields of the row).&lt;/P&gt;
  &lt;P&gt;and i can't use variable on table-&amp;lt;&lt;STRONG&gt;FIelds&lt;/STRONG&gt;&amp;gt; (i need variable for the loop in &amp;lt;Fields&amp;gt; ).&lt;/P&gt;
  &lt;P&gt;MY CODE:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;    LOOP AT lt_hrp9229  INTO ls_hrp9229 .&amp;lt;br&amp;gt;       LOOP AT lt_otype_fields INTO ls_otype_fields .
       &amp;lt;br&amp;gt;       IF ls_hrp9229-ls_otype_fields-FIELD_NAME = 'X'.
        ev_descript_data = ev_descript_data &amp;amp;&amp;amp; ','  &amp;amp;&amp;amp;  ls_otype_fields-Field_description.&amp;lt;br&amp;gt;
       ENDIF.
     ENDLOOP.
   ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I have problem in this row:&lt;/P&gt;
  &lt;P&gt;IF ls_hrp9229-ls_otype_fields-FIELD_NAME = 'X'&lt;/P&gt;
  &lt;P&gt;i can't use dynamic field name from the loop.&lt;/P&gt;
  &lt;P&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 12:00:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-into-loop-with-dynamic-field-name/m-p/12263031#M1987195</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-08-25T12:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: loop into loop with dynamic field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-into-loop-with-dynamic-field-name/m-p/12263032#M1987196</link>
      <description>&lt;P&gt;Hi and welcome to
the SAP Community!&lt;/P&gt;&lt;P&gt;Thank
you for visiting SAP Community to get answers to your questions. Since you're
asking a question here for the first time, I recommend that you familiarize
yourself with &lt;A href="https://community.sap.com/resources/questions-and-answers"&gt;https://community.sap.com/resources/questions-and-answers&lt;/A&gt;
(if you haven't already), as it provides tips for preparing questions that draw
responses from our members. For example, you can outline what steps you took to
find answers (and why they weren't helpful) and share screenshots of what
you've seen/done. The more details you provide, the more likely it is that
members will be able to assist you.&lt;/P&gt;&lt;P&gt;Should
you wish, you can revise your question by selecting Actions, then Edit
(although once someone answers your question, you'll lose the ability to edit
the question -- but if that happens, you can leave more details in a comment).&lt;/P&gt;&lt;P&gt;Finally,
if you're hoping to connect with readers, please consider adding a picture to
your profile. Here's how you do it: &lt;A href="https://www.youtube.com/watch?v=F5JdUbyjfMA&amp;amp;list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS"&gt;https://www.youtube.com/watch?v=F5JdUbyjfMA&amp;amp;list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS&lt;/A&gt;.
By personalizing your profile with a photo of you, you encourage readers to
respond.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Julia
SAP Community Moderato&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 12:00:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-into-loop-with-dynamic-field-name/m-p/12263032#M1987196</guid>
      <dc:creator>former_member30</dc:creator>
      <dc:date>2020-08-25T12:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: loop into loop with dynamic field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-into-loop-with-dynamic-field-name/m-p/12263033#M1987197</link>
      <description>&lt;P&gt;You need ASSIGN COMPONENT. I've removed the prefixes and replaced your variables with slightly more meaningful names.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT hrp9229 INTO hrp9229_record.
  LOOP AT otype_fields INTO field .
    ASSIGN COMPONENT field-fieldname OF STRUCTURE hrp9229_record
      TO FIELD-SYMBOL(&amp;lt;field_value&amp;gt;).
    IF &amp;lt;field_value&amp;gt; = 'X'.
        ev_descript_data = ev_descript_data &amp;amp;&amp;amp; ','  &amp;amp;&amp;amp; 
                        field-Field_description.
    ENDIF.
  ENDLOOP.
ENDLOOP&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Aug 2020 12:17:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-into-loop-with-dynamic-field-name/m-p/12263033#M1987197</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2020-08-25T12:17:09Z</dc:date>
    </item>
  </channel>
</rss>

