<?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: fetching data in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523651#M847538</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;Can you paste the code you have written, and I will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mayank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Mar 2008 05:18:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-13T05:18:55Z</dc:date>
    <item>
      <title>fetching data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523650#M847537</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 am new to abap..I have to fetch data from two related  tables to an internal table..i need to fetch only the data corresponding to the entries in a selection screen.....i tried with joins ..but some problem....i think the coding is not correct...can anybody help me?&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;ranjillla&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 05:14:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523650#M847537</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T05:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: fetching data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523651#M847538</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;Can you paste the code you have written, and I will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mayank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 05:18:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523651#M847538</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T05:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: fetching data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523652#M847539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is that query statement....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 05:19:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523652#M847539</guid>
      <dc:creator>former_member530652</dc:creator>
      <dc:date>2008-03-13T05:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: fetching data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523653#M847540</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;PRE&gt;&lt;CODE&gt;

Inner joins using 3 tables  

Try this :- 

SELECT stpo~stlnr stpo~idnrk mast~matnr mara~mtart stpo~menge  
INTO CORRESPONDING FIELDS OF TABLE zmat1 FROM mast  
JOIN stpo ON stpo~stlnr = mast~stlnr  
JOIN mara ON mara~matnr = mast~matnr  
WHERE stpo~stlty = 'M' "AND stpo~idnrk IN s_matnr  
AND mast~werks = 1000.  

Here s_matnr is a select-options on the selection-screen.  

Or this.  

Code:  
     Select single Vbrk~Bukrs Vbrk~Kunrg    Vbrk~Vbeln  
                   Vbrk~Fkdat Vbrk~Bstnk_Vf Vbrk~Zterm  
                   Tvzbt~Vtext  
                   Vbak~Vbeln Vbak~Bstdk  
                   Likp~Vbeln Likp~lfdat    Likp~Lfuhr  
       into w_vbrk  
       from vbrk  
      inner join       Tvzbt on Tvzbt~Zterm        = Vbrk~Zterm      and  
                                Tvzbt~Spras        = sy-langu  
      Inner join       Vbfa  as SalesLnk  
                             on SalesLnk~vbeln     = pu_vbeln        and  
                                SalesLnk~vbtyp_v   = c_order  
            inner join Vbak  on Vbak~Vbeln           = SalesLnk~Vbelv 
      Inner join       Vbfa  as DeliveryLnk  
                             on DeliveryLnk~vbeln   = pu_vbeln       and  
                                DeliveryLnk~vbtyp_v = c_Delivery  
            inner join Likp  on Likp~Vbeln          = DeliveryLnk~Vbelv  
      where vbrk~vbeln = pu_Vbeln.  

This code locates sales, delivery and payment terms info from a billing document number.  





&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hope this helps, Do reward.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 05:20:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523653#M847540</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T05:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: fetching data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523654#M847541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Refer to this sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;abc b&lt;/SUB&gt;def&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;from a join b&lt;/P&gt;&lt;P&gt;on a&lt;SUB&gt;ghi = b&lt;/SUB&gt;ghi&lt;/P&gt;&lt;P&gt;where &amp;lt;conditon matching selection screen&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure that u use index(primary key) field in join condn. Else u will get performnace error. Avoid joining more than three tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ramya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 05:21:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523654#M847541</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T05:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: fetching data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523655#M847542</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;here iam sending some sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try like this .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables : ekko,ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-options : s_ebeln for ekko-ebeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : begin of it_itab occurs 0,&lt;/P&gt;&lt;P&gt;ebeln like ekko-ebeln,&lt;/P&gt;&lt;P&gt;netwr like ekko-ebeln,&lt;/P&gt;&lt;P&gt;posnr like ekpo-posnr,&lt;/P&gt;&lt;P&gt;matnr like ekpo-matnr,&lt;/P&gt;&lt;P&gt;end of it_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ekko&lt;SUB&gt;ebeln ekko&lt;/SUB&gt;netwr ekpo&lt;SUB&gt;posnr ekpo&lt;/SUB&gt;matnr into it_itab from ekko inner join on ekpo&lt;SUB&gt;ebeln = ekko&lt;/SUB&gt;ebeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_itab.&lt;/P&gt;&lt;P&gt;write :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;swami.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 05:22:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523655#M847542</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T05:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: fetching data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523656#M847543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi just check this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT a~pernr&lt;/P&gt;&lt;P&gt;         a~subty&lt;/P&gt;&lt;P&gt;         a~objps&lt;/P&gt;&lt;P&gt;         a~endda&lt;/P&gt;&lt;P&gt;         a~begda&lt;/P&gt;&lt;P&gt;         a~seqnr&lt;/P&gt;&lt;P&gt;         a~bukrs&lt;/P&gt;&lt;P&gt;         a~werks&lt;/P&gt;&lt;P&gt;         a~persg&lt;/P&gt;&lt;P&gt;         a~persk&lt;/P&gt;&lt;P&gt;         a~btrtl&lt;/P&gt;&lt;P&gt;         a~abkrs&lt;/P&gt;&lt;P&gt;         a~kostl&lt;/P&gt;&lt;P&gt;         a~orgeh&lt;/P&gt;&lt;P&gt;         a~plans&lt;/P&gt;&lt;P&gt;         b~nachn&lt;/P&gt;&lt;P&gt;         b~vorna&lt;/P&gt;&lt;P&gt;         b~midnm&lt;/P&gt;&lt;P&gt;         INTO CORRESPONDING FIELDS OF TABLE i_pa0001_pa0002&lt;/P&gt;&lt;P&gt;         FROM pa0001 AS a INNER JOIN pa0002 AS b&lt;/P&gt;&lt;P&gt;         ON  a&lt;SUB&gt;pernr = b&lt;/SUB&gt;pernr&lt;/P&gt;&lt;P&gt;         AND a&lt;SUB&gt;subty = b&lt;/SUB&gt;subty&lt;/P&gt;&lt;P&gt;         AND a&lt;SUB&gt;objps = b&lt;/SUB&gt;objps&lt;/P&gt;&lt;P&gt;         WHERE a~pernr IN s_pernr&lt;/P&gt;&lt;P&gt;         AND   a~werks IN s_werks&lt;/P&gt;&lt;P&gt;         AND   a~orgeh IN s_orgeh&lt;/P&gt;&lt;P&gt;         AND   a~plans IN s_plans.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 05:22:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523656#M847543</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T05:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: fetching data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523657#M847544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;***(Here the two tables are cosP AND BSEG .They  are having common fields &lt;/P&gt;&lt;P&gt;Such as bukrs gjahr and lednr.&lt;/P&gt;&lt;P&gt;Lednr and rldnr are  similar fields in respective tables Of this atleast one should be  primary key for both tables.through where condition you can connect it to the entries in selections screen)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES: COSP, BKPF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: begin of i_plant,&lt;/P&gt;&lt;P&gt;       GJAHR type COSP-GJAHR,&lt;/P&gt;&lt;P&gt;       VERSN type COSP-VERSN,&lt;/P&gt;&lt;P&gt;       GLVOR TYPE BKPF-GLVOR,&lt;/P&gt;&lt;P&gt;       KUTY2 TYPE BKPF-KUTY2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : end of i_plant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : itab type  standard table of i_plant WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-B01.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECTION-SCREEN SKIP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        PARAMETERS: P_VERSN LIKE COSP-VERSN,&lt;/P&gt;&lt;P&gt;                    P_GJAHR LIKE COSP-GJAHR,&lt;/P&gt;&lt;P&gt;                    P_PERBL LIKE COSP-PERBL.&lt;/P&gt;&lt;P&gt;    SELECTION-SCREEN SKIP.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK B1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT A&lt;SUB&gt;GJAHR A&lt;/SUB&gt;VERSN &lt;/P&gt;&lt;P&gt;B&lt;SUB&gt;GLVOR B&lt;/SUB&gt;KUTY2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            INTO CORRESPONDING FIELDS OF TABLE ITAB&lt;/P&gt;&lt;P&gt;             FROM COSP AS A INNER JOIN BKPF AS B&lt;/P&gt;&lt;P&gt;             ON&lt;/P&gt;&lt;P&gt;             ( A&lt;SUB&gt;BUKRS EQ B&lt;/SUB&gt;BUKRS ) AND ( A&lt;SUB&gt;LEDNR EQ  B&lt;/SUB&gt;RLDNR ) AND&lt;/P&gt;&lt;P&gt;            ( A&lt;SUB&gt;GJAHR EQ B&lt;/SUB&gt;GJAHR )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             WHERE  A~VERSN EQ P_VERSN&lt;/P&gt;&lt;P&gt;             AND ( A~GJAHR EQ P_GJAHR ) AND&lt;/P&gt;&lt;P&gt;             A~PERBL EQ P_PERBL.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      WRITE:/ '|',&lt;/P&gt;&lt;P&gt;             ITAB-GJAHR COLOR 4 INTENSIFIED OFF HOTSPOT,'|', "f year&lt;/P&gt;&lt;P&gt;                    20 itab-VERSN COLOR 4 INTENSIFIED OFF, 33 '|',&lt;/P&gt;&lt;P&gt;             40 itab- GLVOR COLOR 4 INTENSIFIED OFF,'|',"DNO&lt;/P&gt;&lt;P&gt;             60 itab- KUTY2 COLOR 4 INTENSIFIED OFF,'|'.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 05:22:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523657#M847544</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T05:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: fetching data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523658#M847545</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;        You can use a select query using a join condition on the two database tables with a condition on the input parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg:       SELECT a~project_id&lt;/P&gt;&lt;P&gt;                         a~spr_project_id&lt;/P&gt;&lt;P&gt;                         a~circle_id&lt;/P&gt;&lt;P&gt;               b~circle_desc&lt;/P&gt;&lt;P&gt;               b~p_circle_id&lt;/P&gt;&lt;P&gt;               INTO CORRESPONDING FIELDS OF TABLE it_output&lt;/P&gt;&lt;P&gt;        FROM  ( zscp_project AS a&lt;/P&gt;&lt;P&gt;                JOIN zscp_circle_m AS b&lt;/P&gt;&lt;P&gt;        ON a&lt;SUB&gt;circle_id = b&lt;/SUB&gt;circle_id )&lt;/P&gt;&lt;P&gt;         FOR ALL ENTRIES IN it_circle&lt;/P&gt;&lt;P&gt;        WHERE a~spr_project_id &amp;lt;&amp;gt; space&lt;/P&gt;&lt;P&gt;          AND   a~rq_stat IN s_pstat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above example zscp_project and zscp_circle_m are two database tables.. &lt;/P&gt;&lt;P&gt;using a join condition and the parameter s_pstat is an input parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This might be help you.&lt;/P&gt;&lt;P&gt;Pls reward if useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 05:23:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data/m-p/3523658#M847545</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T05:23:58Z</dc:date>
    </item>
  </channel>
</rss>

