<?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 with join from the same fields into two different fields in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972920#M399024</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Answered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Feb 2007 16:32:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-02-09T16:32:04Z</dc:date>
    <item>
      <title>Select with join from the same fields into two different fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972911#M399015</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;Is it possible to solve, in one SELECT command?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like join two tables (AUFK and VAFILOA), and both tables have the same field (GSBER). This field conatins two different values in the two table, because in AUFK it is the source, and in VAFILOA it is the receiver. The tables are connected by AUFNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know, can I read with ONE SELECT/JOIN into two different fields of an internal table (for example: GSBER_SOURCE and GSBER_RECEIVER).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx in advance&lt;/P&gt;&lt;P&gt;Tamá&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 16:09:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972911#M399015</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T16:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Select with join from the same fields into two different fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972912#M399016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi tamas,&lt;/P&gt;&lt;P&gt;  It is very much possible:&lt;/P&gt;&lt;P&gt;I tried this example:&lt;/P&gt;&lt;P&gt;data: v_gsber1 type aufk-gsber,&lt;/P&gt;&lt;P&gt;      v_gsber2 type VAFILOA-gsber,&lt;/P&gt;&lt;P&gt;      v_aufnr type aufk-aufnr.&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;select single aufk~GSBER&lt;/P&gt;&lt;P&gt;       VAFILOA~gsber&lt;/P&gt;&lt;P&gt;  from aufk inner join VAFILOA&lt;/P&gt;&lt;P&gt;  on aufk&lt;SUB&gt;aufnr = VAFILOA&lt;/SUB&gt;aufnr&lt;/P&gt;&lt;P&gt;  into (v_gsber1 , v_gsber2)&lt;/P&gt;&lt;P&gt;  where aufk~aufnr = v_aufnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 16:14:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972912#M399016</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T16:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Select with join from the same fields into two different fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972913#M399017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you can. Select GSBER from two tables with alias and put it into GSBER_SOURCE and GSBER_RECEIVER of internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 16:15:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972913#M399017</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T16:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Select with join from the same fields into two different fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972914#M399018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sure you can do this.  First declare you itab, then do a join in your select&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select aufk&lt;SUB&gt;gsber vafiloa&lt;/SUB&gt;gsber&lt;/P&gt;&lt;P&gt;from aufk &lt;/P&gt;&lt;P&gt;join vafiloa&lt;/P&gt;&lt;P&gt;on aufk&lt;SUB&gt;AUFNR = vafiloa&lt;/SUB&gt;AUFNR&lt;/P&gt;&lt;P&gt;into table itab.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 16:19:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972914#M399018</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T16:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select with join from the same fields into two different fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972915#M399019</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, not only these fields are selected, so my select seems like this now...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you might see it is using corresponding fields. Is it possible to solve this task this way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

    SELECT aufk~auart afko~aufnr aufk~ktext aufk~objnr afko~aufpl
           vafiloa~iloan iloa~tplnr vafiloa~equnr aufk~kostv
           vafiloa~anlnr vafiloa~anlun aufk~bukrs aufk~kostl
           aufk~zzkocsiszam aufk~werks iloa~gsber
             FROM aufk
             INNER JOIN afih ON afih~aufnr = aufk~aufnr
             INNER JOIN afko ON afko~aufnr = aufk~aufnr
             INNER JOIN vafiloa ON afko~aufnr = vafiloa~aufnr
             INNER JOIN iloa ON iloa~iloan = vafiloa~iloan
             INTO CORRESPONDING FIELDS OF TABLE gt_rendeles
           FOR ALL ENTRIES IN gt_rendeles_teny
           WHERE aufk~auart IN s_auart
             AND aufk~bukrs IN s_bukrs
             AND aufk~kostv IN s_kostv
             AND aufk~kostl IN s_kostl
             AND aufk~werks IN s_werks
             AND aufk~zzkocsiszam IN s_kocsi
             AND vafiloa~equnr IN s_equnr  "berendezés
             AND iloa~tplnr IN s_tplnr     "m&amp;amp;#369;szaki hely
             AND aufk~objnr = gt_rendeles_teny-objnr. "ténykönyvelés van

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx &lt;/P&gt;&lt;P&gt;Tamá&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 16:19:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972915#M399019</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T16:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: Select with join from the same fields into two different fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972916#M399020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tamás,&lt;/P&gt;&lt;P&gt; Unfortunately you cannot do that way. because, when you use the into corresponding fields of, addition the system, checks if the name of the database field and the name of the field in the internal table to be the same.&lt;/P&gt;&lt;P&gt;YOu cannot have GSBER as the field name for two different fields,&lt;/P&gt;&lt;P&gt;so you can have a temporary table with only those fields exactky is the same order in which they are selected and have the command:&lt;/P&gt;&lt;P&gt;INTO  TABLE gt_rendeles_temp&lt;/P&gt;&lt;P&gt;instead of INTO CORRESPONDING FIELDS OF TABLE gt_rendeles.&lt;/P&gt;&lt;P&gt;(The catch is that you need to have the fields of gt_rendeles_temp as the same order as they appear in the select statement.)&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 16:23:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972916#M399020</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T16:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Select with join from the same fields into two different fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972917#M399021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add aufk&lt;SUB&gt;GSBER and vafiloa&lt;/SUB&gt;GSBER in your select, then in your definition of table gt_rendeles make the order of the fields the same as in your select statement, then use "INTO TABLE GT_RENDELES".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will only work if the fields you select are celcard in the exact order as gt_rendeles.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 16:24:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972917#M399021</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T16:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: Select with join from the same fields into two different fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972918#M399022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, It should not be a problem to get it done in one select with JOIN.&lt;/P&gt;&lt;P&gt;Have a look here for example  :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: BEGIN OF lt_temp OCCURS 0,
          gsber_source TYPE aufk-gsber,
          gsber_dest TYPE aufk-gsber,
      END OF lt_temp.
SELECT a~gsber
       b~gsber
  FROM aufk AS a
       JOIN vafiloa AS b
       ON a~aufnr = b~aufnr
       INTO TABLE lt_temp.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 16:28:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972918#M399022</guid>
      <dc:creator>Priti_PM</dc:creator>
      <dc:date>2007-02-09T16:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Select with join from the same fields into two different fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972919#M399023</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 tried a few ways, and it is possible to solve this question. the keyword is "AS".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx for the answers, let the points flow... I don't know why don't a lot of people like to give points...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The follwoing code is working fine, and finds the corresponding name in the table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    SELECT aufk~auart afko~aufnr aufk~ktext aufk~objnr afko~aufpl
           vafiloa~iloan iloa~tplnr vafiloa~equnr aufk~kostv
           vafiloa~anlnr vafiloa~anlun aufk~bukrs aufk~kostl
           aufk~zzkocsiszam aufk~werks iloa~gsber AS gsber_receiver
           aufk~gsber AS gsber_sender
             FROM aufk
             INNER JOIN afih ON afih~aufnr = aufk~aufnr
             INNER JOIN afko ON afko~aufnr = aufk~aufnr
             INNER JOIN vafiloa ON afko~aufnr = vafiloa~aufnr
             INNER JOIN iloa ON iloa~iloan = vafiloa~iloan
             INTO CORRESPONDING FIELDS OF TABLE gt_rendeles
           FOR ALL ENTRIES IN gt_rendeles_teny
           WHERE aufk~auart IN s_auart
             AND aufk~bukrs IN s_bukrs
             AND aufk~kostv IN s_kostv
             AND aufk~kostl IN s_kostl
             AND aufk~werks IN s_werks
             AND aufk~zzkocsiszam IN s_kocsi
             AND vafiloa~equnr IN s_equnr  "berendezés
             AND iloa~tplnr IN s_tplnr     "m&amp;amp;#369;szaki hely
             AND aufk~objnr = gt_rendeles_teny-objnr. "ténykönyvelés van

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Priti almost had it...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx&lt;/P&gt;&lt;P&gt;Tamá&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 16:31:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972919#M399023</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T16:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Select with join from the same fields into two different fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972920#M399024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Answered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 16:32:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972920#M399024</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T16:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: Select with join from the same fields into two different fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972921#M399025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or may be you can modify the structure of gt_rendeles table creating two different fields and use into table gt_rendeles instead of corresponding fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 16:32:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972921#M399025</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T16:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: Select with join from the same fields into two different fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972922#M399026</link>
      <description>&lt;P&gt;I am using tables VBAK, VBAP, VBFA and they all have fields VBELN, POSNR etc. This exampled worked - Thank you. The mistake i was making was that i was using "INTO CORRESPONDING FIELDS OF TABLE". Here's my code based on this example and its working perfectly:&lt;/P&gt;&lt;P&gt; DATA: BEGIN OF lt_vbak OCCURS 0,&lt;BR /&gt;
 vbeln TYPE vbeln_va,&lt;BR /&gt;
 erdat TYPE erdat,&lt;BR /&gt;
 auart TYPE auart,&lt;BR /&gt;
 bstnk TYPE bstnk,&lt;BR /&gt;
 kunnr TYPE kunag,&lt;BR /&gt;
 posnr TYPE posnr_va,&lt;BR /&gt;
 matnr TYPE matnr,&lt;BR /&gt;
 arktx TYPE arktx,&lt;BR /&gt;
 vbeln_vbfa TYPE vbeln_nach,&lt;BR /&gt;
 posnn TYPE posnr_nach,&lt;BR /&gt;
 erdat_vbfa TYPE erdat,&lt;BR /&gt;
 END OF lt_vbak.&lt;BR /&gt;
&lt;BR /&gt;
 DATA: wa_vbak LIKE LINE OF lt_vbak.&lt;BR /&gt;
&lt;BR /&gt;
 REFRESH: lt_vbak.&lt;BR /&gt;
 CLEAR: lt_vbak, wa_vbak.&lt;BR /&gt;
&lt;BR /&gt;
 SELECT a~vbeln a~erdat a~auart a~bstnk a~kunnr&lt;BR /&gt;
 b~posnr b~matnr b~arktx&lt;BR /&gt;
 c~vbeln c~posnn c~erdat&lt;BR /&gt;
 INTO TABLE lt_vbak&lt;BR /&gt;FROM ( vbak AS a&lt;BR /&gt;
 INNER JOIN vbap AS b ON b~vbeln = a~vbeln&lt;BR /&gt;
 INNER JOIN vbfa AS c ON c~vbelv = b~vbeln AND c~posnv = b~posnr )&lt;BR /&gt;
 WHERE a~vbeln IN s_vbeln&lt;BR /&gt;
 AND a~erdat IN s_erdat&lt;BR /&gt;
 AND a~kunnr IN s_kunnr&lt;BR /&gt;
 AND a~auart = 'ZKA'&lt;BR /&gt;
 AND c~vbeln IN s_vbelnl&lt;BR /&gt;
 AND c~erdat IN s_bldat&lt;BR /&gt;
 AND c~vbtyp_n = 'T'.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 19:11:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-join-from-the-same-fields-into-two-different-fields/m-p/1972922#M399026</guid>
      <dc:creator>zeeshan_xt</dc:creator>
      <dc:date>2019-06-06T19:11:27Z</dc:date>
    </item>
  </channel>
</rss>

