<?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 data from two tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215501#M1206231</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;first select ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select bukrs f2 f3 ... from table1 into itab1 up to 10 rows.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  select (all the key fields) from table2 into itab2&lt;/P&gt;&lt;P&gt;            for all entries in itab1&lt;/P&gt;&lt;P&gt;            where bukrs = itab1-bukrs. &lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Feb 2009 06:09:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-02-17T06:09:44Z</dc:date>
    <item>
      <title>select data from two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215498#M1206228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;tab1 : select 10 rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tab2 : for the above 10 rows for each has 20 rows in tab2 ( duplicare records ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but both tables common field is BUKRS only .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how can i select data .&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;Mk.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2009 06:05:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215498#M1206228</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-17T06:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: select data from two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215499#M1206229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; What r the Tables.. I mean the table Name &amp;amp; what is your scenario..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2009 06:08:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215499#M1206229</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-17T06:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: select data from two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215500#M1206230</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 Upto 10 rows in select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM mara UP TO 10 ROWS INTO TABLE itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the first select query and use for all entries in first select query internal table the second select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will solve ur problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2009 06:09:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215500#M1206230</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-17T06:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: select data from two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215501#M1206231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;first select ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select bukrs f2 f3 ... from table1 into itab1 up to 10 rows.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  select (all the key fields) from table2 into itab2&lt;/P&gt;&lt;P&gt;            for all entries in itab1&lt;/P&gt;&lt;P&gt;            where bukrs = itab1-bukrs. &lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2009 06:09:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215501#M1206231</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-17T06:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: select data from two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215502#M1206232</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 LEFT OUTER JOIN hope will solve out your problem, Have a look at the following Sample Code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select anla~anln1 anla~ord41 anla~ord43 anla~ord44 anla~invnr anla~sernr anlu~zdate anlu~zztot_status
         a~ordtx as tot_desc b~ordtx as mod_desc c~ordtx as injec_cat
          into corresponding fields of table it_asset_details
          from anla
          inner join anlu  on ( anla~bukrs = anlu~bukrs and anla~anln1 = anlu~anln1 and anla~anln2 = anlu~anln2 )
          left outer join t087t as a on ( anla~ord41 = a~ord4x and a~spras = 'E' and a~ordnr = '1' )
          left outer join t087t as b on ( anla~ord43 = b~ord4x and b~spras = 'E' and b~ordnr = '3' )
          left outer join t087t as c on ( anla~ord44 = c~ord4x and c~spras = 'E' and c~ordnr = '4' )
          where anlu~zzssok = outlet_id.
  sort it_asset_details by zdate.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Faisal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2009 06:10:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215502#M1206232</guid>
      <dc:creator>faisalatsap</dc:creator>
      <dc:date>2009-02-17T06:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: select data from two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215503#M1206233</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 FOR ALL ENTERIES,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for the second table query write as&lt;/P&gt;&lt;P&gt;select &amp;lt;required Fields&amp;gt; from &amp;lt;tabname&amp;gt; into table itab2 FOR ALL ENTERIES &amp;lt;first Table Name&amp;gt;&lt;/P&gt;&lt;P&gt;where BUKRS = itab1-BUKRS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2009 06:11:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215503#M1206233</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-17T06:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: select data from two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215504#M1206234</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;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from tab1 into itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from tab2 FOR all entries in itab1 into itab2 where bukrs = itab1-bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Surinder&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2009 06:11:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215504#M1206234</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-17T06:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: select data from two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215505#M1206235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use for all entries ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{select &amp;lt;field names&amp;gt; &lt;/P&gt;&lt;P&gt;          bukrs&lt;/P&gt;&lt;P&gt;from tale1&lt;/P&gt;&lt;P&gt;into table itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;select &amp;lt;field names&amp;gt;&lt;/P&gt;&lt;P&gt;from table2&lt;/P&gt;&lt;P&gt;into table itab2&lt;/P&gt;&lt;P&gt;for all entries in itab1&lt;/P&gt;&lt;P&gt;where bukrs = itab1-bukrs.&lt;/P&gt;&lt;P&gt;endif.}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2009 06:12:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215505#M1206235</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-17T06:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: select data from two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215506#M1206236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to all for reply,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the code is below plz coorect me : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form get_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT bukrs belnr budat awkey&lt;/P&gt;&lt;P&gt;    INTO TABLE it_final&lt;/P&gt;&lt;P&gt;    FROM bkpf&lt;/P&gt;&lt;P&gt;    WHERE  bukrs = bukrs AND&lt;/P&gt;&lt;P&gt;           budat IN budat AND&lt;/P&gt;&lt;P&gt;          ( blart =  'RE' OR&lt;/P&gt;&lt;P&gt;            blart = 'RN' ) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT IT_FINAL BY belnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP at it_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;V_AWKEY = it_final-awkey(10).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT  BUKRS belnr ebeln ebelp matnr menge salk3 kschl wrbtr lifnr shkzg xblnr BUZEI &lt;/P&gt;&lt;P&gt;      INTO  TABLE  it_rseg&lt;/P&gt;&lt;P&gt;       from rseg &lt;/P&gt;&lt;P&gt;       where belnr = V_AWKEY .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT it_rseg by belnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_rseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it_final-belnr = it_rseg-belnr.&lt;/P&gt;&lt;P&gt;it_final-xblnr = it_rseg-xblnr.&lt;/P&gt;&lt;P&gt;it_final-buzei = it_rseg-buzei.&lt;/P&gt;&lt;P&gt;&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;modify it_final.&lt;/P&gt;&lt;P&gt;CLEAR it_final.&lt;/P&gt;&lt;P&gt;CLEAR V_AWKEY.&lt;/P&gt;&lt;P&gt;CLEAR it_rseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2009 06:13:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215506#M1206236</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-17T06:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: select data from two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215507#M1206237</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;Don't post same question multiple times, Use same thread.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2009 06:25:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215507#M1206237</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-17T06:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: select data from two tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215508#M1206238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2009 11:27:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-data-from-two-tables/m-p/5215508#M1206238</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-24T11:27:59Z</dc:date>
    </item>
  </channel>
</rss>

