<?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: selecting data from data base tables into itab with multiple select queries in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475831#M1059949</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;the second select has to be like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ... &lt;STRONG&gt;APPENDING CORRESPONDING FIELDS OF&lt;/STRONG&gt; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;ec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Sep 2008 11:25:01 GMT</pubDate>
    <dc:creator>JozsefSzikszai</dc:creator>
    <dc:date>2008-09-05T11:25:01Z</dc:date>
    <item>
      <title>selecting data from data base tables into itab with multiple select queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475830#M1059948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       i am dealing with a situation where in there is 3 DB tables in all say &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          1. ITAB - ZTBL_MAIN.&lt;/P&gt;&lt;P&gt;          2. DB table - ZTBL_SUB1.&lt;/P&gt;&lt;P&gt;          3. DB table - ZTBL_SUB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ZTBL_MAIN contains feilds from both tables 2 and 3 so to choose some records from ZTBL_SUB1 into the ITAB a select query has been written as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM ZTBL_SUB1 INTO CORRESPONDING FIELDS OF TABLE ZTBL_MAIN&lt;/P&gt;&lt;P&gt;    WHERE &amp;lt;condition&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now i also want some feilds in main for each record to be filled from the other DB table for which if i use another select query after the above one in my report prog. say.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM ZTBL_SUB2 INTO CORRESPONDING FIELDS OF TABLE ZTBL_MAIN&lt;/P&gt;&lt;P&gt;    WHERE &amp;lt;condition&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then all the previous records are going to be erased..Kindly let me know a way in which i can implement the above implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&amp;amp;Rgds,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Naveen M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2008 11:22:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475830#M1059948</guid>
      <dc:creator>MNaveen</dc:creator>
      <dc:date>2008-09-05T11:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: selecting data from data base tables into itab with multiple select queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475831#M1059949</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;the second select has to be like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ... &lt;STRONG&gt;APPENDING CORRESPONDING FIELDS OF&lt;/STRONG&gt; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;ec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2008 11:25:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475831#M1059949</guid>
      <dc:creator>JozsefSzikszai</dc:creator>
      <dc:date>2008-09-05T11:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: selecting data from data base tables into itab with multiple select queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475832#M1059950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check the common fields from Table 2 and Table 3, use Inner Join to fetch all the data from the 2 tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;field1 a&lt;/SUB&gt;field2 b&lt;SUB&gt;field1 b&lt;/SUB&gt;field2 INTO CORRESPONDING FIELDS OF TABLE itab &lt;/P&gt;&lt;P&gt;       FROM ZTBL_SUB1 AS a&lt;/P&gt;&lt;P&gt;         INNER JOIN ZTBL_SUB2 AS b ON a&lt;SUB&gt;field3 = b&lt;/SUB&gt;field3 &lt;/P&gt;&lt;P&gt;                              AND a&lt;SUB&gt;field4 = b&lt;/SUB&gt;field4 &lt;/P&gt;&lt;P&gt;                              AND a&lt;SUB&gt;field5 = b&lt;/SUB&gt;field5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Bala Krishna on Sep 5, 2008 4:56 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2008 11:25:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475832#M1059950</guid>
      <dc:creator>former_member585060</dc:creator>
      <dc:date>2008-09-05T11:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: selecting data from data base tables into itab with multiple select queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475833#M1059951</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;The second select statement would be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM ZTBL_SUB2 APPENDING CORRESPONDING FIELDS OF TABLE ZTBL_MAIN&lt;/P&gt;&lt;P&gt;WHERE &amp;lt;condition&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Surinder&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2008 11:30:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475833#M1059951</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-05T11:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: selecting data from data base tables into itab with multiple select queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475834#M1059952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use append in the select query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM ZTBL_SUB1  Appending CORRESPONDING FIELDS OF TABLE ZTBL_MAIN&lt;/P&gt;&lt;P&gt;WHERE &amp;lt;condition&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM ZTBL_SUB2 Appending CORRESPONDING FIELDS OF TABLE ZTBL_MAIN&lt;/P&gt;&lt;P&gt;WHERE &amp;lt;condition&amp;gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2008 11:30:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475834#M1059952</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-05T11:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: selecting data from data base tables into itab with multiple select queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475835#M1059953</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;  If all the tables are related then u can use join condition to achieve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Karthik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2008 11:31:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475835#M1059953</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-05T11:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: selecting data from data base tables into itab with multiple select queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475836#M1059954</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;     When i tried to implement ur suggestion. A syntax error came up saying the table Z_main does not have an header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; i am making use of one of the fields of the itab to define in where condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do we acces the fields of the itab which is declared without headerline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT * FROM z_tbl_sub2 APPENDING CORRESPONDING FIELDS OF TABLE z_tbl_main&lt;/P&gt;&lt;P&gt;    WHERE &amp;lt;field1&amp;gt; = z_tbl_main-&amp;lt;field1&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnks &amp;amp; Rgds,&lt;/P&gt;&lt;P&gt;Naveen M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 04:05:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475836#M1059954</guid>
      <dc:creator>MNaveen</dc:creator>
      <dc:date>2008-09-08T04:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: selecting data from data base tables into itab with multiple select queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475837#M1059955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;     After the first select statement copy all the records in the internal table z_tbl_main&lt;/P&gt;&lt;P&gt;   into another internal table say temp_main&lt;/P&gt;&lt;P&gt;  and then use try with this select statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM z_tbl_sub2 APPENDING CORRESPONDING FIELDS OF TABLE z_tbl_main&lt;/P&gt;&lt;P&gt;for all entries in temp_main&lt;/P&gt;&lt;P&gt;WHERE &amp;lt;field1&amp;gt; = temp_main-&amp;lt;field1&amp;gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 04:33:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475837#M1059955</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-08T04:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: selecting data from data base tables into itab with multiple select queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475838#M1059956</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;    Ur suggestions solved the syntax error. However my intial problem was not solved i.e., using the statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM ztbl_sub2 APPENDING CORRESPONDING FIELDS OF TABLE ztbl_main FOR ALL ENTRIES IN ztbl_main&lt;/P&gt;&lt;P&gt;     WHERE &amp;lt;field1&amp;gt; =  ztbl_main-&amp;lt;field1&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;creates or appends some more entries into the itab thats all.. But that is not what i am trying to implement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As explained before the first select query would have filled certain fields for all records in ztbl_main from ztbl_sub1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in the second select query i want to fill other fields of ztbl_main for all the records already fetched using first select query by using my where condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above select query that was suggested only creates new records in the table ztab_main but does not fill the fields of the records as i expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how do i fullfil my requirment..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kindly help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thnks &amp;amp; Rgds,&lt;/P&gt;&lt;P&gt;Naveen M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 04:59:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475838#M1059956</guid>
      <dc:creator>MNaveen</dc:creator>
      <dc:date>2008-09-08T04:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: selecting data from data base tables into itab with multiple select queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475839#M1059957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;     As sujested in previous post of mine, use INNER JOIN for &lt;/P&gt;&lt;P&gt;ZTBL_SUB1, ZTBL_SUB2  and fill ur ZMAIN internal Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;field1 a&lt;/SUB&gt;field2 b&lt;SUB&gt;field1 b&lt;/SUB&gt;field2 INTO CORRESPONDING FIELDS OF TABLE itab &lt;/P&gt;&lt;P&gt;FROM ZTBL_SUB1 AS a&lt;/P&gt;&lt;P&gt;INNER JOIN ZTBL_SUB2 AS b ON a&lt;SUB&gt;field3 = b&lt;/SUB&gt;field3 &lt;/P&gt;&lt;P&gt;AND a&lt;SUB&gt;field4 = b&lt;/SUB&gt;field4 &lt;/P&gt;&lt;P&gt;AND a&lt;SUB&gt;field5 = b&lt;/SUB&gt;field5.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 05:27:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475839#M1059957</guid>
      <dc:creator>former_member585060</dc:creator>
      <dc:date>2008-09-08T05:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: selecting data from data base tables into itab with multiple select queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475840#M1059958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello  all,&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; Thanks for ur time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnks &amp;amp; Rgds,&lt;/P&gt;&lt;P&gt;Naveen  M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 06:05:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475840#M1059958</guid>
      <dc:creator>MNaveen</dc:creator>
      <dc:date>2008-09-08T06:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: selecting data from data base tables into itab with multiple select queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475841#M1059959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Naveen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       Please try with this method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   1) Select * from ztab1into itab1.&lt;/P&gt;&lt;P&gt;   2) Select * from ztab2 into itab2 for all entries in itab1 where   &amp;lt;field&amp;gt; eq itab1-&amp;lt;field&amp;gt;.&lt;/P&gt;&lt;P&gt;   3) Loop At itab2 into wa_itab2.&lt;/P&gt;&lt;P&gt;         Read Table itab1into wa_itab1with key &amp;lt;field&amp;gt; = wa_itab2-&amp;lt;field&amp;gt;.&lt;/P&gt;&lt;P&gt;         Check for sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;         Now move all the fields from itab1 to itab2.&lt;/P&gt;&lt;P&gt;        for e.g wa_itab2-&amp;lt;field1&amp;gt; = wa_itab1-&amp;lt;field1&amp;gt;.&lt;/P&gt;&lt;P&gt;Then,&lt;/P&gt;&lt;P&gt;       Modify itab2 from wa_itab2.&lt;/P&gt;&lt;P&gt;     Endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 12:43:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-from-data-base-tables-into-itab-with-multiple-select-queries/m-p/4475841#M1059959</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-08T12:43:18Z</dc:date>
    </item>
  </channel>
</rss>

