<?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 picking up data from internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/picking-up-data-from-internal-table/m-p/6701103#M1452358</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Group,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for eg: below is the data in the internal table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ZOFFRCONT  DOC_TYPE ZOFFRCONTD          ZPRO_EFF_DATE 	  ZODEACQE        ZPROFILE_ID                                                                                &lt;/P&gt;&lt;P&gt;6000000449 DECO01   test1 Description          18.02.2010                100,000  	      P0050             &lt;/P&gt;&lt;P&gt; 6000000449 DECO01   test1 Description          03.03.2010                15,000  	     P0050             &lt;/P&gt;&lt;P&gt; 6000000449 DECO01   test1 Description          03.03.2011                20,000  	     P0050            &lt;/P&gt;&lt;P&gt; 6000000450 DECO01   test2 Description          25.02.2010                130,000  	     P0051          &lt;/P&gt;&lt;P&gt; 6000000450 DECO01   test2 Description         15.03.2010                 145,000  	      P0051          &lt;/P&gt;&lt;P&gt; 6000000450 DECO01   test2 Description          07.07.2011                120,000  	      P0051&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to pick the data where for field &lt;STRONG&gt;ZOFFRCONT&lt;/STRONG&gt; , if the &lt;STRONG&gt;ZPRO_EFF_DATE&lt;/STRONG&gt;  field has current year the latest record has to be picked (i.e 6000000449, 03.03.2010 ), and if its for future years the latest record has to be picked that is ( 6000000449, 03.03.2011) in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence over all in the above internal table, I should get only these below records:&lt;/P&gt;&lt;P&gt;6000000449 DECO01   test1 Description          03.03.2010                15,000  	     P0050             &lt;/P&gt;&lt;P&gt; 6000000449 DECO01   test1 Description          03.03.2011                20,000  	     P0050       &lt;/P&gt;&lt;P&gt;6000000450 DECO01   test2 Description         15.03.2010                 145,000  	      P0051          &lt;/P&gt;&lt;P&gt; 6000000450 DECO01   test2 Description          07.07.2011                120,000  	      P0051&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please could you help me on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Mar 2010 18:51:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-09T18:51:43Z</dc:date>
    <item>
      <title>picking up data from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/picking-up-data-from-internal-table/m-p/6701103#M1452358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Group,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for eg: below is the data in the internal table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ZOFFRCONT  DOC_TYPE ZOFFRCONTD          ZPRO_EFF_DATE 	  ZODEACQE        ZPROFILE_ID                                                                                &lt;/P&gt;&lt;P&gt;6000000449 DECO01   test1 Description          18.02.2010                100,000  	      P0050             &lt;/P&gt;&lt;P&gt; 6000000449 DECO01   test1 Description          03.03.2010                15,000  	     P0050             &lt;/P&gt;&lt;P&gt; 6000000449 DECO01   test1 Description          03.03.2011                20,000  	     P0050            &lt;/P&gt;&lt;P&gt; 6000000450 DECO01   test2 Description          25.02.2010                130,000  	     P0051          &lt;/P&gt;&lt;P&gt; 6000000450 DECO01   test2 Description         15.03.2010                 145,000  	      P0051          &lt;/P&gt;&lt;P&gt; 6000000450 DECO01   test2 Description          07.07.2011                120,000  	      P0051&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to pick the data where for field &lt;STRONG&gt;ZOFFRCONT&lt;/STRONG&gt; , if the &lt;STRONG&gt;ZPRO_EFF_DATE&lt;/STRONG&gt;  field has current year the latest record has to be picked (i.e 6000000449, 03.03.2010 ), and if its for future years the latest record has to be picked that is ( 6000000449, 03.03.2011) in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence over all in the above internal table, I should get only these below records:&lt;/P&gt;&lt;P&gt;6000000449 DECO01   test1 Description          03.03.2010                15,000  	     P0050             &lt;/P&gt;&lt;P&gt; 6000000449 DECO01   test1 Description          03.03.2011                20,000  	     P0050       &lt;/P&gt;&lt;P&gt;6000000450 DECO01   test2 Description         15.03.2010                 145,000  	      P0051          &lt;/P&gt;&lt;P&gt; 6000000450 DECO01   test2 Description          07.07.2011                120,000  	      P0051&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please could you help me on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 18:51:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/picking-up-data-from-internal-table/m-p/6701103#M1452358</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T18:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: picking up data from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/picking-up-data-from-internal-table/m-p/6701104#M1452359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jagan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the following code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SORT &amp;lt;Internal Table&amp;gt; By ZOFFRCONT DOC_TYPE ZPRO_EFF_DATE.

DELETE ADJACENT DUPLICATES FROM &amp;lt;Internal Table&amp;gt; COMPARING ZOFFRCONT DOC_TYPE.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chandravadan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chandravadan Jaiswal on Mar 9, 2010 3:43 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 20:39:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/picking-up-data-from-internal-table/m-p/6701104#M1452359</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T20:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: picking up data from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/picking-up-data-from-internal-table/m-p/6701105#M1452360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Use  below logic.Here i m considering table with only two fields ,for simplicity ,you can use your own internal table with all the fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF t_type,&lt;/P&gt;&lt;P&gt;         ZOFFRCONT(20) TYPE c,&lt;/P&gt;&lt;P&gt;         ZPRO_EFF_DATE(20) TYPE c,&lt;/P&gt;&lt;P&gt;        END OF t_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : i_type  TYPE STANDARD TABLE OF t_type,&lt;/P&gt;&lt;P&gt;           wa_type LIKE LINE OF i_type,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Declare another internal table same structure with same structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          i_type1  TYPE STANDARD TABLE OF t_type,&lt;/P&gt;&lt;P&gt;          wa_type1 LIKE LINE OF i_type1,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       l_year(4)            TYPE c,&lt;/P&gt;&lt;P&gt;       l_temp_year(4)   TYPE c,&lt;/P&gt;&lt;P&gt;       l_month(2)          TYPE c,&lt;/P&gt;&lt;P&gt;       l_temp_month(4) TYPE c,&lt;/P&gt;&lt;P&gt;       l_date(2)             TYPE c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_type-ZOFFRCONT = '6000000449'.&lt;/P&gt;&lt;P&gt;wa_type-ZPRO_EFF_DATE = '18.02.2010'.&lt;/P&gt;&lt;P&gt;APPEND wa_type TO i_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_type-ZOFFRCONT = '6000000449'.&lt;/P&gt;&lt;P&gt;wa_type-ZPRO_EFF_DATE = '03.03.2010'.&lt;/P&gt;&lt;P&gt;APPEND wa_type TO i_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_type-ZOFFRCONT = '6000000449'.&lt;/P&gt;&lt;P&gt;wa_type-ZPRO_EFF_DATE = '03.03.2011'.&lt;/P&gt;&lt;P&gt;APPEND wa_type TO i_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_type-ZOFFRCONT = '6000000450'.&lt;/P&gt;&lt;P&gt;wa_type-ZPRO_EFF_DATE = '25.02.2010'.&lt;/P&gt;&lt;P&gt;APPEND wa_type TO i_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_type-ZOFFRCONT = '6000000450'.&lt;/P&gt;&lt;P&gt;wa_type-ZPRO_EFF_DATE = '15.03.2010'.&lt;/P&gt;&lt;P&gt;APPEND wa_type TO i_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_type-ZOFFRCONT = '6000000450'.&lt;/P&gt;&lt;P&gt;wa_type-ZPRO_EFF_DATE = '07.07.2011'.&lt;/P&gt;&lt;P&gt;APPEND wa_type TO i_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Take current year and month into temporory variables and year and month from an internal tabel into another variable and compare it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT i_type INTO wa_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  l_year = sy-datum(4).&lt;/P&gt;&lt;P&gt;  l_temp_year = wa_type-ZPRO_EFF_DATE+6(4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  l_month = sy-datum+4(2).&lt;/P&gt;&lt;P&gt;  l_temp_month = wa_type-ZPRO_EFF_DATE+3(2).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF l_temp_year GE  l_year AND l_temp_month GE l_month.&lt;/P&gt;&lt;P&gt;    wa_type1-ZOFFRCONT = wa_type-ZOFFRCONT.&lt;/P&gt;&lt;P&gt;    wa_type1-ZPRO_EFF_DATE = wa_type-ZPRO_EFF_DATE.&lt;/P&gt;&lt;P&gt;    APPEND wa_type1 TO i_type1.&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;Use this code .it is working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tejaswini Khante&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Mar 2010 08:03:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/picking-up-data-from-internal-table/m-p/6701105#M1452360</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-10T08:03:45Z</dc:date>
    </item>
  </channel>
</rss>

