<?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 Query Problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666789#M1447161</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;Inside loop at you have used select single which will only retrieve one value. 1 ebeln can have more than one document number and the  where condition remains same for all these values. So its retrieving the same value. try the modify statement inside select...endselect instead of select single.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Feb 2010 05:26:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-02-23T05:26:50Z</dc:date>
    <item>
      <title>Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666776#M1447148</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;In my report output is showing like this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PO Number...........Line..............103 Doc................105 Document&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;4500043018...........10...........5000509351...........5000509385&lt;/P&gt;&lt;P&gt;4500043018...........10...........5000521252...........5000509385&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it should be...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PO Number...........Line..............103 Doc................105 Document&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;4500043018...........10...........5000509351...........5000509385&lt;/P&gt;&lt;P&gt;4500043018...........10...........5000521252...........&lt;STRONG&gt;5000522039&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please look at 2nd row...where 105 document number is &lt;STRONG&gt;5000522039&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My select query is..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;aedat a&lt;/SUB&gt;lifnr b&lt;SUB&gt;ebeln b&lt;/SUB&gt;ebelp b&lt;SUB&gt;gjahr b&lt;/SUB&gt;belnr b&lt;SUB&gt;bwart b&lt;/SUB&gt;budat b&lt;SUB&gt;bamng b&lt;/SUB&gt;xblnr b&lt;SUB&gt;lfgja b&lt;/SUB&gt;lfbnr b&lt;SUB&gt;lfpos b&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;                                                      INTO CORRESPONDING FIELDS OF TABLE itab&lt;/P&gt;&lt;P&gt;                                                      FROM ekko AS a&lt;/P&gt;&lt;P&gt;                                                      INNER JOIN ekbe AS b ON a&lt;SUB&gt;ebeln = b&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;                                                      WHERE b~ebeln IN ebeln&lt;/P&gt;&lt;P&gt;                                                      AND b~ebelp IN ebelp&lt;/P&gt;&lt;P&gt;                                                      AND b~bwart EQ '103'&lt;/P&gt;&lt;P&gt;                                                      AND a~lifnr IN lifnr&lt;/P&gt;&lt;P&gt;                                                      AND b~budat IN budat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  MESSAGE 'DATA NOT FOUND.' TYPE 'I'(001).&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT itab BY ebeln ebelp.&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;  SELECT SINGLE belnr budat menge dmbtr waers xblnr FROM ekbe INTO (itab-belnr1, itab-budat1, itab-menge1, itab-dmbtr1, itab-waers1, itab-xblnr1)&lt;/P&gt;&lt;P&gt;                                  WHERE lfbnr = itab-lfbnr AND lfpos = itab-lfpos AND bwart EQ '105' AND ebeln = itab-ebeln AND ebelp = itab-ebelp.&lt;/P&gt;&lt;P&gt;  MODIFY itab INDEX sy-tabix TRANSPORTING belnr1 budat1 menge1 dmbtr1 waers1 xblnr1 .&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;In this case, lfbnr = itab-lfbnr has no value else in ITAB or EKBE table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is showing correct value in 1st row...but not clearing the itab in 2nd row for 105 document number...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What should be do..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 03:39:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666776#M1447148</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T03:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666777#M1447149</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 first query you are getting ebeln, ebelp, gjahr, belnr, bwart, budat, bamng, xblnr, lfgja, lfbnr, lfpos and matnr from EKBE table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And according to you, you are not getting any values in field lfbnr. So. you can use only &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;SELECT SINGLE belnr budat menge dmbtr waers xblnr FROM ekbe INTO (itab-belnr1, itab-budat1, itab-menge1, itab-dmbtr1, itab-waers1, itab-xblnr1)&lt;/P&gt;&lt;P&gt;WHERE &lt;/P&gt;&lt;P&gt;ebeln = itab-ebeln AND &lt;/P&gt;&lt;P&gt;ebelp = itab-ebelp AND&lt;/P&gt;&lt;P&gt;gjahr = itab-gjahr AND&lt;/P&gt;&lt;P&gt;belnr = itab-belnr AND &lt;/P&gt;&lt;P&gt;bwart EQ '105' AND &lt;/P&gt;&lt;P&gt;lfpos = itab-lfpos.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY itab INDEX sy-tabix TRANSPORTING belnr1 budat1 menge1 dmbtr1 waers1 xblnr1 .&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;Try this out. Here we will providing maximum key fields to EKBE table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Archana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 03:48:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666777#M1447149</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T03:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666778#M1447150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;as per ur suggested code...no value in 105 document number field...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 03:57:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666778#M1447150</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T03:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666779#M1447151</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;Well, i think this is only problem with your where condition. You will have to check it with trial and method i suppose. So, before executing query, you can just try in se11 by passing just ebeln, ebelp and bwart if it is retrieving corrrect values. So, accordingly you can modify your select query as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Archana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 04:10:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666779#M1447151</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T04:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666780#M1447152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LOOP AT itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE belnr budat menge dmbtr waers xblnr FROM ekbe INTO (itab-belnr1, itab-budat1, itab-menge1, itab-dmbtr1, itab-waers1, itab-xblnr1)&lt;/P&gt;&lt;P&gt;WHERE &lt;/P&gt;&lt;P&gt;ebeln = itab-ebeln AND &lt;/P&gt;&lt;P&gt;ebelp = itab-ebelp AND&lt;/P&gt;&lt;P&gt;gjahr = itab-gjahr AND &lt;STRONG&gt;(Remove BELNR in Archana's suggestion; BELNR will be unique for each doc)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;bwart EQ '105' AND &lt;/P&gt;&lt;P&gt;lfpos = itab-lfpos.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY itab INDEX sy-tabix TRANSPORTING belnr1 budat1 menge1 dmbtr1 waers1 xblnr1 .&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;Hope this works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One thing which I didn't understand is do you need to fire a select inside loop for this requirement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ganga&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 04:11:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666780#M1447152</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T04:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666781#M1447153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please correct you query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are trying to query the same table ekbe again...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why is it required.. You can fetch the values from the first query itself..!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 04:13:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666781#M1447153</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T04:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666782#M1447154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;after amend this one, same output is showing...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PO Number...........Line..............103 Doc................105 Document&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;4500043018...........10...........5000509351...........5000509385&lt;/P&gt;&lt;P&gt;4500043018...........10...........5000521252...........5000509385&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 04:16:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666782#M1447154</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T04:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666783#M1447155</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 below logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per your requirement, you need materials for which 103 movement type is done and 105 is NOT done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So after fetching 103 and 105 docs from EKBE, you have to filter out the materials for which 103 is done and 105 NOT done. For that use the below logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT a~aedat a~lifnr b~ebeln b~ebelp b~gjahr b~belnr b~bwart b~budat b~bamng b~xblnr b~lfgja b~lfbnr b~lfpos b~matnr
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ekko AS a
INNER JOIN ekbe AS b ON a~ebeln = b~ebeln
WHERE b~ebeln IN ebeln
AND b~ebelp IN ebelp
AND b~bwart in ( '103', '105')
AND a~lifnr IN lifnr
AND b~budat IN budat.

T_EKBE_103 = T_EKBE.
Delete T_EKBE_103 where BWART = '105'.

T_EKBE_105 = T_EKBE.
Delete T_EKBE_105 where BWART = '103'.

Loop at T_EKBE_103.
Read T_EKBE_105 with key EBELN = T_EKBE_103-EBELN EBELP = T_EKBE_103-EBELP.
If SY-SUBRC is not equal to 0.
Append T_EKBE_103 to T_FINAL.
Endif.
Endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;After this T_FINAL consists of materials for which 103 is posted and 105 NOT posted.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is already a thread posted by you for this requirement for which I gave you the logic as below.&lt;/P&gt;&lt;P&gt;[&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="8745687"&gt;&lt;/A&gt;]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ganga&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 04:24:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666783#M1447155</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T04:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666784#M1447156</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;PRE&gt;&lt;CODE&gt;SELECT a~aedat a~lifnr b~ebeln b~ebelp b~gjahr b~belnr b~bwart b~budat b~bamng b~xblnr b~lfgja b~lfbnr b~lfpos b~matnr
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ekko AS a
INNER JOIN ekbe AS b ON a~ebeln = b~ebeln
WHERE b~ebeln IN ebeln
AND b~ebelp IN ebelp
AND ( b~bwart EQ '103' or b~bwart Eq '105' ) " Add this 
AND a~lifnr IN lifnr" Avoid mulitple Call to same DB table this will improve performance
AND b~budat IN budat.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheerz&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 04:25:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666784#M1447156</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T04:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666785#M1447157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now output is showing correct but ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PO Number........Line.......103 Doc. No.........105 Doc. No.........&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;4500043018........10........5000509351&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4500043018........10........5000509385&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;4500043018........10........5000521252&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4500043018........10........5000522039&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here in below 105 document number, no records shows...because 105 document number shows under 103 document number..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can we query because we want 105 doc. number under itself heading...not under 103 document number.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 04:35:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666785#M1447157</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T04:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666786#M1447158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks dear...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as per ur suggested code.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : t_ekbe TYPE ekbe.&lt;/P&gt;&lt;P&gt;DATA : t_ekbe_103 TYPE ekbe OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA : t_ekbe_105 TYPE ekbe OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;aedat a&lt;/SUB&gt;lifnr b&lt;SUB&gt;ebeln b&lt;/SUB&gt;ebelp b&lt;SUB&gt;gjahr b&lt;/SUB&gt;belnr b&lt;SUB&gt;bwart b&lt;/SUB&gt;budat b&lt;SUB&gt;bamng b&lt;/SUB&gt;xblnr b&lt;SUB&gt;lfgja b&lt;/SUB&gt;lfbnr b&lt;SUB&gt;lfpos b&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE itab&lt;/P&gt;&lt;P&gt;FROM ekko AS a&lt;/P&gt;&lt;P&gt;INNER JOIN ekbe AS b ON a&lt;SUB&gt;ebeln = b&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;WHERE b~ebeln IN ebeln&lt;/P&gt;&lt;P&gt;AND b~ebelp IN ebelp&lt;/P&gt;&lt;P&gt;AND b~bwart IN ('103', '105')&lt;/P&gt;&lt;P&gt;AND a~lifnr IN lifnr&lt;/P&gt;&lt;P&gt;AND b~budat IN budat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  MESSAGE 'DATA NOT FOUND.' TYPE 'I'(001).&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT itab BY ebeln ebelp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_ekbe_103 = t_ekbe.&lt;/P&gt;&lt;P&gt;DELETE t_ekbe_103 WHERE bwart = '105'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_ekbe_105 = t_ekbe.&lt;/P&gt;&lt;P&gt;DELETE t_ekbe_105 WHERE bwart = '103'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT t_ekbe_103.&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;READ t_ekbe_105 WITH KEY ebeln = t_ekbe_103-ebeln ebelp = t_ekbe_103-ebelp.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc IS NOT EQUAL to 0.&lt;/P&gt;&lt;P&gt;    APPEND t_ekbe_103 TO t_final.&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;Error is showing on READ Statement "Unable to Interpret "t_ekbe_105". Possible Cause: Incorrect spelling or comma error"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what should be the problem here...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 04:45:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666786#M1447158</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T04:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666787#M1447159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should use Read &lt;STRONG&gt;table&lt;/STRONG&gt; T_EKBE_105...etc...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 05:03:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666787#M1447159</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T05:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666788#M1447160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ABAP,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PO Number........Line....Mtype...103 Doc. No.........105 Doc. No.........&lt;/P&gt;&lt;P&gt;4500043018........10......103....5000509351&lt;/P&gt;&lt;P&gt;4500043018........10......105....5000509385&lt;/P&gt;&lt;P&gt;4500043018........10.......103...5000521252&lt;/P&gt;&lt;P&gt;4500043018........10.......105...5000522039&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here also add 1 more colom movement type....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please see..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : wa type itab.&lt;/P&gt;&lt;P&gt;         wa1 type itab.&lt;/P&gt;&lt;P&gt;take 2 more itab with same structure..let say it_itab, itab2.&lt;/P&gt;&lt;P&gt;itab2[] = itab[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa.&lt;/P&gt;&lt;P&gt;read table itab2 into wa1 with key ebeln = po and mtype =  '105' and docno ne wa-docno.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;wa-105doc = wa1-105doc.&lt;/P&gt;&lt;P&gt;append wa to it_itab.&lt;/P&gt;&lt;P&gt;delete itab where ebeln = po and mtype = 105 and docno = wa-docno.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 05:20:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666788#M1447160</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T05:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666789#M1447161</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;Inside loop at you have used select single which will only retrieve one value. 1 ebeln can have more than one document number and the  where condition remains same for all these values. So its retrieving the same value. try the modify statement inside select...endselect instead of select single.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 05:26:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666789#M1447161</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T05:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666790#M1447162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First i declare..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : wa TYPE itab,&lt;/P&gt;&lt;P&gt;       wa1 TYPE itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and take 2 more itab with same structure..let say it_itab, itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in loop at itab...after 1st select query..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab INTO wa.&lt;/P&gt;&lt;P&gt;  READ TABLE itab2 INTO wa1 WITH KEY ebeln = wa-ebeln and bwart = '105' and belnr ne wa-belnr.&lt;/P&gt;&lt;P&gt;  IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    wa-105doc = wa1-105doc.&lt;/P&gt;&lt;P&gt;    APPEND wa TO it_itab.&lt;/P&gt;&lt;P&gt;    DELETE itab WHERE ebeln = wa-ebeln AND bwart = '105' AND belnr ne wa-belnr.&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;there error showing like...on &lt;STRONG&gt;LOOP AT itab INTO wa&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A line of "ITAB" and "WA" are not mutually convertible. In a Unicode program, "ITAB" must have the same structure layout as "WA",  irrespective of the length of a Unicode character. Unicode character.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz help...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 07:16:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666790#M1447162</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T07:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666791#M1447163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The declaration for work ares should be like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA : wa LIKE LINE OF itab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should correct your compilation error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 07:26:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666791#M1447163</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-02-23T07:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666792#M1447164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;Check itab and wa structres ,This error is mismatch of structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:itab type table of ty_tab,&lt;/P&gt;&lt;P&gt;        wa like line of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;READ TABLE itab2 INTO wa1 WITH KEY ebeln  =  wa-ebeln 
                                                                bwart  =  '105'
                                                                belnr   &amp;lt; &amp;gt; (NotEqual) wa-belnr1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not Equal &amp;lt;, &amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: dharma raj on Feb 23, 2010 1:11 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 07:26:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666792#M1447164</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T07:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666793#M1447165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now it is showing error  &lt;STRONG&gt;"= ..." expected after "BELNR"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  READ TABLE itab2 INTO wa1 WITH KEY ebeln = wa-ebeln bwart = '105' &lt;STRONG&gt;belnr ne wa-belnr1&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz help..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 07:35:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666793#M1447165</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T07:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666794#M1447166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please try this way and see,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;aedat a&lt;/SUB&gt;lifnr b&lt;SUB&gt;ebeln b&lt;/SUB&gt;ebelp b&lt;SUB&gt;gjahr b&lt;/SUB&gt;belnr b&lt;SUB&gt;bwart b&lt;/SUB&gt;budat b&lt;SUB&gt;bamng b&lt;/SUB&gt;xblnr b&lt;SUB&gt;lfgja b&lt;/SUB&gt;lfbnr b&lt;SUB&gt;lfpos b&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE itab&lt;/P&gt;&lt;P&gt;FROM ekko AS a&lt;/P&gt;&lt;P&gt;INNER JOIN ekbe AS b ON a&lt;SUB&gt;ebeln = b&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;WHERE b~ebeln IN ebeln&lt;/P&gt;&lt;P&gt;AND b~ebelp IN ebelp&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;&lt;DEL&gt;"AND b~bwart EQ '103'&lt;/DEL&gt;  + " comment it here+&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;AND a~lifnr IN lifnr&lt;/P&gt;&lt;P&gt;AND b~budat IN budat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE 'DATA NOT FOUND.' TYPE 'I'(001).&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT itab BY ebeln ebelp.&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-bwart = '103' .&lt;/P&gt;&lt;P&gt;  move gwa_itab to gwa_itab_final.&lt;/P&gt;&lt;P&gt;elseif itab-bwart = '105'.&lt;/P&gt;&lt;P&gt;  if   gwa_itab_final-lfbnr = gwa_itab-lfbnr &lt;/P&gt;&lt;P&gt;   and gwa_itab_final-lfpos = gwa_itab-lfpos .&lt;/P&gt;&lt;P&gt;     move gwa_itab-belnr to gwa_itab_final-belnr1.&lt;/P&gt;&lt;P&gt;     move gwa_itab-budat to gwa_itab_final-budat1.&lt;/P&gt;&lt;P&gt;     move gwa_itab-menge to gwa_itab_final-menge1.&lt;/P&gt;&lt;P&gt;     move gwa_itab-dmbtr to gwa_itab_final-dmbtr1.&lt;/P&gt;&lt;P&gt;     move gwa_itab-waers to gwa_itab_final-waers1.&lt;/P&gt;&lt;P&gt;     move gwa_itab-xblnr to gwa_itab_final-xblnr1.&lt;/P&gt;&lt;P&gt;     append gwa_itab_final to gt_final.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;else. &lt;EM&gt;"if any other bwart set it to space to remove it later from the internal table.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; itab-bwart = ''.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY itab INDEX sy-tabix TRANSPORTING  bwart belnr1 budat1 menge1 dmbtr1 waers1 xblnr1 .&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;delete itab where bwart = space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the gt_itab_final shud be ur final internal table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 07:49:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666794#M1447166</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T07:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666795#M1447167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is because READ TABLE does not support NE operator with the KEY addition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do not take it in the wrong sense, but i think you should get your basics clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 08:23:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/6666795#M1447167</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-02-23T08:23:58Z</dc:date>
    </item>
  </channel>
</rss>

