<?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: Select Statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382087#M186409</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in the select from MSEG you added &amp;lt;b&amp;gt;AND B~MATNR IN S_MATNR&amp;lt;/b&amp;gt; , check this S_MATNR have 2 material numbers or not.&lt;/P&gt;&lt;P&gt;i believe, your S_MATNR is missing out 1 ,so your result also getting based on that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Jun 2006 10:51:59 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-06-13T10:51:59Z</dc:date>
    <item>
      <title>Select Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382077#M186399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the MKPF table, I have taken the uniquie document number into Itab-1.  In Itab-2 I am selecting all the entries from MSEG.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code used is as follows:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------" /&gt;&lt;P&gt;  SELECT MBLNR BUDAT&lt;/P&gt;&lt;P&gt;  FROM   MKPF&lt;/P&gt;&lt;P&gt;  INTO   CORRESPONDING FIELDS OF TABLE IT_MKPF&lt;/P&gt;&lt;P&gt;  WHERE  BUDAT LE P_LDATE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SORT IT_MKPF BY MBLNR BUDAT DESCENDING.&lt;/P&gt;&lt;P&gt;  DELETE ADJACENT DUPLICATES FROM IT_MKPF COMPARING &lt;/P&gt;&lt;P&gt;  MBLNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT B&lt;SUB&gt;MBLNR B&lt;/SUB&gt;MATNR B&lt;SUB&gt;BWART B&lt;/SUB&gt;BUKRS B&lt;SUB&gt;WERKS B&lt;/SUB&gt;LGORT&lt;/P&gt;&lt;P&gt;         B&lt;SUB&gt;SHKZG B&lt;/SUB&gt;MENGE B&lt;SUB&gt;XAUTO B&lt;/SUB&gt;SOBKZ&lt;/P&gt;&lt;P&gt;  FROM   MSEG AS B&lt;/P&gt;&lt;P&gt;         INNER JOIN MARA AS C&lt;/P&gt;&lt;P&gt;         ON B&lt;SUB&gt;MATNR = C&lt;/SUB&gt;MATNR&lt;/P&gt;&lt;P&gt;  INTO   TABLE IT_STOCK1 FOR ALL ENTRIES IN IT_MKPF&lt;/P&gt;&lt;P&gt;  WHERE  B~MBLNR EQ IT_MKPF-MBLNR AND&lt;/P&gt;&lt;P&gt;         C~SPART IN ('CT', 'AP', 'AU', 'AC' , 'PJ')&lt;/P&gt;&lt;P&gt;         AND B~MATNR IN S_MATNR.&lt;/P&gt;&lt;P&gt; -&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The no. range used for last year and this year is same, and hence I am deleting the duplicates from the MKPF itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I have observed is that, there are two genuine records available in MSEG for a single MKPF document no.  But, in the Itab-2, it is selecting only one record from MSEG, istead of two records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls guide me the solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advace,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MARK K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2006 10:27:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382077#M186399</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-13T10:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382078#M186400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;as u r using FOR ALL ENTRIES it will take only one doc number&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2006 10:30:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382078#M186400</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-13T10:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382079#M186401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to get all the records ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2006 10:31:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382079#M186401</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-13T10:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382080#M186402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All the fields that u r selecting from MSEG and MARA should be same for those two genuine records. That's the reason why only one set of fields are extracted. &lt;/P&gt;&lt;P&gt;Adding primary fields of MSEG and MARA in the selecting part should solve ur problem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2006 10:34:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382080#M186402</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-13T10:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382081#M186403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;oh sorry!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u r using DELETING ADJACENT DUPLICATES COMPARING MBLNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will remove duplicate documents , either specify some more fields in the above statement like &lt;/P&gt;&lt;P&gt;DELETING ADJACENT DUPLICATES COMPARING MBLNR BUDAT ..  or remove this statement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2006 10:35:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382081#M186403</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-13T10:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382082#M186404</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;are you sure those two records qualify the where condition, i feel you got one record because of where condition (only one record satisfied the where condition). can you check it once again&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;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2006 10:36:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382082#M186404</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-13T10:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382083#M186405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;after   deleting  duplicates i think   there is  only  one  value for MBLNR.&lt;/P&gt;&lt;P&gt;when  u  used  for all  entries  in another select it compare  only  one  time   with MBLNR. so  it takes  only  one  value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;avoid   to   used  delete adjucent comparing MBLNR.&lt;/P&gt;&lt;P&gt;for  number range  problem  just use MJAHR field for   current  year u take  it 2006  or sy-datum+0(4)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;SELECT MBLNR BUDAT&lt;/P&gt;&lt;P&gt;FROM MKPF&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE IT_MKPF&lt;/P&gt;&lt;P&gt;WHERE BUDAT LE P_LDATE&lt;/P&gt;&lt;P&gt;and MJAHR = sy-datum+0(4) .&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2006 10:36:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382083#M186405</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-13T10:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382084#M186406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Though i use DELETING ADJACENT DUPLICATES COMPARING MBLNR, there is only record in MKPF table (even without deleting) but for the same document no., there are two records in MSEG.&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>Tue, 13 Jun 2006 10:46:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382084#M186406</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-13T10:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382085#M186407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All the fields that u r selecting from MSEG and MARA should be same for those two genuine records. That's the reason why only one set of fields are extracted. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Adding primary fields of MSEG and MARA in the selection(not extraction) part should solve ur problem&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2006 10:49:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382085#M186407</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-13T10:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382086#M186408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello mark,&lt;/P&gt;&lt;P&gt;You are getting only one entry as you are using 'FOR ALL ENTRIES' statement.&lt;/P&gt;&lt;P&gt;The FOR ALL ENTRIES checks for similar records and considers only one. Refer to Help on 'WHERE' condition - 'for all entries'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will need to loop through the table to be able to select all records.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2006 10:51:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382086#M186408</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-13T10:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382087#M186409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in the select from MSEG you added &amp;lt;b&amp;gt;AND B~MATNR IN S_MATNR&amp;lt;/b&amp;gt; , check this S_MATNR have 2 material numbers or not.&lt;/P&gt;&lt;P&gt;i believe, your S_MATNR is missing out 1 ,so your result also getting based on that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2006 10:51:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382087#M186409</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-13T10:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382088#M186410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Mark,&lt;/P&gt;&lt;P&gt;When U use FOR ALL ENTRIES at that time you should select all the key fields from the table. In your select query you are not selecting fields MJAHR and ZEILE. Try to get these fields in the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this must solve your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Atish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2006 11:20:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1382088#M186410</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-13T11:20:58Z</dc:date>
    </item>
  </channel>
</rss>

