<?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: Itab - field selection at runtime in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-field-selection-at-runtime/m-p/4778158#M1119549</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Khan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By using field-symbols, i think this might be possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First define this LOOP in a sub-routine to which you pass the field name as a parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, you can use the syntax &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ASSIGN COMPONENT OF .......&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;to assign the field name to a field-symbol. Pass this as the parameter to the sub-routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the sub-routine, while looping, you can try using this parameter (Field-Symbol) and check against the search key (This can also be passed using a field-symbol).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this. I think you should be able to crack it. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Nov 2008 06:08:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-11-18T06:08:48Z</dc:date>
    <item>
      <title>Itab - field selection at runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-field-selection-at-runtime/m-p/4778157#M1119548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to select lines from one internal table (with a large number of fields) based on different fields. E.g. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table: zitab1&lt;/P&gt;&lt;P&gt;Fields: field1, field2, ..., fieldN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I want to go through the table based on fields: field1, field2 and field3, I have to use the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ZITAB1 WHERE FIELD1 EQ 'SEARCH_KEY'.&lt;/P&gt;&lt;P&gt;   ...&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ZITAB1 WHERE FIELD2 EQ 'SEARCH_KEY'.&lt;/P&gt;&lt;P&gt;   ...&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ZITAB1 WHERE FIELD3 EQ 'SEARCH_KEY'.&lt;/P&gt;&lt;P&gt;   ...&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to read the itab using field selection at runtime so I can replace all these separate loop statements with a single statement, e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ZITAB1 WHERE (FIELD) EQ 'SEARCH_KEY'.&lt;/P&gt;&lt;P&gt;   ...&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where (FIELD) can be specified to be any of the fields in the table zitab1?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Help is appreciated.&lt;/P&gt;&lt;P&gt;&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;Edited by: Khan Awkhan on Nov 18, 2008 7:04 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2008 06:03:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/itab-field-selection-at-runtime/m-p/4778157#M1119548</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-18T06:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: Itab - field selection at runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-field-selection-at-runtime/m-p/4778158#M1119549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Khan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By using field-symbols, i think this might be possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First define this LOOP in a sub-routine to which you pass the field name as a parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, you can use the syntax &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ASSIGN COMPONENT OF .......&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;to assign the field name to a field-symbol. Pass this as the parameter to the sub-routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the sub-routine, while looping, you can try using this parameter (Field-Symbol) and check against the search key (This can also be passed using a field-symbol).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this. I think you should be able to crack it. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2008 06:08:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/itab-field-selection-at-runtime/m-p/4778158#M1119549</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-18T06:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: Itab - field selection at runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/itab-field-selection-at-runtime/m-p/4778159#M1119550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Try to use Subroutine by passing the field name and its value.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shashi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2008 06:42:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/itab-field-selection-at-runtime/m-p/4778159#M1119550</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-18T06:42:23Z</dc:date>
    </item>
  </channel>
</rss>

