<?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: Need idea if i write This code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-idea-if-i-write-this-code/m-p/3791569#M911930</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;To reduce the load on Database you can use the below logic but it increases the ABAP load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 1: Get the lowest and highest date of all date fields which you are passing in the where clause.&lt;/P&gt;&lt;P&gt;1.Append an internal table which will have one field and of date type and with all date fields &lt;/P&gt;&lt;P&gt;2.Sort the internal table.&lt;/P&gt;&lt;P&gt;3. Get first and last record of the internal table which has max and min values and store them in varaibles V1 and V2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 2: Select data from table CATSDB once into the internal table ITAB1 by using the variables V1 and V2 in the WHERE clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 3: Loop through the internal table ITAB1 and populate other respective internal table using the CASE statement or IF statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Satya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 May 2008 12:08:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-08T12:08:10Z</dc:date>
    <item>
      <title>Need idea if i write This code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-idea-if-i-write-this-code/m-p/3791567#M911928</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 Do This Code and i Wont To have idea How to do it Better.&lt;/P&gt;&lt;P&gt;i have to do the select for every month for 13 month before today.&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;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  ap&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     --&amp;gt;P_L_BEGDA13  text&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     --&amp;gt;P_L_BEGDA12  text&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     --&amp;gt;P_CATS_TAB  text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM ap  TABLES p_cats_tab USING    p_l_begda13&lt;/P&gt;&lt;P&gt;                  p_l_begda12.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT *&lt;/P&gt;&lt;P&gt;  FROM catsdb&lt;/P&gt;&lt;P&gt;  APPENDING CORRESPONDING FIELDS OF TABLE p_c_tab&lt;/P&gt;&lt;P&gt;  WHERE workdate BETWEEN p_l_begda1 AND p_l_begda2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " ap&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM: ap TABLES cats_tab1 USING l_begda13 l_begda12 ,&lt;/P&gt;&lt;P&gt;         ap TABLES cats_tab2 USING l_begda12 l_begda11 ,&lt;/P&gt;&lt;P&gt;         ap TABLES cats_tab3 USING l_begda11 l_begda10 ,&lt;/P&gt;&lt;P&gt;         ap TABLES cats_tab4 USING l_begda10 l_begda9 ,&lt;/P&gt;&lt;P&gt;         ap TABLES cats_tab5 USING l_begda9 l_begda8 ,&lt;/P&gt;&lt;P&gt;         ap TABLES cats_tab6 USING l_begda8 l_begda7 ,&lt;/P&gt;&lt;P&gt;         ap TABLES cats_tab7 USING l_begda7 l_begda6 ,&lt;/P&gt;&lt;P&gt;         ap TABLES cats_tab8 USING l_begda6 l_begda5 ,&lt;/P&gt;&lt;P&gt;         ap TABLES cats_tab9 USING l_begda5 l_begda4 ,&lt;/P&gt;&lt;P&gt;         ap TABLES cats_tab10 USING l_begda4 l_begda3 ,&lt;/P&gt;&lt;P&gt;         ap TABLES cats_tab11 USING l_begda3 l_begda2 ,&lt;/P&gt;&lt;P&gt;         ap TABLES cats_tab12 USING l_begda2 l_begda1 ,&lt;/P&gt;&lt;P&gt;         ap TABLES cats_tab13 USING l_begda1 sy-datum .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 May 2008 11:21:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-idea-if-i-write-this-code/m-p/3791567#M911928</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-08T11:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need idea if i write This code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-idea-if-i-write-this-code/m-p/3791568#M911929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Frinds,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do i write this code in the Best way?&lt;/P&gt;&lt;P&gt;If not i need tips to do it Better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 May 2008 11:57:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-idea-if-i-write-this-code/m-p/3791568#M911929</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-08T11:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need idea if i write This code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-idea-if-i-write-this-code/m-p/3791569#M911930</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;To reduce the load on Database you can use the below logic but it increases the ABAP load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 1: Get the lowest and highest date of all date fields which you are passing in the where clause.&lt;/P&gt;&lt;P&gt;1.Append an internal table which will have one field and of date type and with all date fields &lt;/P&gt;&lt;P&gt;2.Sort the internal table.&lt;/P&gt;&lt;P&gt;3. Get first and last record of the internal table which has max and min values and store them in varaibles V1 and V2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 2: Select data from table CATSDB once into the internal table ITAB1 by using the variables V1 and V2 in the WHERE clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 3: Loop through the internal table ITAB1 and populate other respective internal table using the CASE statement or IF statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Satya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 May 2008 12:08:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-idea-if-i-write-this-code/m-p/3791569#M911930</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-08T12:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need idea if i write This code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-idea-if-i-write-this-code/m-p/3791570#M911931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this is the best possible way .. &lt;/P&gt;&lt;P&gt;The other way would be to pass all the 13 months at a time ..&lt;/P&gt;&lt;P&gt;but would take huge time to get data ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 May 2008 12:08:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-idea-if-i-write-this-code/m-p/3791570#M911931</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-08T12:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need idea if i write This code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-idea-if-i-write-this-code/m-p/3791571#M911932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ricardo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To calculate teh date b4 13 months from current date..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;parameters input_date type sy-datum.
data output_date type sy-datum.

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = input_date
days = '00'
months = '13'
signum = '-'
years = '00'
IMPORTING
calc_date = output_date.
write : / 'Current Date' , sy-datum.
write : 'Output DATE', output_date.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also rather then appending the records for each month in same internal table... why dont you select the data from the database table at one shot...it will reduce the network traffic between appl server and database server...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;nd Don't use select * ...&lt;/P&gt;&lt;P&gt;instead of it use select field1 field2 field3 etc...&lt;/P&gt;&lt;P&gt;it will also help to improve the performance...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't use into CORRESPONDING FIELDS OF statement also... its obsolete....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use below stmt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT field1 field2 field3
FROM catsdb
into table TABLE p_c_tab
WHERE workdate BETWEEN input_date AND output_date.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also its better for performance if you can include some more fields like &lt;STRONG&gt;PERNR&lt;/STRONG&gt; in where condition..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will solve your problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;ilesh 24x7&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 May 2008 12:18:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-idea-if-i-write-this-code/m-p/3791571#M911932</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-08T12:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need idea if i write This code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-idea-if-i-write-this-code/m-p/3791572#M911933</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;You can improve it by making certain changes.&lt;/P&gt;&lt;P&gt;1) By removing corresponding fields of from select quiery and instead of using *  try to declare a structure containing the required fields and declare the internal table of its type .&lt;/P&gt;&lt;P&gt;   exp : select f1 f2 f3 &lt;/P&gt;&lt;P&gt;                from catsdb&lt;/P&gt;&lt;P&gt;                into table t_catsdb&lt;/P&gt;&lt;P&gt;                where workdate in ( p_l_begda1 , p_l_begda2 ) .&lt;/P&gt;&lt;P&gt;2) Instead of using parameter use select-options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) in the perform without using table write everything under using &lt;/P&gt;&lt;P&gt;  exp: &lt;/P&gt;&lt;P&gt; PERFORM: ap  USING cats_tab1 l_begda13 l_begda12 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will increase the performance lable of your coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward some points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bye,&lt;/P&gt;&lt;P&gt;Anomitro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 May 2008 12:41:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-idea-if-i-write-this-code/m-p/3791572#M911933</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-08T12:41:40Z</dc:date>
    </item>
  </channel>
</rss>

