<?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 Looping through an internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087480#M99822</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wrote the following piece of code:&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;    LOOP AT gt_rpm_project INTO   ls_rpm_project&lt;/P&gt;&lt;P&gt;         WHERE guid     = ls_cgpl_project-guid&lt;/P&gt;&lt;P&gt;           AND category = p_categ&lt;/P&gt;&lt;P&gt;           AND subcategory IN p_subct.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;where &lt;/P&gt;&lt;P&gt;gt_rpm_project is an internal table and &lt;/P&gt;&lt;P&gt;p_subct is a select option in the selection screen.this code gives an error mentioning &amp;lt;b&amp;gt;IN cannot be used&amp;lt;/b&amp;gt;. Since it is a select -option i cannot use '=' or'between'(as p_subct apart from having a range can also have individual entries.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advice how to go about this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!!&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Nov 2005 10:00:01 GMT</pubDate>
    <dc:creator>saurabh_chaturvedi</dc:creator>
    <dc:date>2005-11-28T10:00:01Z</dc:date>
    <item>
      <title>Looping through an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087480#M99822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wrote the following piece of code:&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;    LOOP AT gt_rpm_project INTO   ls_rpm_project&lt;/P&gt;&lt;P&gt;         WHERE guid     = ls_cgpl_project-guid&lt;/P&gt;&lt;P&gt;           AND category = p_categ&lt;/P&gt;&lt;P&gt;           AND subcategory IN p_subct.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;where &lt;/P&gt;&lt;P&gt;gt_rpm_project is an internal table and &lt;/P&gt;&lt;P&gt;p_subct is a select option in the selection screen.this code gives an error mentioning &amp;lt;b&amp;gt;IN cannot be used&amp;lt;/b&amp;gt;. Since it is a select -option i cannot use '=' or'between'(as p_subct apart from having a range can also have individual entries.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advice how to go about this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!!&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2005 10:00:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087480#M99822</guid>
      <dc:creator>saurabh_chaturvedi</dc:creator>
      <dc:date>2005-11-28T10:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087481#M99823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because you are using a select option, I believe you would be having a database access before this query.&lt;/P&gt;&lt;P&gt;Why don't you filter the entries based on the select options that time itself. You wouldn't have to include a IN claus at all then.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2005 10:03:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087481#M99823</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-28T10:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087482#M99824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can also try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;subcategory &amp;gt; selectoption-low AND subcategory &amp;lt; selectoption-high.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2005 10:04:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087482#M99824</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-28T10:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087483#M99825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;should not be a problem. you should be able to use it. can you give us the exact error message?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to simulate your case i tried the following code and there was no syntax error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: itab type standard table of csks  .&lt;/P&gt;&lt;P&gt;data: wa like line of itab .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-options: p_dt for sy-datum .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa where kokrs = '9999' and datab in p_dt .&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;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2005 10:11:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087483#M99825</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2005-11-28T10:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087484#M99826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The simplest way would be to remove the subcategory field from the where condition and write an IF condition inside the Loop . IF SY-SUBRC = 0 then move the values from the internal table gt_rpm_project into ls_rpm_project.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT gt_rpm_project&lt;/P&gt;&lt;P&gt;WHERE guid = ls_cgpl_project-guid&lt;/P&gt;&lt;P&gt;AND category = p_categ.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF gt_rpm_project-subcategory IN p_subct.&lt;/P&gt;&lt;P&gt;  ls_rpm_project = gt_rpm_project.&lt;/P&gt;&lt;P&gt;  append ls_rpm_project.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2005 17:19:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087484#M99826</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-28T17:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087485#M99827</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;Could u please let us know what is the exact error message, because the code  u have posted looks perfectly alright to me, only possiblity would be that p_subct is not declared as select option which u have mentioned it has been declared, can u post the complete code with the variables declaration..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2005 17:33:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087485#M99827</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-28T17:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087486#M99828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This works OK:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest.

DATA: BEGIN OF gt_rpm_project OCCURS 0,
        guid,
        category,
        subcategory,
      END   OF gt_rpm_project,

      BEGIN OF ls_rpm_project.
        INCLUDE STRUCTURE gt_rpm_project.
DATA: END   OF ls_rpm_project,
      ls_cgpl_project LIKE ls_rpm_project.

DATA: p_categ.
RANGES p_subct FOR gt_rpm_project-subcategory.

LOOP AT gt_rpm_project INTO ls_rpm_project
  WHERE guid         = ls_cgpl_project-guid
  AND   category     = p_categ
  AND   subcategory IN p_subct.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What version are you on?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2005 17:37:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087486#M99828</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-28T17:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087487#M99829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the only reason that I can see to your erro is, Your field p_subct is a parameter, and not a select-options.&lt;/P&gt;&lt;P&gt;Or it's anything different from a value range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alexandre Nogueira.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2005 17:37:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-through-an-internal-table/m-p/1087487#M99829</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-28T17:37:35Z</dc:date>
    </item>
  </channel>
</rss>

