Left table data Right table multiple returns

Hello all and thank you for taking the time to help.
I have a left table and right table I am querying from 2 remote hosts. The information in the left table is unique and has everything I need except for 2 fields; the information in the right table can have multiple rows for the same identifier. I am trying to get the latest rows information on the right. This is a snapshot of the tables:
Employee Table
  Emp_num       Emp_Name   Emp_Store     Emp_Category     Emp_Location
  W561789        Chris           R79                Sales     98-778-77
  W571779        Charles           R81                Sales     87-988-98
  W561874        Sam           R79                Management     76-977-97
W561875        Tod           R79                Sales     98-778-77
Customers Table
  Emp_num    Wait_Time  Shipment_Status      Shipment_Date
  W561789     1
  W561789                          Shipped               2/28/2011
  W561789                          On_Order             2/27/2011
  W561875                          On_Order             2/27/2011What I am trying to pull is specific information from the Employee table, and only the most recent matching record from the Customer table. My query looks something like this (it doesn't work, or it takes a really long time to run)
SELECT
    D.EMP_NUM, D.EMP_NAME,D.EMP_STORE, D.EMP_CATEGORY, D.EMP_LOCATION, M.SHIPMENT_STATUS, M.WAIT_TIME
FROM
    DB1.TABLE1@HOST_A_LINK  D,
       (SELECT EMP_NU, SHIPMENT_STATUS, WAIT_TIME,
                         ROW_NUMBER() OVER(PARTITION BY EMP_NUM ORDER BY SHIPMENT_DATE) rownumber
             FROM DB1.TABLE10@HOST_B_LINK) M
WHERE D.EMP_NUM=M.EMP_NUM
AND rownumber=1
AND D.EMP_STORE='R79'
AND D.EMP_CATEGORY IN ( 'Sales',
     'Management',
     'Supervisor')
AND D.EMP_LOCATION IN ( '98-778-77', '87-988-98')thanks

Just to close the loop on this question, I figured it out. I had to move the ROW_NUMBER() alias outside the scope of the WHERE clause. The query looks like this:
SELECT
         D.EMP_NUM,
         D.EMP_NAME,
         D.EMP_STORE,
         D.EMP_CATEGORY,
         D.EMP_LOCATION,
         M.SHIPMENT_STATUS,
         M.WAIT_TIME
FROM
    DB1.TABLE1@HOST_A_LINK  D,
       (SELECT
        FROM
                (SELECT
                            EMP_NU,
                            SHIPMENT_STATUS,
                            WAIT_TIME,
                            ROW_NUMBER() OVER(PARTITION BY EMP_NUM ORDER BY SHIPMENT_DATE) AS rownumber
                 FROM
                           DB1.TABLE10@HOST_B_LINK
        WHERE rownumber=1) M
WHERE
      D.EMP_NUM(+)=M.EMP_NUM
      AND rownumber=1
      AND D.EMP_STORE='R79'
      AND D.EMP_CATEGORY IN ( 'Sales',
                                   'Management',
                                   'Supervisor')
      AND D.EMP_LOCATION IN ( '98-778-77', '87-988-98')

Similar Messages

  • Left pane and right pane(Multiple Panes/Multiple Views) in single FACET

    Hi All,
      Please suggest how can we add left pane and right pane(Multiple Panes/Multiple Views) in single FACET , Do we need to create mutiple custom BO's or single custom BO is enough.    Is it feasible requirement to place mutilple panes/views in a single FACET.   Please suggest. 
    Thanks in advance.
    Tim

    Hi,
       Use Back Satement for that.
    ex.
    DATA:  TOWN(10)      VALUE 'New York',
           CUSTOMER1(10) VALUE 'Charly',
           CUSTOMER2(10) VALUE 'Sam',
           SALES1 TYPE I VALUE 1100,
           SALES2 TYPE I VALUE 2200.
    RESERVE 2 LINES.
    WRITE:  TOWN, CUSTOMER1,
          /       CUSTOMER2 UNDER CUSTOMER1.
    BACK.
    WRITE: 50 SALES1,
           /  SALES2 UNDER SALES1.
    Reagrds,
    prashant

  • How to Populate Internal table data to Table Control in a Report Program

    Dear All,
           How to Populate Internal table data to Table Control in a Report Program? It is a pure report program with out any Module pool coding involved, which is just used to display data. Till now it is being displayed in a report. Now the user wants the data to be displayed in a table control. Could someone tell me how to go about with this.
    Thanks in Advance,
    Joseph Reddy

    If you want to use a table control, you will need to create a screen.
    In your report....
    start-of-selection.
    perform get_data.  " Get all your data here
    call screen 100. " Now present to the user.
    Double click on the "100" in your call screen statement.  This will forward navigate you to the screen.  If you have not created it yet, it will ask you if you want to create it, say yes.  Go into screen painter or layout of the screen.  Use the table control wizard to help you along the process.  It will write the code for you.  Since it is an output only table control, it will be really easy with not a lot of code. 
    A better way to present the data to the user would be to give it in a ALV grid.  If you want to go that way, it is a lot easier.  Here is a sample of the ALV function module.  You don't even have to create a screen.
    report zrich_0004
           no standard page heading.
    type-pools slis.
    data: fieldcat type slis_t_fieldcat_alv.
    data: begin of imara occurs 0,
          matnr type mara-matnr,
          maktx type makt-maktx,
          end of imara.
    * Selection Screen
    selection-screen begin of block b1 with frame title text-001 .
    select-options: s_matnr for imara-matnr .
    selection-screen end of block b1.
    start-of-selection.
      perform get_data.
      perform write_report.
    *  Get_Data
    form get_data.
      select  mara~matnr makt~maktx
                into corresponding fields of table imara
                  from mara
                   inner join makt
                     on mara~matnr = makt~matnr
                        where mara~matnr in s_matnr
                          and makt~spras = sy-langu.
    endform.
    *  WRITE_REPORT
    form write_report.
      perform build_field_catalog.
    * CALL ABAP LIST VIEWER (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                it_fieldcat = fieldcat
           tables
                t_outtab    = imara.
    endform.
    * BUILD_FIELD_CATALOG
    form build_field_catalog.
      data: fc_tmp type slis_t_fieldcat_alv with header line.
      clear: fieldcat. refresh: fieldcat.
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material Number'.
      fc_tmp-fieldname  = 'MATNR'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '18'.
      fc_tmp-col_pos    = 2.
      append fc_tmp to fieldcat.
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material'.
      fc_tmp-fieldname  = 'MAKTX'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '40'.
      fc_tmp-col_pos    = 3.
      append fc_tmp to fieldcat.
    endform.
    Regards,
    Rich Heilman

  • How to compare table data and table field

    Hi buddy,
        I have some question about how to compare table data and table field.
       1. I know there is one method:   CL_ABAP_UNIT_ASSERT=>ASSERT_TABLE_CONTAINS  , it use in unit test to compare the table data(A and B) , you can loop table A into structure A1, then use this mehtod it can compare whether table B contain structure A1.  but when I try to use this in main program it will dump.
              CL_ABAP_UNIT_ASSERT=>ASSERT_TABLE_CONTAINS(
                                                                                                        LINE    = A1
                                                                                                        TABLE = B ).
           Is there any method or FM can be used to compare the table data ?
        2. I also want to compare two table field , try to find out the different. How to realize this.
    Thank you for your sincerely answer.

    Hi Zongjie,
    What`s the difference, if you using loop A into wa_A, read table B into wa_B with all field, then compare with wa_A and wa_B.
    The question 2, seems no standard FM available here.
    Loop A into wa_A.
       Loop B into wa_B.
           if wa_A-field1 eq wa_B-field1.
           endif.
            if wa_A-field2 eq wa_B-field2. 
           endif.
       endloop.
    endloop.
    regards,
    Archer

  • Enhancement request : Table - Data  -- Filter with multiple lines

    It would be nice when the Filter option in the tables Data tab could contain multiple lines, because :
    In case of a complex where clause on a table (used in a query) it's hard to get an impression of the filter because everything is typed on one single line.
    In case of multiple lines it's also more easy to disable a single clause temporary with a double dash (--) at the start of the line instead of searching in a complex filter where to put /* ...*/
    Eric.

    What I mean is the Filter option when displaying the data (Data tab) of a table. You have the possibility to enter a Sort and a Filter (to reduce the data that is displayed). That Filter option has no possibility to enter multiple lines. So there is no way to 'format' the filter which would be nice in case of complex or large 'where clauses'.
    What would you prefer, this (multiple lines) ?
    AND ( p_peildatum IS NULL
    OR
    TRUNC(p_peildatum) BETWEEN TRUNC(dnm.datum_ingang)
    AND TRUNC(NVL(dnm.datum_einde,p_peildatum))
    AND ( p_ondergrens IS NULL
    OR
    TRUNC(p_ondergrens) <= TRUNC(NVL(dnm.datum_einde,p_ondergrens))
    or this, like it is now (everything on one single line) :
    ( p_peildatum IS NULL OR TRUNC(p_peildatum) BETWEEN TRUNC(dnm.datum_ingang) AND TRUNC(NVL(dnm.datum_einde,p_peildatum)) ) AND ( p_ondergrens IS NULL OR TRUNC(p_ondergrens) <= TRUNC(NVL(dnm.datum_einde,p_ondergrens)) )
    Eric.

  • New page in smart form when displaying internal table data in table

    Hi ,
    My requirement in smartform is like
    I'm using the tables to display the internal table data in main window .
    based on SORTF field in the internal table ,when SORTF field value changes all the related to that SORTF value should be displayind in the new page.
    Please anybody tell me that , how to do this?
    Thanks
    Naveen

    Hi Navi,
        Try this Logic.
    1) Go to Smartform,
    2) Declare a flag variable w_flag type c
    3)Go to Main Window
       a) Go to table
       b) Create one more Table Line
       c) Create a CODE Line in that.
           write inside CODE  as Below:-
                 CLEAR: w_flag.
                 ON CHANGE OF w_final-sortf.
                   w_flag  = 'X'.
                  ENDON.
       d) Create one COMMAND Under CODE line created above.
           click on check Box "Go to New Page"  ( Page1 or Page2 or give as reqd ).
           click on conditions tabe of COMMAND
           write: w_flag = 'X'.
    Hope this will work
    Reward Points if Useful
    regards
    Avi.............

  • Update internal table data from table control

    Hi GURUS,
    I need help regarding one of my requirement.
    I need to display data from the internal table on the screen and when the user selects a record/multiple records from screen and clicks on approve button i need to update one of the field from N to Y in the corresponding Ztable. Once the record is updated from Ztable , that should no longer be visible for the user on the screen.
    I am using table control wizard to display data. I am able to update the Ztable, but that record is not refreshing from the user screen. Any suggestions would be approved.
    Also please let me know if table control is the best way to do this/ alv grid control??

    hi
       REFRESH CONTROL Control-Name FROM SCREEN '0100'  -> use this command to refresh the table control
    to know more, read into
    https://forums.sdn.sap.com/click.jspa?searchID=2934287&messageID=673474
    Re: URGENT HELP REQ IN TABLE CONTROL WIZARD
    if helpful, reward
    Sathish. R

  • How to get Dynamic table data  in table

    Actually i want to generate a table by a query . now i m able to get the data in java class but i don't know that how to present that data in a table form in UIX page.

    HI using this methods u can create dynamic internal tables,
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = FIELD_CATALOG
        IMPORTING
          EP_TABLE        = GFINAL.
      ASSIGN GFINAL->* TO <GFINAL>.
      CREATE DATA WFINAL LIKE LINE OF <GFINAL>.
      ASSIGN WFINAL->* TO <WFINAL>.
    Please let me know once the requirement clearly , is the fm or Method importing parameter is internal table , corresponding to that
    internal table you need to fetch data from data base.
    In general , field symbols holds some memory in memory area , I think just like pointers in C language , this holds address only , there we dynamically assign some structure .
    Let me know once if u not cleared ,
    Regards
    Siva

  • Loading Table Data

    Using OMW I succesfully managed to capture my access database and migrate it to Oracle. When is time to load the "table data" I get multiple errors one of them being: Integrity constraint violated-parent key not found.
    What is the best way to go about loading data into my Oracle schema?
    Thank you
    Pilton

    If it is an MS Access database you are migrating from, then we create a schema with the same name as the mdb filename. So for file northwind.mwb we would create a schema called northwind. The default password is oracle unless you change it in the Oracle Model UI of the Workbench. In the Oracle Model looks under users to see what users exist.
    Once the user is created you should simply be able to connect to that user via sqlplus and see all the schema objects/data migrated
    Donal

  • Can't see table data from Visual Studio Express 2013 for Web

    Hello!
    I have a problem and I can't see neither the table data nor the table definition for my database inside Visual Studio Express 2013 for Web, Server Explorer. When I right click it just says refresh, copy or properies.
    Does anyone know what's wrong?
    Thanks a lot!

    Hi J1m,
    According to your description, I make a test on my computer and I am able to reproduce your issue. Firstly, I install the Visual Studio 2013 express for web successfully, create a project and connect to SQL Server database. Then I right click one table,
    and I can see all the options including ‘Show Table Data ’, ‘Open Table Definition ’, ‘Copy’, ‘Refresh’, and ‘Properties’. Next, I uninstall the SQL Server data tools, and restart the Visual Studio, right click on table, and only find  the three options
    ‘Copy’, ‘Refresh’, ‘Properties’ as the following screenshot, which is the same scenario with yours.
    Based on my test, the issue could be due to the missing or corrupt SQL Server Data Tools. To work around the issue, you should install the latest SQL Server data tools for Visual Studio 2013. You could  download the
    ISO file for SQL Server data tools and extract the ISO files to your hard drive following the methods in this
    article, and install the data tools. Please restart your computer after you complete the installation.
    Regards,
    Michelle Li

  • Create XML file from table data

    Dear All,
    with dataservice 4.0, I want to create an XML file from a table data.
    Table have a single column but more record, for example:
    0001000488;100;EUR;
    0001000489;200;EUR;
    0001000450;300;EUR;
    My desired XML output:
    <Data>
      0001000488;100;GBP;
      0001000489;200;EUR;
      0001000450;300;EUR;
    </Data>
    I try with a sample query but the sistem write only the last record in XML file:
    <Data>
      0001000450;300;EUR;
    </Data>
    Can everyone help me?
    Thank in advance.
    Simone

    Hello
    That is a very simple (also odd) XML document structure, and as such doesn't require use of the XML target.  It can be easily acheived by writing a normal file with a header and footer, which is acheived using a row_generation and a query to generate the hard coded open and close tags.
    Michael

  • MHKIM:AR_PAYMENT_SCHEDULES_ALL TABLE의 DATA생성 로직

    제품: FIN_AR
    작성날짜 : 2006-11-03
    AR_PAYMENT_SCHEDULES_ALL TABLE의 DATA생성 로직
    =========================================
    Explanation
    입력된 Transaction이 Complete되는 시점에 AR_PAYMENT_SCHEDULES_ALL table에
    관련 Data row가 생성되며, Due_date는 입력된 Transaction의 due_date를 끌고 와서
    생성됩니다.
    그 이후에 Transaction data를 Incomplete했을 경우,
    기존에 생성되었던 AR_PAYMENT_SCHEDULES_ALL table data는 삭제되고,
    다시 Complete시점에 재 계산되면서 table에 insert되는 것입니다.
    Here is the way, the due date is calculated in AR for a transaction. First of
    all, you create a transaction. Depending on the payment term and the
    transaction date, the due date will be calculated. Now when you COMPLETE the
    transaction , the payment schedules are getting created.
    Now this due date data will be stored in the ar_payment_schedules table, that is initially
    created for this transaction.
    Now, you go and update the due date of this transaction. Which means that you
    are updating the due_date column of the payment schedule record of this
    transaction. That is fine till now.
    Now you query this transaction in the trx. work bench and when you Incomplete
    the invoice, the AR_PAYMENT_SCHEDULES record(s) gets DELETED. (Hence, the
    updated value containing data gets DELETED).
    Now, when again you go and COMPLETE the invoice, the payment schedule record
    gets RE-CREATED with the due_date calculated based on the payment term and the
    trx_date. Hence this due date will NOT contain the updated due_date
    information. Rather, it would have the due date calculated based on the trx
    date and the terms attached to it.

  • Exporting table data to .csv file

    How to export the table data (this table is having 18 million records) to .csv file. using SQL Developer and PL/SQL deveoloper it is taking too long time to complete. Please let me know is there any faster way to complete this task.
    Thanks in advance

    Also bear in mind that SQL Developer and PL/SQL Developer are running on your local client, so it's transferring all 18 million rows to the client before formatting and putting them out to a file. If you had some PL/SQL code to export it on the database server it would run a lot faster as you wouldn't have the network traffic delay to deal with, although your file would then reside on the server rather than the client (which isn't necessarily a bad thing as a lot of companies would be concerned about the security of their data especially if it ends up being stored on local machines rather than on a secure server).
    As already asked, why on earth do you need to store 18 million rows in a CSV file? The database is the best place to keep the data.

  • Applying table scroll bar for only table rows with table columns fixed.

    hi oa gurus,
    i had implemented table scroll bars using oarawtextbean , there is no problem in vertical and horizontal scroll bar working its working fine. but the requirement is i need to scroll only the table rows with table columns fixed. so , how to achieve the table scroll for only table datas neglecting table headers.
    the code for vertical and horizontal bars scroll is like this,
    OARawTextBean ors = (OARawTextBean)webBean.findChildRecursive("raw1");
    ors.setText(div id=tabledivid style=height:500px;width:100%; overflow:auto>);
    OARawTextBean ore = (OARawTextBean)webBean.findChildRecursive("raw2");
    ore.setText("</div>");
    where raw1 and raw2 are rawtextbean created above and below of the table . but i dont know hoow to apply this only for table rows neglecting table columns , can anybody give any ideas.
    pelase this is very urgent , can u help me in this regards
    thanks
    Edited by: user630121 on Sep 29, 2008 5:17 AM
    Edited by: user630121 on Sep 29, 2008 5:18 AM

    hi,
    I have a similar task to do... Only to apply scrollbar at the table level.
    I tried using the above mentioned but I am facing Null Pointer Exception..
    Please explain about raw1 and raw2
    Rahul

  • Adobe form - Split internal table data & dis on the right and left corner

    HI ,
    I have a form where i am populating the data via an Internal Table.
    The concern i have is i have 100 rows in the table and i want to print the first 10 rows on the right hand side of the page and the next 10 rows on the Left hand side of the page. I want to do this dynamically on multiple pages during run time based on the volume of data in the internal table.
    I am sure i cannot dynamically change the interface of the form to allow multiple internal table , Please suggest if there is any other solution.
    Thanks in advance
    Tk
    Edited by: tarunk on Jan 16, 2012 5:56 PM

    Hi,
    Thank you  very much for the input, But my concern is
    I have a table with 120 records.
    i have three columns which i have it on the right side as well as on the Left side of the page.
    EX:
    Right Side                                                                          Left Side
    Col1 col2 col3                                                                    col1 col2 col3.
    Now what i want to do is the first ten rows of the internal table data i want to print it on the Right Side and the Next 10 rows on the Left Side in the same page .
    I want to do this on Multiple pages.
    please suggest.
    Thanks,
    Tk

Maybe you are looking for

  • Get PricingConditions values from PricingConditionPanel class method?

    Hi, The class PricingConditionPanel returns the arraylist of the pricing onditions on the item with method getPricingConditions(); through the interface PricingContainer. I am able to get the values in the arraylist returned by the class. It actually

  • I have just upgraded to 3.6.10 and find FF now crashes when I load it.

    After updating from 3.6.8 (or 9 not sure) to 3.6.10 I find FF crashes within a couple of seconds of starting. The very first time I got messages from my iGoogle home page asking me to enable cookies (they were) and to clear my cache (which I did). No

  • What's wrong with the HTML Editor?

    When editing the HTML of my project, when I put the cursor into position the text at that point partially disappears - notice the 'd' in 'bold' above. It's also slow and generally just difficult to use because the text gets so messed up when you edit

  • Changing background colour of W995 (when you don't have wallpaper)?

    Hello, If i set my phone to have no wallpaper the background colour for the main screen is grey.  Sorry if this is a dumb question, but does anyone know how to change this to black?  I think it was black to start with but somehow it got changed and I

  • Play back quality

    Hi When I burn a dvd it plays back with no problems on my mac but on my set top dvd it seems to jitter and shimmer. suggestions appreciated. Thanks. Trevor