<?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  join in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-join/m-p/12205530#M1982240</link>
    <description>&lt;H3&gt;&lt;/H3&gt;
  &lt;P&gt;The data selected for a given vendor is compared to the data selected for the other vendors.&lt;/P&gt;
  &lt;P&gt;The following fields are compared:&lt;/P&gt;
  &lt;P&gt;Name: LFA1- NAME1&lt;/P&gt;
  &lt;P&gt;Address ID: LFA1 – ADRNR&lt;/P&gt;
  &lt;P&gt;Street: LFA1 – STRAS&lt;/P&gt;
  &lt;P&gt;City: LFA1 - ORT01&lt;/P&gt;
  &lt;P&gt;VAT reg number: LFA1 – STCEG&lt;/P&gt;
  &lt;P&gt;Phone number: ADR2 - TEL_NUMBER&lt;/P&gt;
  &lt;P&gt;Bank account: LFBK – BANKN&lt;/P&gt;
  &lt;P&gt;If any field matches to another vendor in the selected data, the vendor is added to the output dataset.&lt;/P&gt;
  &lt;P&gt;how can i, select and join the Records when they are Same, From Table (lfba1, lfb1,adr2 and lfbk) to a new table? in ABAP&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jun 2020 11:49:41 GMT</pubDate>
    <dc:creator>former_member687484</dc:creator>
    <dc:date>2020-06-25T11:49:41Z</dc:date>
    <item>
      <title>Select  join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-join/m-p/12205530#M1982240</link>
      <description>&lt;H3&gt;&lt;/H3&gt;
  &lt;P&gt;The data selected for a given vendor is compared to the data selected for the other vendors.&lt;/P&gt;
  &lt;P&gt;The following fields are compared:&lt;/P&gt;
  &lt;P&gt;Name: LFA1- NAME1&lt;/P&gt;
  &lt;P&gt;Address ID: LFA1 – ADRNR&lt;/P&gt;
  &lt;P&gt;Street: LFA1 – STRAS&lt;/P&gt;
  &lt;P&gt;City: LFA1 - ORT01&lt;/P&gt;
  &lt;P&gt;VAT reg number: LFA1 – STCEG&lt;/P&gt;
  &lt;P&gt;Phone number: ADR2 - TEL_NUMBER&lt;/P&gt;
  &lt;P&gt;Bank account: LFBK – BANKN&lt;/P&gt;
  &lt;P&gt;If any field matches to another vendor in the selected data, the vendor is added to the output dataset.&lt;/P&gt;
  &lt;P&gt;how can i, select and join the Records when they are Same, From Table (lfba1, lfb1,adr2 and lfbk) to a new table? in ABAP&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 11:49:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-join/m-p/12205530#M1982240</guid>
      <dc:creator>former_member687484</dc:creator>
      <dc:date>2020-06-25T11:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Select  join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-join/m-p/12205531#M1982241</link>
      <description>&lt;P&gt;Hello  &lt;SPAN class="mention-scrubbed"&gt;adib.1213&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Something like the below code. Not 100% sure if it will work, wrote it in the forum's editor. Also, not sure about the performance.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT lfa1~lifnr
  FROM lfa1
  JOIN adr2
    ON adr2~addrnumber = lfa1~adrnr
  JOIN lfbk
    ON lfbk~lifnr = lfa1~lifnr
  LEFT OUTER JOIN lfa1 AS lfa1_copy
    ON ( lfa1_copy~name1 = lfa1~name1 OR lfa1_copy~adrnr = lfa1~adrnr OR /and other fields from LFA1/ )
    AND lfa1_copy~lifnr &amp;lt;&amp;gt; lfa1~lifnr
  LEFT OUTER JOIN adr2 AS adr2_copy
    ON adr2_copy~tel_number = adr2~tel_number
    AND adr2_copy~addrnumber &amp;lt;&amp;gt; adr2~adrnr
  LEFT OUTER JOIN lfbk AS lfbk_copy
    ON lfbk_copy~bankn = lfbk~bankn
    AND lfbk_copy~lifnr &amp;lt;&amp;gt; lfbk~lifnr.
  WHERE lfa1_copy~lifnr IS NOT NULL 
     OR adr2_copy~adrnr IS NOT NULL
     OR lfbk_copy~lifnr IS NOT NULL.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But this query, even if it works (which I'm not 100% sure), has one significant issue - only vendors which have records in all tables (LFA1, ADR2, LFBK) are compared.&lt;/P&gt;&lt;P&gt;If you'd like to compare these tables separately, then you'd probably need to write separate queries.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;Mateusz</description>
      <pubDate>Thu, 25 Jun 2020 12:09:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-join/m-p/12205531#M1982241</guid>
      <dc:creator>MateuszAdamus</dc:creator>
      <dc:date>2020-06-25T12:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: Select  join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-join/m-p/12205532#M1982242</link>
      <description>&lt;P&gt;It depends of your needs.&lt;/P&gt;&lt;P&gt;1)&lt;/P&gt;&lt;P&gt;You can also create simple SQL select for one field. i.e Name.&lt;/P&gt;&lt;P&gt;And next use UNION to select vendors for another field i.e Street.&lt;/P&gt;&lt;P&gt;and so on.&lt;/P&gt;&lt;P&gt;UNION returns only unique rows. So no duplicates at the end.&lt;/P&gt;&lt;P&gt;2) &lt;/P&gt;&lt;P&gt;EXISTS might be also an option in some scenarios.&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;P&gt;Rafal&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 13:32:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-join/m-p/12205532#M1982242</guid>
      <dc:creator>former_member1954</dc:creator>
      <dc:date>2020-06-25T13:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Select  join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-join/m-p/12205533#M1982243</link>
      <description>&lt;P&gt;thanks for Replaying me, &lt;/P&gt;&lt;P&gt;for first steps, for the first part of my task i write this code and its work. &lt;/P&gt;&lt;P&gt;**TABLES : LFA1, LFB1, LFBK, ADR2.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;SELECTION-SCREEN BEGIN OF BLOCK B1 with frame title text-001.&lt;BR /&gt;&lt;BR /&gt; select-OPTIONS : S_kTOKK for LFA1-KTOKK,&lt;BR /&gt; S_BUKRS for LFB1-BUKRS.&lt;BR /&gt;&lt;BR /&gt;SELECTION-SCREEN end of BLOCK B1.&lt;BR /&gt;&lt;BR /&gt;*SELECT LFA1~*&lt;BR /&gt;&lt;BR /&gt;Select&lt;BR /&gt;LFA1~LIFNR,&lt;BR /&gt;LFA1~NAME1,&lt;BR /&gt;LFB1~BUKRS,&lt;BR /&gt;LFA1~ADRNR,&lt;BR /&gt;LFA1~STRAS,&lt;BR /&gt;LFA1~ORT01,&lt;BR /&gt;LFA1~PSTLZ,&lt;BR /&gt;LFA1~STCEG,&lt;BR /&gt;LFB1~ERDAT,&lt;BR /&gt;LFBK~BANKN,&lt;BR /&gt;ADR2~TEL_NUMBER,&lt;BR /&gt;LFA1~SPERR,&lt;BR /&gt;LFB1~SPERR as SPERRB&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; FROM LFA1 INNER JOIN LFB1 on LFA1~LIFNR eq LFB1~LIFNR&lt;BR /&gt; INNER JOIN LFBK on LFBK~LIFNR eq LFA1~LIFNR&lt;BR /&gt; LEFT JOIN ADR2 on LFA1~ADRNR eq ADR2~ADDRNUMBER&lt;BR /&gt; WHERE LFA1~KTOKK in @S_KTOKK and LFB1~BUKRS in @S_BUKRS&lt;BR /&gt; INTO TABLE @data(Lt_Vendors).**&lt;/P&gt;&lt;P&gt;for the second step to select and join the fields with same values from this 4 table i need to a new selection.?&lt;/P&gt;&lt;P&gt;logically i need an output table (X), that Select and join are those/this fields from this tables ( FLA1,FLB1,ADR2 and LFBK) that  they have a same values in this fields Like &lt;/P&gt;&lt;P&gt;(    &lt;/P&gt;&lt;P&gt;DATA Source&lt;/P&gt;
 
  LFA1-LIFNR
 
 
  LFA1-NAME1
 
 
  LFB1-BUKRS
 
 
  LFA1-ADRNR
 
 
  LFA1-STRAS
 
 
  LFA1-ORT01
 
 
  LFA1-PSTLZ
 
 
  ADR2-TEL_NUMBER
 
 
  LFA1-STCEG
 
 
  LFBK-BANKN
 
 
  LFB1-ERDAT
 
 
  LFA1-SPERR
 
 
  LFB1-SPERR
 &lt;P&gt;)&lt;/P&gt;&lt;P&gt;and a output like this&lt;/P&gt;&lt;P&gt;The following columns are used in the output list:&lt;/P&gt;
 
  &lt;STRONG&gt;Column&lt;/STRONG&gt;
  &lt;STRONG&gt;Data Source&lt;/STRONG&gt;
 
 
  Vendor ID
  LFA1-LIFNR
 
 
  Vendor Name
  LFA1-NAME1
 
 
  Company Code
  LFB1-BUKRS
 
 
  Address Number
  LFA1-ADRNR
 
 
  Street
  LFA1-STRAS
 
 
  City
  LFA1-ORT01
 
 
  Postcode
  LFA1-PSTLZ
 
 
  Phone
  ADR2-TEL_NUMBER
 
 
  VAT Number
  LFA1-STCEG
 
 
  Bank Account
  LFBK-BANKN
 
 
  Create Date
  LFB1-ERDAT
 
 
  Central Posting Block
  LFA1-SPERR
 
 
  Company Posting Block
  LFB1-SPERR</description>
      <pubDate>Thu, 25 Jun 2020 14:55:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-join/m-p/12205533#M1982243</guid>
      <dc:creator>former_member687484</dc:creator>
      <dc:date>2020-06-25T14:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Select  join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-join/m-p/12205534#M1982244</link>
      <description>&lt;P&gt;Hello  &lt;SPAN class="mention-scrubbed"&gt;adib.1213&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Yes, if I understand your requirement correctly, and looking at what you've already written, you'd need at least one more SELECT query to get the vendors with the same data. However, most of these fields that you want to check don't look like fields that are indexed. This means that a DB query based on these fields (with OR condition for some of these tables) might be quite slow (depends on the DB engine you have, might be a different story if you run on HANA). &lt;/P&gt;&lt;P&gt;If you select only those fields you listed, then I wonder if it's not a better idea to load all the records into internal table(s) and compare the fields' values in memory.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Mateusz&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 15:17:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-join/m-p/12205534#M1982244</guid>
      <dc:creator>MateuszAdamus</dc:creator>
      <dc:date>2020-06-25T15:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Select  join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-join/m-p/12205535#M1982245</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;thanks for Replaying me,
*for first steps, for the first part of my task i write this code and its work.
TABLES : LFA1, LFB1, LFBK, ADR2.

SELECTION-SCREEN BEGIN OF BLOCK B1 with frame title text-001.

select-OPTIONS : S_kTOKK for LFA1-KTOKK,
S_BUKRS for LFB1-BUKRS.

SELECTION-SCREEN end of BLOCK B1.

*SELECT LFA1~*

Select
LFA1~LIFNR,
LFA1~NAME1,
LFB1~BUKRS,
LFA1~ADRNR,
LFA1~STRAS,
LFA1~ORT01,
LFA1~PSTLZ,
LFA1~STCEG,
LFB1~ERDAT,
LFBK~BANKN,
ADR2~TEL_NUMBER,
LFA1~SPERR,
LFB1~SPERR as SPERRB


FROM LFA1 INNER JOIN LFB1 on LFA1~LIFNR eq LFB1~LIFNR
INNER JOIN LFBK on LFBK~LIFNR eq LFA1~LIFNR
LEFT JOIN ADR2 on LFA1~ADRNR eq ADR2~ADDRNUMBER
WHERE LFA1~KTOKK in @S_KTOKK and LFB1~BUKRS in @S_BUKRS
INTO TABLE @data(Lt_Vendors).
**for the second step to select and join the fields with same values from this 4 table i need t**o a new selection.?
**logically i need an output table (X), that Select and join are those/this fields from this ta**bles ( FLA1,FLB1,ADR2 and LFBK) that they have a same values in this fields Like
**(
DATA Source
LFA1-LIFNR 
LFA1-NAME1 
LFB1-BUKRS 
LFA1-ADRNR 
LFA1-STRAS 
LFA1-ORT01 
LFA1-PSTLZ 
ADR2-TEL_NUMBER 
LFA1-STCEG 
LFBK-BANKN 
LFB1-ERDAT 
LFA1-SPERR 
LFB1-SPERR
).**

**and a output like this
**The following columns are used in the output list:
*Column         Data Source: **
*(  ↓            ↓
Vendor ID      LFA1-LIFNR 
VendorName     LFA1-NAME1 
CompanyCode    LFB1-BUKRS 
Addres Number  LFA1-ADRNR 
Street         LFA1-STRAS 
City           LFA1-ORT01 
Postcode       LFA1-PSTLZ 
Phone          ADR2-TEL_NUMBER 
VAT Number     LFA1-STCEG 
Bank Account   LFBK-BANKN 
Create Date    LFB1-ERDAT 
Central Posting Block LFA1-SPERR 
Company Posting Block LFB1-SPERR
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Jun 2020 15:21:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-join/m-p/12205535#M1982245</guid>
      <dc:creator>former_member687484</dc:creator>
      <dc:date>2020-06-25T15:21:41Z</dc:date>
    </item>
  </channel>
</rss>

