How to join THREE different tables into internal table using one select statement .

How to join THREE different tables into internal table using one select statement .
Hi experts,
I would like to request your guidance in solving the problem of joining the data from three different database tables into one internal table
Scenario:
Database tables:
SPFLI
SFLIGHT
SBOOK.
Table Fields:
SPFLI - CARRID CONNID COUNTRYFR CITYFRM COUNTRYTO CITYTO
SFLIGHT - CARRID CONNID FLDATE SEATSMAX SEATSOCC SEATSMAX_C
SEATSOCC_C SEATSMAX_F SEATSOCC_F
SBOOK - CARRID CONNID CLASS
MY INTERNAL TABLE IS IT_XX.
Your help much appreciated.
Thanks in advance.
Pawan.

Hi Pawan,
please check below codes. hope it can help you.
TYPES: BEGIN OF ty_xx,
        carrid     TYPE spfli-carrid   ,
        connid     TYPE spfli-connid   ,
        countryfr  TYPE spfli-countryfr,
        cityfrom   TYPE spfli-cityfrom  ,
        countryto  TYPE spfli-countryto,
        cityto     TYPE spfli-cityto   ,
        fldate     TYPE sflight-fldate ,
        seatsmax   TYPE sflight-seatsmax ,
        seatsocc   TYPE sflight-seatsocc ,
        seatsmax_b TYPE sflight-seatsmax_b,
        seatsocc_b TYPE sflight-seatsocc_b,
        seatsmax_f TYPE sflight-seatsmax_f,
        seatsocc_f TYPE sflight-seatsocc_f,
        class      TYPE sbook-class,
      END OF ty_xx,
      t_xx TYPE STANDARD TABLE OF ty_xx.
DATA: it_xx TYPE t_xx.
SELECT spfli~carrid
       spfli~connid
       spfli~countryfr
       spfli~cityfrom
       spfli~countryto
       spfli~cityto
       sflight~fldate
       sflight~seatsmax
       sflight~seatsocc
       sflight~seatsmax_b
       sflight~seatsocc_b
       sflight~seatsmax_f
       sflight~seatsocc_f
       sbook~class
  INTO TABLE it_xx
  FROM spfli INNER JOIN sflight
  ON spfli~carrid = sflight~carrid
  AND spfli~connid = sflight~connid
  INNER JOIN sbook
  ON spfli~carrid = sbook~carrid
  AND spfli~connid = sbook~connid.
Thanks,
Yawa

Similar Messages

  • How to store output of SQ01 into internal table.

    Hello Experts
    How to store output of SQ01 into internal table.
    Thanks,
    Umesh

    You can't store the sq01 output into internal table.
    Once you create the query it will generate the abap program, in that program you can see the contents.
    Regards
    Sasi

  • How to transfer data of RFC into Internal Table inside a WD4A program?

    Hi Experts,
    I have created WD4A program. This program calls RFC. The output of RFC has to populate  a UI table. THe different cells of the table should have different color based on data.
    I have gone through following link:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/707fb792-c181-2d10-61bd-ce15d58b5cf1
    The above link fetches data from directly from table. Then it passes the data into internal table.
    If I am using RFC, then how I can insert data of RFC into a internal table in WD4A program (se80 In drop down Web Dynpro Comp / Intf)
    My motto is to have table ouput whose different cells should have different color based on data.
    Please help.
    Regards,
    Gary
    Edited by: Jason Lax on Dec 28, 2011 2:52 PM (Fixed broken link)

    Hi Experts,
    I have resolved the issue. I have created WD4A program. This WD4A program calls the RFC.
    The RFC has a structure as export parameters called 'RESULT_FINAL'. I have altered the associated type of this table export parameter. I added Component 'Color' of component type 'WDUI_TABLE_CELL_DESIGN'.
    In the RFC I have added some code. The code is as below:
    loop  at it_t1.
          select pernr from pa0000 into table it_t2 where  pernr = it_t1-pernr  and stat2 ='3'
          and begda <= sy-datum AND endda >= sy-datum.
          if sy-subrc = 0.
            result_final-org_unit = result_objec-objid.
            result_final-pernr = it_t1-pernr.
            result_final-name = it_t1-name.
            result_final-color = '02'.       append result_final.
          endif.
        endloop.
    The line   result_final-color = '02'.   
    code returns Color.
    In the WD4A program, I have changed the Cell Design property of selected table coloumn to Color.
    This resolved the issue.
    Thanks every one for the reply.
    I have added above information for other SDN users.
    I am closing this thread,
    Regards,
    Gary

  • Best way to JOIN 3 tables into internal table ?

    Hi friends,
    i have the following issue:
    i need to join information of 3 different tables ( BUT000, BUT020 and ADRC ) concerning Business Partners and i need them into one internal table.
    how would this be achieved with best performance ?
    regards,
    CL

    Hi clemens,
    As per my understanding, u can further improve this  SQL By:
    1. first select only BU000 and BU020 with inner join and then select material details in different different itabs. and process This will surely reduce load on DB and may increase load  on ABAP which u can improve by using BINARY SERARCH!.
    (Important: if u are using two table in join and giviing only PARTNER which is primary key field in both tables in WHERE clasuse ... this should be the only criteria in where clasue then i Dont think it will affect performance .... how many record may be there, this query will be BEST performer... I hope it will fetch 750000 records whithin few seconds)
    2. Generally, U try to give more and more conditions in where clause on PRIMARY KEY fiedls only and not on not KEY fields...
    3. In worst case, fetch data from three differnt tables into three different itabs and then process, this is best and last way to reduce load on DB and will increase load on ABAP which can be manages as above..
    Still u want more info .. send codes to me.. We will try to make it more and more fast....
    Jogdand M B
    null
    Message was edited by:
            Jogdand M B

  • How to pass the data of the dynamic table into internal table

    Hi all,
    I had designed an Dynamic table in my Online Interactive form.
    I am able to pass only the First row data into the internal table which i had created
    Now how can i pass  data of all the rows  into the  internal table.
    Needed some coding help
    Thanks
    Ajay

    Hello Ajay,
    If you have dynamic table in adobe and you want to capture all the added rows then you need to add corresponding element in the node bound to that table ui.
    when u add a row using java script in adobe form there is no corresponding element created in the backend that is ur wd node bound to the table ui. and so u only get 1 row of data back.
    try this,
    create a button in your view holding adobe form say "add rows" and on click of this button write the code to add one more element to the node bound to ur table ui of adobe form. when server side rendering occurs it will recreate the table in adobe with added row in the node and you will be able to get the data entered by user.
    Thanks,
    Abhishek

  • How to save value in struture into internal table?

    good day to everyone,
    i have a prb with my coding below. i am trying to save the value tvbdpr-uecha into wa_zmas-uecha by using modify as shown below.
    however, the value uecha is not successfully being transported/saved into it_zmas.
    could anyone guide me?
    tvbdpr - is a structure table
    it_zmas - is an internal table
      LOOP AT tvbdpr WHERE posnr = wa_zmas-posnr AND matnr = wa_zmas-matnr.
              wa_zmas-uecha = tvbdpr-uecha.
              MODIFY TABLE it_zmas FROM wa_zmas TRANSPORTING uecha.
    thank you
    regards,
    sw

    Hi,
    If the internal table is already having contents and u need to modify it for the field uecha, you can try the following
    LOOP AT tvbdpr WHERE posnr = wa_zmas-posnr AND matnr = wa_zmas-matnr.
    wa_zmas-uecha = tvbdpr-uecha.
    READ TABLE it_zmas with KEY posnr = wa_zmas-posnr matnr = wa_zmas-matnr.
    if sy-subrc = 0.
    it_zmas-uecha = wa_zmas-uecha.
    MODIFY it_zmas index sy-index.
    clear it_zmas-uecha.
    endif.
    ENDLOOP.
    Else if the internal table is empty and you are populating the field uecha, use append
    LOOP AT tvbdpr WHERE posnr = wa_zmas-posnr AND matnr = wa_zmas-matnr.
    wa_zmas-uecha = tvbdpr-uecha.
    it_zmas-uecha = wa_zmas-uecha.
    append it_zmas.
    clear it_zmas.
    ENDLOOP.
    Regards,
    Vik

  • How to decompose a string with ';' into Internal table

    Hello all,
    I need your help for find a Function module or Abap code.
    I have a file with the separator is the ';'
    Example of the contains of my file :
    521010;16;46048,00;;*Soucet*Odmena za
    524012;41;103807,00;;Zdrav.p.organizace
    524012;42;;18332,00;Zdrav.p.organizace
    I want a module function which can separate all the String separate by a ';' into a internal table :
    for example my internal table have 5 column :
    Num......|.....CC.....|............Credit....|...........Debit........|.....Label
    521010....|.....16.....|......46048,00.....|...........................|.....Soucet**Odmena za
    524012....|.....41.....|......103807,00...|...........................|.....Zdrav.p.organizace
    524012....|.....42.....|..........................|........18332,00....|.....Zdrav.p.organizace
    For read the date of my file is not a problem with ABAP Code :
    DO.
          CLEAR : ws_facm.
          break epetrini.
          READ DATASET myFile INTO test.
          IF sy-subrc EQ 0.
            IF ws_facm-codenreg = 'D'.
              APPEND ws_facm TO wt_facm.
            ENDIF.
          ELSE.
            EXIT.
          ENDIF.
        ENDDO.
    Thank you for your helps.
    Best regards Emilien
    Edited by: Emilien P. on Mar 31, 2010 4:30 PM
    Edited by: Emilien P. on Mar 31, 2010 4:34 PM
    Edited by: Emilien P. on Mar 31, 2010 4:35 PM
    Edited by: Emilien P. on Mar 31, 2010 4:36 PM

    Hi,
    Try whith this:
    DATA: str1 TYPE string,
          str2 TYPE string,
          str3 TYPE string,
          itab TYPE TABLE OF string,
          text TYPE string.
    text = `What a drag it is getting old`.
    SPLIT text AT space INTO: str1 str2 str3,
                              TABLE itab.
    Let me know if it works.
    Regards,
    Moh.

  • How to add 2 Additional Monitor into my iMAC using ONE Thunderbolt

    1. I would like to attach 2 units of Samsung 27" which supports maximum resolution of 1920 by 1080 into a single Thunderbolt. How should I do that?
    2. As my other Thunderbolt is kept for Storage purpose and my Firewire is used to plugin my external sound card.
    Any good suggestions
    and please suggest me that, whether the performance quality of the picture on the both Samsung 27" will be compromised or not?? Will I have exact quality as in my iMac or different?
    What kind of cable should I buy.
    My Samsung monitor supports HDMI and DVI Input.
    All together I will be having 3 monitors (iMac, Samsung , Samsung)

    DanStan, Welcome to the discussion area!
    FYI, this is the discussion area for the iMac G4.
    The iMac G4 does not have a mini-DVI output.

  • How to upload the flat file records into internal table by position?

    Hi
    I have a flat file which has 7 records in each row and they are NOT provided with CSV or Tab demilited...
    They are continous text without spaces....
    but i know the fixed length of each field Eg : 1st field 7 char and seconc field 3 char and so on...
    How can i upload this file into internal table by reading positions of each field...I know we can use GUI_UPLOAD and Read dataset and Open dataset...
    But please let me know to read the file with the fixed postions and load into internal table...
    Thanks in advance
    MM

    Hi
    As per my knowledge i dont think thr is some function module or so to read with a fixed positions.
    You can use the below method if you think this is the best way.
    Suppose your file has
    types : begin of ty_itab,
                field1 type char7,
                field2 type char3,
                field3 type chat3,
                field4 type char3,
                end of ty_itab.
    types : begin of ty_upload,
                 str type string,
                end of ty_upload.
    data : it_itab type standatd table of ty_itab,
              it_upload type standard table ot ty_upload,
              wa_itab type ty_itab,
              wa_upload type ty_upload.
    use gui_upload.get the data in it_upload.
    here you know that u have first 16 charcters makes a first row n then next 16 charcters next row
      Loop at it_upload into wa_upload.
       v_len =  strlen ( wa_upload ).
       v_len = v_len / 16.
        You get number of rows per record ,if it is decimal value make it final value if 3.9 make to 4.
        do v_len times.
          wa_itab = wa_upload.
          By this only first 16 characters are moved and respective fields will get a value.or else u can use offset
           wa_upload+0(16).
          append wa_itab to it_itab.
          Now shift 16 characters using shift command in wa_upload.
        enddo.
      endloop.
    Hope this syntax help you to resolve your issue.May be something i have missed .Right now i don't have sap system to send you the full correct syntax code.
    Cheers
    Joginder

  • Insert into internal table

    Hi Experts,
    I am new comer to ABAP, have some very important task to be done, need help from all of you. I have a program which displays the results(inform about the infocubes). I want to insert the output of this prgm into an internal table, I am looking lot into the documentation, but so far not much help and i am not able to execute it. And one more task, I want to join this internal table and one database table and get the result, my question is , Is it possible to join this internal table and database table based on some common field.
      Any help will be of grt help
    Thanks,
    Hem.

    Hi,
    For joining internal table with database table,you need to write the logic as below.
    This is the pseudo code.
    select * from database into table itab2 where condition.
    loop at itab1 into wa1.
       move-corresponding wa1 to wa3.
       loop at itab2 into wa2 where field = wa1-field.
        move-corresponding wa2 to wa3.
       endloop.
       append wa3 to itab3.
    endloop.
    1. select the required data from database table into internal table.
    2. loop the first internal table which you already have.
    3. Based on the key fields in these two internal tables[database],place the condition in READ or LOOP statement for the second internal table inside the loop of the first internal table.
    4. If there are more records in second internal table for a single record in first internal table,then use LOOP the second internal table within the first internal table.Otherwise, read the second internal table within the first internal table.
    5.Then move the corresponding fields from both the internal tables inside the loop to third internal table.Append the record to the third internal table.
    Hope it helps.
    Regards,
    J.Jayanthi

  • Download database table content into internal table using Function Module?

    HI,
    Experts,
    I need a function module which can download ddic table content into internal table.
    Thank u ,
    Shabeer Ahmed.

    >
    shabeer ahmed wrote:
    > HI,
    > Experts,
    >
    > I need a function module which can download ddic table content into internal table.
    >
    > Thank u ,
    > Shabeer Ahmed.
    Hi Shabeer,
      We don't require a function module to download ddic table content to an internal table. We can use the SELECT statement for the same. Example would be:-
    DATA: <INTERNAL TABLE> type table of <DATABASE>.
    SELECT * FROM <DATABASE> into corresponding fields of <INTERNAL TABLE>.
    Also, function module might be required when you need the data from a remote system, but then it is the developer's task create this function module and the function module should be remote enabled function module.
    This remote enable function module should have the above SELECT query as its code.
    Many Regards,
    Ravi.

  • How to join three tables and practical difference between 10g and 11g

    I want to know with example how to outer join three different tables in Oracle.
    Also if you have any website or reference for understand syntax or performance difference between 10g and 11g then please paste a link in.thanks!!

    Hi,
    897293 wrote:
    I want to know with example how to outer join three different tables in Oracle.The 3rd table comes into the result set the same way the 2nd one did:
    FROM           table_1  t1
    LEFT OUTER JOIN      table_2  t2  ON   ...
    LEFT OUTER JOIN      table_3  t3  ON   ...The join condition(s) for t3 can reference t1, or t2, or both.
    Also if you have any website or reference for understand syntax or performance difference between 10g and 11g then please paste a link in.thanks!!The main manuals all have "What's New" sections near the beginning. For example:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/wnsql.htm#sthref5
    Hoek,
    We've missed you. Welcome back!

  • How to convert xml file into internal table in ABAP Mapping.

    Hi All,
    I am trying with ABAP mapping. I have one scenario in which I'm using below xml file as a sender from my FTP server.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MTO_ABAP_MAPPING xmlns:ns0="http://Capgemini/Mumbai/sarsingh">
      <BookingCode>2KY34R</BookingCode>
    - <Passenger>
      <Name>SARVESH</Name>
      <Address>THANE</Address>
      </Passenger>
    - <Passenger>
      <Name>RAJESH</Name>
      <Address>POWAI</Address>
      </Passenger>
    - <Passenger>
      <Name>CARRON</Name>
      <Address>JUHU</Address>
      </Passenger>
    - <Flight>
      <Date>03/03/07</Date>
      <AirlineID>UA</AirlineID>
      <FlightNumber>125</FlightNumber>
      <From>LAS</From>
      <To>SFO</To>
      </Flight>
      </ns0:MTO_ABAP_MAPPING>
    AT the receiver side I wnat to concatenate the NAME & ADDRESS.
    I tried Robert Eijpe's weblog (/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach)
    but couldnt succeed to convert the xml file into internal table perfectly.
    Can anybody help on this. 
    Thanks in advance!!
    Sarvesh

    Hi Sarvesh,
    The pdf has details of ABAP mapping. The example given almost matches the xml file you want to be converted.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how to use abap-mapping in xi 3.0.pdf
    Just in case you have not seen this
    regards
    Vijaya

  • How to get data of tabulated text file into internal table

    hi all,
    i want to get data from tabulated text file(notepad) into internal table. i searched in SCN and got lot of post regarding  how to convert excel file into internal table but i didnt get posts regarding text file.
    thanks
    SAchin

    try:
    DATA: BEGIN OF tabulator,
            x(1) TYPE x VALUE '09',
          END OF tabulator.
      READ DATASET file INTO wa.
    split wa at tabulator into table itab.
    A.

  • How to get data from maintaince view into internal table

    Hi,
    I want to get the all data from v_t179 (maintanence view) into intrenal table.
    if i write select stmt , it is giving error.
    I want all data into internal table.
    regards,
    Ajay

    I think this is what you want:
    TABLES: t179, t179t.
    DATA: v_t179_int TYPE TABLE OF v_t179.
    SELECT * FROM t179
      JOIN t179t ON
        t179~prodh = t179t~prodh
      INTO CORRESPONDING FIELDS OF TABLE v_t179_int.
    Rob

Maybe you are looking for

  • IE 10 and 11 error install failure ERROR: "Neutral package installation failed"

    This is a 2008 R2 physical server with all available patches installed and SFC recently run. 00:00.000: ==================================================================== 00:00.000: Started: 2014/01/16 (Y/M/D) 11:52:19.750 (local) 00:00.000: Time F

  • SAP Plant Connectivity  2.1.0.55 on Windows 7 Enterprise 32bit problem

    I tried to install SAP PCO version .1.0.55 on Windows 7 Enterprise/32bit, whenever i try to start the agent, i get the following error in the Log: ================================================= Server stack trace:    bei System.ServiceModel.Channe

  • Quarter Problem

    Hai all, I got struck in a Variable range for Quarter.    If user gives Feb 2008, then I need Variable range from Jan 2008 to March 2008(end of current Quarter). If user gives May 2008,then I need variable range from Jan 2008 to june 2008. How we can

  • Need Guidance on s/w Architecture for Server PDF Creation & File Merge App

    Please send me your recommendation on how to tackle this design requirement with the correct adobe software products.  Let me know the s/w architecture you recommend too. My client has a microsoft office 2010 application customized via VBA which is o

  • Set up new partner fucntion as cost center number type

    Hi all can we set up new partner function, set the type of partner number as cost center number ? I tried in table TVPA, created value table as CSKS.. but when I config the partner function.. saying this type is not defined.. what's the problem? than