<?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 Select statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2920096#M687617</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi gurus, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a condition where I have an internal table it_tab1 and it_tab1 has material number and price, now I passes this material no. into marc to get the plan information of the corresponding material and for this I have written this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select werks matnr from it_tab1 into table it_tab2&lt;/P&gt;&lt;P&gt;from marc &lt;/P&gt;&lt;P&gt;where matnr = it_tab1-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is this statment right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and now I need to create one more internal table that will have three fields matnr, price and werks and now I need to join it_tab1 and it_tab2 to get price, matnr and werks in my third internal table. &lt;/P&gt;&lt;P&gt;can you please help me out to do this.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rajeev&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Rajeev  Gupta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Oct 2007 20:03:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-19T20:03:36Z</dc:date>
    <item>
      <title>Select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2920096#M687617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi gurus, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a condition where I have an internal table it_tab1 and it_tab1 has material number and price, now I passes this material no. into marc to get the plan information of the corresponding material and for this I have written this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select werks matnr from it_tab1 into table it_tab2&lt;/P&gt;&lt;P&gt;from marc &lt;/P&gt;&lt;P&gt;where matnr = it_tab1-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is this statment right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and now I need to create one more internal table that will have three fields matnr, price and werks and now I need to join it_tab1 and it_tab2 to get price, matnr and werks in my third internal table. &lt;/P&gt;&lt;P&gt;can you please help me out to do this.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rajeev&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Rajeev  Gupta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 20:03:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2920096#M687617</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-19T20:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2920097#M687618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It should be like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select matnr werks from it_tab1 into table it_tab2&lt;/P&gt;&lt;P&gt;from marc&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;for all entries in itab1&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;where matnr = it_tab1-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you get data from MARC into ITAB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort ITAB1 by MATNR.&lt;/P&gt;&lt;P&gt;SORT ITAB2 BY MATNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB2.&lt;/P&gt;&lt;P&gt;READ TABLE ITAB1 WITH KEY MATNR = ITAB2-MATNR BINARY SEARCH.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC EQ 0.&lt;/P&gt;&lt;P&gt;ITAB3-MATNR = ITAB1-MATNR.&lt;/P&gt;&lt;P&gt;ITAB3-WERKS = ITAB2-WERKS.&lt;/P&gt;&lt;P&gt;ITAB3-PRICE = ITAB1-PRICE.&lt;/P&gt;&lt;P&gt;APPEND ITAB3.&lt;/P&gt;&lt;P&gt;CLEAR ITAB3.&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;&lt;/P&gt;&lt;P&gt;Hope this will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 20:08:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2920097#M687618</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-19T20:08: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/2920098#M687619</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;Please try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select werks matnr 
for all entries in it_tab1 
into table it_tab2
from marc 
where matnr = it_tab1-matnr.

loop at it_tab2.
  read table it_tab1 with key matnr = it_tab2-matnr binary search.

  if sy-subrc = 0.
    it_tab3-matnr = it_tab2-matnr.
    it_tab3-werks = it_tab2-werks.
    it_tab3-price = it_tab1-price.
    append it_tab3.
    clear it_tab3.
  endif.

endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 20:09:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2920098#M687619</guid>
      <dc:creator>ferry_lianto</dc:creator>
      <dc:date>2007-10-19T20:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2920099#M687620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;the select statement is wrong&lt;/P&gt;&lt;P&gt;if not it_tab1[] is initial.&lt;/P&gt;&lt;P&gt;select werks matnr into table it_tab2&lt;/P&gt;&lt;P&gt;from marc &lt;/P&gt;&lt;P&gt;for all entries of it_tab1&lt;/P&gt;&lt;P&gt;where matnr = it_tab1-matnr.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_tab1.&lt;/P&gt;&lt;P&gt;  move it_tab1  records to it_tab3.&lt;/P&gt;&lt;P&gt;  read table it_tab2 with key matnr = it_tab1-matnr.&lt;/P&gt;&lt;P&gt;  move the records to it_tab3.&lt;/P&gt;&lt;P&gt;append it_tab3.&lt;/P&gt;&lt;P&gt;clear it_tab3.&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;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 20:11:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2920099#M687620</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-19T20:11:10Z</dc:date>
    </item>
  </channel>
</rss>

