<?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: Looping in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping/m-p/3397545#M815801</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have a master table from where you can get the values of p1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As an example ....lets say i have a select option for plant: so_werks for marc-werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i enter on my selection screen plant as 1000 to 3000 . So for this low and high values , i will query the master table T001W to get all the plants between 1000 and 3000  into an internal table say gt_werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select werks&lt;/P&gt;&lt;P&gt;           into table gt_werks&lt;/P&gt;&lt;P&gt;                    from t001w&lt;/P&gt;&lt;P&gt;                      where werks GE so_werks-low&lt;/P&gt;&lt;P&gt;                      and werks LE so_werks-high.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will be processing this table further for all these plants obtained.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have a similar situation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;shivika&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Feb 2008 08:49:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-11T08:49:41Z</dc:date>
    <item>
      <title>Looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping/m-p/3397543#M815799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys&lt;/P&gt;&lt;P&gt;In the below code if i give input for p1 as ' 1'  and ' 3 ' .then i need to pick values of only april,may and june.P1 being select-option field.I am unable to run it in a loop.What i mean is if i give 1 and 3 as input in p1.I am getting only values for p1 =1.if i use p-low and p1-high then i am missing the middle value of p1 = 2.Please help me.Points will be rewarded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With Regards&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: p1 FOR v_p1 OBLIGATORY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM determine_power_cost  USING&lt;/P&gt;&lt;P&gt;             it_faglflext  TYPE  faglflext&lt;/P&gt;&lt;P&gt;             v_gjahr       TYPE  gjahr&lt;/P&gt;&lt;P&gt;             CHANGING lv_success_flag TYPE c.&lt;/P&gt;&lt;P&gt;  DATA : lv_plant_maint_flag.&lt;/P&gt;&lt;P&gt;  CLEAR lv_plant_maint_flag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF ( it_faglflext-rcntr EQ  '0000360101'&lt;/P&gt;&lt;P&gt; OR it_faglflext-rcntr LE  '0000360111')&lt;/P&gt;&lt;P&gt; OR  ( it_faglflext-rcntr EQ  '0000360301'&lt;/P&gt;&lt;P&gt; OR it_faglflext-rcntr LE  '0000360304').&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF  ( it_faglflext-racct EQ   '0000332000' )&lt;/P&gt;&lt;P&gt;   OR ( it_faglflext-racct EQ   '0000332200' )&lt;/P&gt;&lt;P&gt;   OR  ( it_faglflext-racct EQ   '0000332100' )&lt;/P&gt;&lt;P&gt;   OR ( it_faglflext-racct EQ   '0000332300' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF it_faglflext-ryear = v_gjahr."v_next_year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_power_cost_p2-power_cost_p2_apr&lt;/P&gt;&lt;P&gt; = t_power_cost_p2-power_cost_p2_apr + it_faglflext-hsl01.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_power_cost_p2-power_cost_p2_may&lt;/P&gt;&lt;P&gt;= t_power_cost_p2-power_cost_p2_may + it_faglflext-hsl02.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_power_cost_p2-power_cost_p2_jun&lt;/P&gt;&lt;P&gt;= t_power_cost_p2-power_cost_p2_jun + it_faglflext-hsl03.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_power_cost_p2-power_cost_p2_jul&lt;/P&gt;&lt;P&gt;= t_power_cost_p2-power_cost_p2_jul + it_faglflext-hsl04.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2008 07:48:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping/m-p/3397543#M815799</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-11T07:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping/m-p/3397544#M815800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;STRONG&gt;vijay krishna&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;See this example code for select-options you can use like this code in your programm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;DATA num TYPE i.&lt;/P&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;gt;DATA num1(30).&lt;/P&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;gt;SELECT-OPTIONS p1 FOR num.&lt;/P&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;gt;LOOP AT p1.&lt;/P&gt;&lt;P&gt;&amp;gt; DO.&lt;/P&gt;&lt;P&gt;&amp;gt;    IF sy-index IN p1.&lt;/P&gt;&lt;P&gt;&amp;gt;       write / sy-index.&lt;/P&gt;&lt;P&gt;&amp;gt;    ELSE.&lt;/P&gt;&lt;P&gt;&amp;gt;      EXIT.&lt;/P&gt;&lt;P&gt;  &amp;gt;  ENDIF.&lt;/P&gt;&lt;P&gt;  &amp;gt;ENDDO.&lt;/P&gt;&lt;P&gt;&amp;gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plzz reward if it is useful,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Mahi&lt;/STRONG&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2008 08:26:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping/m-p/3397544#M815800</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-11T08:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping/m-p/3397545#M815801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have a master table from where you can get the values of p1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As an example ....lets say i have a select option for plant: so_werks for marc-werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i enter on my selection screen plant as 1000 to 3000 . So for this low and high values , i will query the master table T001W to get all the plants between 1000 and 3000  into an internal table say gt_werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select werks&lt;/P&gt;&lt;P&gt;           into table gt_werks&lt;/P&gt;&lt;P&gt;                    from t001w&lt;/P&gt;&lt;P&gt;                      where werks GE so_werks-low&lt;/P&gt;&lt;P&gt;                      and werks LE so_werks-high.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will be processing this table further for all these plants obtained.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have a similar situation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;shivika&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2008 08:49:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping/m-p/3397545#M815801</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-11T08:49:41Z</dc:date>
    </item>
  </channel>
</rss>

