<?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: simple logic from below internal tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492906#M1256913</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Deep,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first sort the tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab1 by year month values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab2 by year month value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If itab-value eq 0.&lt;/P&gt;&lt;P&gt;loop at itab2 where year = itab2-year and month ge itab2-month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append to itab3.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endif.&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;regards,&lt;/P&gt;&lt;P&gt;Prabhudas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Apr 2009 05:31:33 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-30T05:31:33Z</dc:date>
    <item>
      <title>simple logic from below internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492905#M1256912</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 one i.table ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;entries as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Year   Month    value&lt;/P&gt;&lt;P&gt;2008   12         0.00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have another i.table ITAB1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;entries as: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Year       Month   value&lt;/P&gt;&lt;P&gt;2008       1          12.00&lt;/P&gt;&lt;P&gt;2008       2          15.00&lt;/P&gt;&lt;P&gt;2008       3          10.00&lt;/P&gt;&lt;P&gt;2008       4          11.00   &lt;/P&gt;&lt;P&gt;2008       11         0.00  &lt;/P&gt;&lt;P&gt;2008       12         0.00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both these i.tables are retrieved from same table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i required logic such that i should be able check each month 12-1, 11-1 etc.. till the month have some value other than 0.00.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: i should not use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If itab-value eq 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;logic should pick up value from previous available month which have value from ITAB1&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;endif.&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;can anybody provide simple logic for this!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Deep.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 05:25:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492905#M1256912</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T05:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: simple logic from below internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492906#M1256913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Deep,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first sort the tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab1 by year month values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab2 by year month value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If itab-value eq 0.&lt;/P&gt;&lt;P&gt;loop at itab2 where year = itab2-year and month ge itab2-month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append to itab3.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endif.&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;regards,&lt;/P&gt;&lt;P&gt;Prabhudas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 05:31:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492906#M1256913</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T05:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: simple logic from below internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492907#M1256914</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;do we have to get a non zero value for a record in ITAB, from a previous period record, as here, from ITAB1? And wat we can't use ? please clarify..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If yes...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB BY ASCENDING YEAR MONTH. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB1 BY DESCENDING YEAR MONTH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLAG = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;FLAG = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF ITAB-VALUE EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF ITAB1-YEAR = ITAB-YEAR AND ITAB1-MONTH AND ITAB-MONTH.&lt;/P&gt;&lt;P&gt;FALG = 1.           " &lt;STRONG&gt;matching record found&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF FLAG EQ 1.           " &lt;STRONG&gt;once record found we need to go further nd find a non-zero value as&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                                 " &lt;STRONG&gt;sorted  descending order we will get value from previous possible record.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;IF ITAB1-VALUE NE 0.&lt;/P&gt;&lt;P&gt;MODIFY ITAB FROM ITAB1.&lt;/P&gt;&lt;P&gt;FLAG = 0.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&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;-pranav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 05:59:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492907#M1256914</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T05:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: simple logic from below internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492908#M1256915</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;First we will check if ITAB's value field is 0.00 if yes then we have to get value from ITAB1 table starting from previous period 11, 10, 9, 8 etc.. till we get value # 0.00.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 11:11:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492908#M1256915</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T11:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: simple logic from below internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492909#M1256916</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;use the code given below...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sort ITAB1 by year ascending 
                    month descending.

Loop at ITAB.
If itab-value eq 0.
    Read table itab1 into itab1 with key year = itab-year
                                                       month &amp;lt; itab-month
                                                       value &amp;lt;&amp;gt; 0.                         
"   this read statement will give you the record where the value is not eq 0 for the month which is less 
"   than the month in itab and year = itab-year.
endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 11:26:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492909#M1256916</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T11:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: simple logic from below internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492910#M1256917</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;From year-2009 month-12 we will searh through year-2009 month-1 in ITAB1 if we did not found we should go to year-2008 month-12 to year-2008 month-1 etc... 2007 .. 2006 till we found value field # 0.00 in ITAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will this logic work for the same!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Deep.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 11:34:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492910#M1256917</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T11:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: simple logic from below internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492911#M1256918</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;&lt;/P&gt;&lt;P&gt;use this code and it will work for your requirement...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sort ITAB1 by year descending 
                           month descending.
 
Loop at ITAB.
If itab-value eq 0.
    Read table itab1 into itab1 with key year &amp;lt;= itab-year
                                                       month &amp;lt; itab-month
                                                       value &amp;lt;&amp;gt; 0.                         
"   this read statement will give you the record where the value is not eq 0 for the month which is less 
"   than the month in itab and year &amp;lt;= itab-year.
endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 11:38:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492911#M1256918</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T11:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: simple logic from below internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492912#M1256919</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;With READ TABLE we can't use LE/LT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i am using LOOP with LE/LT instead of READ it is not picking up other values than key fields in loop.&lt;/P&gt;&lt;P&gt;Other values are always blank.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What can be the solution!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Deep.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2009 08:37:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492912#M1256919</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-04T08:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: simple logic from below internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492913#M1256920</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;The solution can be like this.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT itab.
  IF itab-value EQ 0.
   CLEAR itab1.
    LOOP AT itab1 WHERE year &amp;lt;= itab-year AND month &amp;lt; itab-month AND value &amp;lt;&amp;gt; 0.
      EXIT.
    ENDLOOP.
*    READ TABLE itab1 WITH KEY year = itab-year
*                              month = itab-month
*                              value  = 0.
    "   this read statement will give you the record where the value is not eq 0 for the month which is less
    "   than the month in itab and year &amp;lt;= itab-year.
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is something similar to read statement...&lt;/P&gt;&lt;P&gt;as soon as the cursor goes inside the loop it exits from the loop.... which says that the record which it fetched was the record which was required by the condition ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2009 08:55:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-logic-from-below-internal-tables/m-p/5492913#M1256920</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-04T08:55:12Z</dc:date>
    </item>
  </channel>
</rss>

