<?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 into table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142811#M451590</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;select vbeln posnr vtweg spart from zx1 into table itab1 where....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not itab1[] is initial.&lt;/P&gt;&lt;P&gt;itab2[] = itab1[].&lt;/P&gt;&lt;P&gt;sort itab2 by vtweg spart.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab2 comparing vtweg spart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select knuma &lt;/P&gt;&lt;P&gt;          vtweg spart from zx2 into table itab3&lt;/P&gt;&lt;P&gt;          for all entries in itab2&lt;/P&gt;&lt;P&gt;          where vtweg = itab2-vtweg&lt;/P&gt;&lt;P&gt;           and spart = itab2-spart.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab3 by vtweg spart.&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;move-corresponding itab1 to itabfinal.&lt;/P&gt;&lt;P&gt;read table itab3 with key vtweg = itab1-vtweg spart = itab1-spart.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt; move itab3-knuma to itabfinal-knuma.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;append itabfinal.&lt;/P&gt;&lt;P&gt;clear itabfinal.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now the itabfinal contains the required data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Apr 2007 06:23:29 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-12T06:23:29Z</dc:date>
    <item>
      <title>select into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142808#M451587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi every one.,&lt;/P&gt;&lt;P&gt;let me anybody know,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. in table zx1 i am having fields VBELN , POSNR,  VTWEG, SPART &lt;/P&gt;&lt;P&gt; ( ex 900001 11 de 50 , 900001 ,12 ,de 50)&lt;/P&gt;&lt;P&gt;2. in table zx2 i am having fields KNUMA VTWEG SPART&lt;/P&gt;&lt;P&gt;   ( 122 de 50 , 234 de 50, 345 de 50).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i want to pass into final table with six records.&lt;/P&gt;&lt;P&gt;i.e &lt;/P&gt;&lt;P&gt;VBELN    POSNR   KNUMA&lt;/P&gt;&lt;P&gt;900001     11           122 &lt;/P&gt;&lt;P&gt;900001     11           234 &lt;/P&gt;&lt;P&gt;900001     11          345 &lt;/P&gt;&lt;P&gt;900001     12          122 &lt;/P&gt;&lt;P&gt;900001     12          234 &lt;/P&gt;&lt;P&gt;900001     12          345 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But iam not able to fetch the data , please anybody let me know &lt;/P&gt;&lt;P&gt;how to select the data .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2007 06:13:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142808#M451587</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-12T06:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: select into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142809#M451588</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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use inner join on two tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select zx1&lt;SUB&gt;vbeln zx1&lt;/SUB&gt;posnr zx2~knuma&lt;/P&gt;&lt;P&gt;from zx1 as zx1 &lt;/P&gt;&lt;P&gt;inner join zx2 as zx2 &lt;/P&gt;&lt;P&gt;on zx1&lt;SUB&gt;vtweg eq zx2&lt;/SUB&gt;vtweg&lt;/P&gt;&lt;P&gt;and zx1&lt;SUB&gt;spart eq zx2&lt;/SUB&gt;spart&lt;/P&gt;&lt;P&gt;into table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points if helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2007 06:19:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142809#M451588</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-12T06:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: select into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142810#M451589</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;&amp;lt;b&amp;gt;select zx1&lt;SUB&gt;VBELN   zx1&lt;/SUB&gt;POSNR   zx2~KNUMA&lt;/P&gt;&lt;P&gt;from zx1 inner join zx2 &lt;/P&gt;&lt;P&gt;on zx1&lt;SUB&gt;SPART = zx2&lt;/SUB&gt;SPART and&lt;/P&gt;&lt;P&gt;   zx1&lt;SUB&gt;vtweg = zx2&lt;/SUB&gt;vtweg &lt;/P&gt;&lt;P&gt;into itab&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;up to 6 rows&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where zx1~posnr eq '000011' or&lt;/P&gt;&lt;P&gt;          zx1~posnr eq '000012'.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2007 06:22:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142810#M451589</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-12T06:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: select into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142811#M451590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;select vbeln posnr vtweg spart from zx1 into table itab1 where....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not itab1[] is initial.&lt;/P&gt;&lt;P&gt;itab2[] = itab1[].&lt;/P&gt;&lt;P&gt;sort itab2 by vtweg spart.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab2 comparing vtweg spart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select knuma &lt;/P&gt;&lt;P&gt;          vtweg spart from zx2 into table itab3&lt;/P&gt;&lt;P&gt;          for all entries in itab2&lt;/P&gt;&lt;P&gt;          where vtweg = itab2-vtweg&lt;/P&gt;&lt;P&gt;           and spart = itab2-spart.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab3 by vtweg spart.&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;move-corresponding itab1 to itabfinal.&lt;/P&gt;&lt;P&gt;read table itab3 with key vtweg = itab1-vtweg spart = itab1-spart.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt; move itab3-knuma to itabfinal-knuma.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;append itabfinal.&lt;/P&gt;&lt;P&gt;clear itabfinal.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now the itabfinal contains the required data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2007 06:23:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142811#M451590</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-12T06:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: select into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142812#M451591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For this application, the tables zx1 and zx2 should have atleast one field in common (apert from MANDT). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once the above requirement is fuilfilled, you can use JOIN to get the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you wish to select data into two tables and build final internal table (without join), then both the internal tables should have the common field defined. After the selection:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab1.&lt;/P&gt;&lt;P&gt; LOOP or READ itab2 with the condition&lt;/P&gt;&lt;P&gt;APPEND Final Table&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2007 06:23:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142812#M451591</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-12T06:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: select into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142813#M451592</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;u can use Inner join for this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT  VBELN  POSNR  KNUMA&lt;/P&gt;&lt;P&gt;INTO TABLE ITAB&lt;/P&gt;&lt;P&gt;FROM ZX1 AS ZX1 INNER JOIN ZX2 AS ZX2 &lt;/P&gt;&lt;P&gt;ON ZX1&lt;SUB&gt;VTWEG EQ ZX2&lt;/SUB&gt;VTWEG AND&lt;/P&gt;&lt;P&gt;ZX1&lt;SUB&gt;SPART EQ ZX2&lt;/SUB&gt;SPART.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;sai ramesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2007 06:24:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142813#M451592</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-12T06:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: select into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142814#M451593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I hope you are talking about the Billing Tables VBRK and VBRP:&lt;/P&gt;&lt;P&gt;Based on the data it is clear because  the fields&lt;/P&gt;&lt;P&gt;VBELN , POSNR, VTWEG, SPART  are in VBRP .&lt;/P&gt;&lt;P&gt;and the fields  KNUMA VTWEG SPART are in VBRK .&lt;/P&gt;&lt;P&gt;You can join the header and Item tables VBRK and VBRP&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;select a&lt;SUB&gt;vbeln b&lt;/SUB&gt;posnr a&lt;SUB&gt;vtweg a&lt;/SUB&gt;spart a~knuma into table ITAB&lt;/P&gt;&lt;P&gt;  from VBRK as  a join VBRP as b on &lt;/P&gt;&lt;P&gt;   a&lt;SUB&gt;vbeln = b&lt;/SUB&gt;vbeln &lt;/P&gt;&lt;P&gt;   where  a~vbeln  in S_vbeln  (or = p_vbeln).&amp;lt;/b&amp;gt;this is the right method. use it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points if useful&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>Thu, 12 Apr 2007 06:27:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142814#M451593</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-12T06:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: select into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142815#M451594</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;I think you code should look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at zX1.&lt;/P&gt;&lt;P&gt;  loop at zx2 where vtweg = zx1-vtweg and&lt;/P&gt;&lt;P&gt;                    spart = zx1-spart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     final-vbeln = zx1-vbeln.&lt;/P&gt;&lt;P&gt;     final-posnr = zx1-posnr.&lt;/P&gt;&lt;P&gt;     final-knuma = zx2-knuma.&lt;/P&gt;&lt;P&gt;     append final.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;S. Chandra Mouli.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2007 06:27:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-into-table/m-p/2142815#M451594</guid>
      <dc:creator>former_member784222</dc:creator>
      <dc:date>2007-04-12T06:27:47Z</dc:date>
    </item>
  </channel>
</rss>

