<?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: fetch data from 2 table with same field in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713196#M2019280</link>
    <description>&lt;P&gt;this is a JOIN, so my proposal is a good one  SELECT A~MATNR AS ...,  B~MATNR AS ....  &lt;/P&gt;</description>
    <pubDate>Thu, 09 Mar 2023 07:06:10 GMT</pubDate>
    <dc:creator>FredericGirod</dc:creator>
    <dc:date>2023-03-09T07:06:10Z</dc:date>
    <item>
      <title>fetch data from 2 table with same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713191#M2019275</link>
      <description>&lt;P&gt;Hello experts!,&lt;/P&gt;
  &lt;P&gt;i have this sample program to fetch data from 2 table but with different fields taken, is there a way to make it fetch data from 2 table with the same field and then store the output to my Ztable ?&lt;/P&gt;
  &lt;P&gt;here's the sample program&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;REPORT ZGETFBL.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;TABLES : MARA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;DATA : ITAB TYPE TABLE OF ZDATAGL,&amp;lt;br&amp;gt;       WA TYPE ZDATAGL.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;START-OF-SELECTION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;PERFORM GET_DATA.&amp;lt;br&amp;gt;PERFORM DISPLAY_DATA.&amp;lt;br&amp;gt;*&amp;amp;---------------------------------------------------------------------*&amp;lt;br&amp;gt;*&amp;amp;      Form  GET-DATA&amp;lt;br&amp;gt;*&amp;amp;---------------------------------------------------------------------*&amp;lt;br&amp;gt;*       text&amp;lt;br&amp;gt;*----------------------------------------------------------------------*&amp;lt;br&amp;gt;*  --&amp;gt;  p1        text&amp;lt;br&amp;gt;*  &amp;lt;--  p2        text&amp;lt;br&amp;gt;*----------------------------------------------------------------------*&amp;lt;br&amp;gt;FORM GET_DATA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;SELECT A~MATNR&amp;lt;br&amp;gt;       ERSDA&amp;lt;br&amp;gt;       ERNAM&amp;lt;br&amp;gt;       B~PSTAT&amp;lt;br&amp;gt;       B~LVORM &amp;lt;br&amp;gt;INTO TABLE ITAB&amp;lt;br&amp;gt;FROM MARA AS A&amp;lt;br&amp;gt;  INNER JOIN MARC AS B&amp;lt;br&amp;gt;ON B~MATNR = A~MATNR&amp;lt;br&amp;gt;  WHERE MATNR IN S_MATNR.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;ENDSELECT.&amp;lt;br&amp;gt;ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Mar 2023 04:46:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713191#M2019275</guid>
      <dc:creator>former_member844813</dc:creator>
      <dc:date>2023-03-09T04:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: fetch data from 2 table with same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713192#M2019276</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;Please refer below code to fetch data from two different tables&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES :
    "structure to hold customer details
        BEGIN OF st_cust,
        kunnr TYPE kna1-kunnr,
        land1 TYPE kna1-land1,
        vbeln TYPE vbak-vbeln,
        erdat TYPE vbak-erdat,
        END OF st_cust.

DATA :
    "internal table and workarea to hold customer details
       wa_cust TYPE st_cust,
       it_cust TYPE TABLE of st_cust.

 SElect  kna1~kunnr
         kna1~land1
         vbak~vbeln
         vbak~erdat
 INTO TABLE it_cust
 from kna1
INNER JOIN vbak
   on kna1~kunnr = VBAK~kunnr.

   IF sy-subrc = 0 and it_cust is NOT INITIAL.

  cl_demo_output=&amp;gt;display( it_cust ).

   ENDIF.&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;P&gt;Tarun&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 05:22:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713192#M2019276</guid>
      <dc:creator>TarunTakshak6</dc:creator>
      <dc:date>2023-03-09T05:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: fetch data from 2 table with same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713193#M2019277</link>
      <description>&lt;P&gt;Yes, you could fetch the "same" fieldname from two different tables (or same table), you just have to rename the fields : (better is to give the same name of the internal table, but your code is hard to read)&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT mara~matnr as my_first_material, makt~matnr as my_second_material, .... &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Mar 2023 06:52:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713193#M2019277</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2023-03-09T06:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: fetch data from 2 table with same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713194#M2019278</link>
      <description>&lt;P&gt;don't use answer to reply to a proposal, use comment&lt;/P&gt;&lt;P&gt;You want the two fields in the same column or in two differnt colums ? &lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 06:58:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713194#M2019278</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2023-03-09T06:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: fetch data from 2 table with same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713195#M2019279</link>
      <description>&lt;P&gt;this is the sample code i found, but this one fetching different field with 2 different table&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZGETFBL.&lt;BR /&gt;TABLES : MARA.&lt;BR /&gt;DATA : ITAB TYPE TABLE OF ZDATAGL,&lt;BR /&gt;WA TYPE ZDATAGL.&lt;BR /&gt;SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.&lt;BR /&gt;START-OF-SELECTION.&lt;BR /&gt;PERFORM GET_DATA.&lt;BR /&gt;PERFORM DISPLAY_DATA.&lt;BR /&gt;*&amp;amp;---------------------------------------------------------------------*&lt;BR /&gt;*&amp;amp;      Form  GET-DATA&lt;BR /&gt;*&amp;amp;---------------------------------------------------------------------*&lt;BR /&gt;*       text&lt;BR /&gt;*----------------------------------------------------------------------*&lt;BR /&gt;*  --&amp;gt;  p1        text&lt;BR /&gt;*  &amp;lt;--  p2        text&lt;BR /&gt;*----------------------------------------------------------------------*&lt;BR /&gt;FORM GET_DATA.&lt;BR /&gt;SELECT A~MATNR&lt;BR /&gt; ERSDA&lt;BR /&gt; ERNAM&lt;BR /&gt; B~PSTAT&lt;BR /&gt; B~LVORM &lt;BR /&gt;INTO TABLE ITAB&lt;BR /&gt;FROM MARA AS A &lt;BR /&gt;INNER JOIN MARC AS B&lt;BR /&gt;ON B~MATNR = A~MATNR&lt;BR /&gt; WHERE MATNR IN S_MATNR.&lt;BR /&gt;ENDSELECT.&lt;BR /&gt;ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Mar 2023 07:01:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713195#M2019279</guid>
      <dc:creator>former_member844813</dc:creator>
      <dc:date>2023-03-09T07:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: fetch data from 2 table with same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713196#M2019280</link>
      <description>&lt;P&gt;this is a JOIN, so my proposal is a good one  SELECT A~MATNR AS ...,  B~MATNR AS ....  &lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 07:06:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713196#M2019280</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2023-03-09T07:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: fetch data from 2 table with same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713197#M2019281</link>
      <description>&lt;P&gt;Hi Tarun&lt;/P&gt;&lt;P&gt;are those 2 table have the same field ?, if not what should i do it if i want to fetch same field from 2 different table ?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Dema&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 07:06:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713197#M2019281</guid>
      <dc:creator>former_member844813</dc:creator>
      <dc:date>2023-03-09T07:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: fetch data from 2 table with same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713198#M2019282</link>
      <description>&lt;P&gt;in the same column, yes&lt;/P&gt;&lt;P&gt;here's how i want it to work:&lt;/P&gt;&lt;P&gt;1st i use parameter to search data according to G/L account number, with a date range of it&lt;/P&gt;&lt;P&gt;and then its supposed to show the data from the 2 different table with the same field which is G/L account number and the date range.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 07:07:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713198#M2019282</guid>
      <dc:creator>former_member844813</dc:creator>
      <dc:date>2023-03-09T07:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: fetch data from 2 table with same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713199#M2019283</link>
      <description>&lt;P&gt;as u asked before, yes i want it in one column&lt;/P&gt;&lt;P&gt;im gonna make a table to store the data from that 2 table.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 07:28:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713199#M2019283</guid>
      <dc:creator>former_member844813</dc:creator>
      <dc:date>2023-03-09T07:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: fetch data from 2 table with same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713200#M2019284</link>
      <description>&lt;P&gt;Please review the formatting of the code in your question, it's currently shown as only ONE line with many &amp;lt;br&amp;gt;. Possibly, pasting code using Ctrl+Shift+V may help you (unformatted paste).&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 11:48:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713200#M2019284</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-03-09T11:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: fetch data from 2 table with same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713201#M2019285</link>
      <description>&lt;P&gt;Your code, correctly formatted:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZGETFBL.

TABLES : MARA.

DATA : ITAB TYPE TABLE OF ZDATAGL,
       WA TYPE ZDATAGL.

SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.

START-OF-SELECTION.

PERFORM GET_DATA.
PERFORM DISPLAY_DATA.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  GET-DATA
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM GET_DATA.

SELECT A~MATNR
       ERSDA
       ERNAM
       B~PSTAT
       B~LVORM 
INTO TABLE ITAB
FROM MARA AS A
  INNER JOIN MARC AS B
ON B~MATNR = A~MATNR
  WHERE MATNR IN S_MATNR.

ENDSELECT.
ENDFORM.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Mar 2023 11:49:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713201#M2019285</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-03-09T11:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: fetch data from 2 table with same field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713202#M2019286</link>
      <description>&lt;P&gt;I'm not sure people understand precisely what you are asking.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 11:52:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-data-from-2-table-with-same-field/m-p/12713202#M2019286</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-03-09T11:52:58Z</dc:date>
    </item>
  </channel>
</rss>

