Query to get list of customers with partial shipments

I have a scenario where I need to find customers with open orders.  (Orders and Shipments have 1-to-many relationship ):
Orders = (order_id PK, cust_id FK, prod_id FK, order_quantity, order_date)
Shipments = (shipment_id, order_id FK, shipment_quantity, shipment_date)
Open orders have 2 scenarios:
1) orders without shipment records
2) partial shipments:
e.g. 1 order record with quantity 10.  
2 records in shipments table, 1 row with quantity 3, and the 2nd row with quantity 4; total shipped quantity is 7, which is less than order quantity of 10
How can I get this?

ZaafranAhmed wrote:
I have a scenario where I need to find customers with open orders.  (Orders and Shipments have 1-to-many relationship ):
Orders = (order_id PK, cust_id FK, prod_id FK, order_quantity, order_date)
Shipments = (shipment_id, order_id FK, shipment_quantity, shipment_date)
Open orders have 2 scenarios:
1) orders without shipment records
2) partial shipments:
e.g. 1 order record with quantity 10. 
2 records in shipments table, 1 row with quantity 3, and the 2nd row with quantity 4; total shipped quantity is 7, which is less than order quantity of 10
How can I get this?
SELECT order_id
FROM   orders
WHERE  order_quantity > (SELECT SUM(shipment_quantity)
                         FROM   shipments
                         WHERE  orders.order_id = shipments.order_id);

Similar Messages

  • Looking for a bapi that gets the list of customers with a credit limit

    Hello SAP gurus
    I want to know if there is a standard bapi that I can use to find all customers with a credit limit of $10000 and that have exceeded this limit.
    Any response/feedback will be highly appreciated.
    Tks
    Ram

    Thanks J@Y,
    I had read that discussion about the tables with the info. However, I have an external program that is integrated to SAP sytem (using webservices). The external program when needed has to retrieve the list of customers who have exceeded certain credit limit. So I was wondering if there is any standard BAPI which I can use. Or do I need to write my own BAPI using the tables info that you have indicated.
    Tks
    Ram

  • WebService get list 750 records with 8 columns in mx:DataGrid atleast 2 minutes

    I am using WebService (ASP.NET) to get a list of customers (around 750) records with 8 columns using mx:DataGrid. It takes to list data in the mx grid atleast 2 minutes from offline development data server[SQL SERVER 2005]. It could be better if the list populate the datagrid with-in 1 minute. I didn't find how to resolve the problem. My WebService returns the ArrayCollection within 1 minute.
    Any hints would appreciate!
    T. Ghosh

    It doesn’t matter how many records, what matters is how many attributes and sub-objects.  One customer returned 100 records, each with a transaction history of some 10,000 transactions, although the transactions were not displayed in the datagrid (it would be later in the detail view).  Then the app was configured to convert the records to typed objects.  As one would expect, it took forever.  You might have to create a custom converter or just use the SOAP/XML.

  • Query to get list of linked server tables referenced inside a stored procedure

    Hi,
    SQL Server 2005 sp4
    I have a requirement to get list of linked server tables referenced insider a stored procedure
    Ex:
    Databases       DB1          DB2
    Tables:            T1             T2                            
    Use DB1
    Go
    Create proc P1
    begin
    select * from T1
    select * from DB2.dbo.T2
    end
    I am looking for a query which can return a result with output as below. sp_depends is not helping here as it does not work for cross DB objects, any other thoughts.
    Tables
    T1,
    DB2.dbo.T2

    On SQL 2005, you will have to do it manually.
    On SQL 2008 or later, you could have used sys.sql_expression_dependencies.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Query to get all active customers in oracle apps

    Hi All,
    I want to grab all active customers account number, customer name, email address, tel number. Could any one give me the query to get it.
    Thanks,
    Red.

    Hi,
    Please refer to this document, and see if it helps.
    Note: 68046.1 - SQL Scripts To Extract Information Relating To A Particular Customer
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=68046.1
    Regards,
    Hussein

  • Query to get value sets associated with its descriptive flexfield

    Hi All,
    Here i have a issue
    I am trying to get Value sets associated with its descriptive flex field of Receivable application and
    also if i want this for particular responsibility i.e., GW RBC Receivable Super User.
    I hope u got it.
    Please suggest me some query to get this.
    This is very important for me.

    Hi, I think your question should be addressed to the OEBS experts

  • Parsing query and getting list of tables used

    Hi All,
       I require to parse sql query (simple & complex as well) and to get the list of tables used in the query.
       And need to validate that, the list of tables against a whitelist to maintained in the file.
      I tried to write my own parser, since there are lots possible ways to write complex queries, i am unable to cover all the scenarios.
      I require a help, Is there any other ways to get the list of tables used in a query?
    Thanks,
    Mahendran..

    user10279893 wrote:
    Hi All,
       I require to parse sql query (simple & complex as well) and to get the list of tables used in the query.
       And need to validate that, the list of tables against a whitelist to maintained in the file.
      I tried to write my own parser, since there are lots possible ways to write complex queries, i am unable to cover all the scenarios.
      I require a help, Is there any other ways to get the list of tables used in a query?
    Thanks,
    Mahendran..
    You'll never cover all scenarios by trying to parse a query.
    For example, what about a query that queries views and those views query pipelined functions, and those pipelined functions query other views or tables or pipelined functions etc.
    And what about a query that dynamically obtains the table names, such as...
    SQL> select
      2    table_name,
      3    to_number(
      4      extractvalue(
      5        xmltype(
      6 dbms_xmlgen.getxml('select count(*) c from '||table_name))
      7        ,'/ROWSET/ROW/C')) count
      8  from user_tables
      9 where iot_type != 'IOT_OVERFLOW'
    10 or    iot_type is null;
    TABLE_NAME                      COUNT
    DEPT                                4
    EMP                                14
    BONUS                               0
    SALGRADE                            5
    .. in this case the tables being accessed (to count their rows) are not even known within the code, they are dynamically generated queries at run-time, so the only way to know what tables are accessed is to actually run the query.
    Of course, a well designed system, with proper documentation and version control would allow you to take any database object and know where and what is using it, and whether it's even being used.

  • How to get list of users with access of MM01 (create & change)

    Hi all,
    i have to take out list of user having access for MM01 (create material), when i use SUIM to get the list it shows all the list of users including the users with DISPLAY & CHANGE, but i want only those users who had the access of CREATE & CHANGE.
    please help out me, its very urgent.
    Thanks & Regards
    Syed..

    Hi Syed,
    You can try to get it from S_BCE_68001398. Key in the required transaction code.
    Thanks and Regards
    Points reward is much appreciated

  • How to get list of Customers and their FOB terms from backend?

    Hi All,
    Can anyone help me with the customers and their FOB terms from the backend? What tables can be linked to get that information??
    Thanks,
    Prathima

    Can you please share your solution ?

  • How to get list of customers for a particular plant.

    Hello All,
    I have a requirement of the customer aging analysis report where I need to get the details of the customer for a particular plant.I have searched the tables T001w and Kna1 but  found no  result for my requirement.can any body tell me how to solve this issue or tell me any tables which give the information regarding the customers based on a particular plant.
    Regards,
    Pavani.

    Thank u all...for the reply
    But while creating a customer in XD01 we are not maintaing any plant data in that we are just giving the sales area data and the company code data in the initial screen. A particular customer can be used for any no of plants in our organisation than in that case how is it posible to get the data for the required plant.Here the plant is not same as the customer or vendor.
    Regards,
    Pavani.
    Edited by: Pavani Rayappureddi on Mar 16, 2009 4:19 PM

  • Query to get list of queries within a specific session.

    Hi all,
    I want to know the query which will return me all the queries within a session. I have a query which I use quite often, but it returns the last query executed within that session.
    select st.sql_text
    from v$sqltext st,v$session sn where st.address=sn.sql_address and st.hash_value=sn.sql_hash_value and
    sn.sid = <sid> and
    sn.serial# = <serial#>
    order by st.piece
    Could anybody help me.
    thanx,

    Hi,
    Thanx.
    I have one more query, does oracle server keep cursors open till end of the transaction or close it immediately as soon as query is successfully executed ? If it's not closing the cursors immediately, why the following query where I am joining v$sqltext, v$session and v$open_cursor is not retruning me all the queries in one transaction. I believe, transaction is queries executed between two successive commit / rollback. The following query is returning me the same resultset as the earlier one.
    select oc.sql_text from v$session sn, v$open_cursor oc where sn.sql_address = oc.ADDRESS and sn.sql_hash_value = oc.HASH_VALUE and sn.sid = 8 and sn.serial#= 22769;
    Thanx,

  • Sales Reports with Partial Shipments

    Hello,
    I need to write a sales report for open orders. If the order has been partially shipped, I just need to pull what remains to be shipped and display this total.
    If the order has not been partially shipped, I need to pull the doc total.
    How do I specify if an order has been partially shipped or not? Is there any way to say, "If a line in RDR1 has been shipped or partially shipped, sum the totals of OpenCreQty * Price, else pull DocTotal"?
    I need to display the report in 1 line per sales order.
    Thanks in advance,
    Chris

    Hi Christine, 
    Without knowing the exact fields you are using you should be doing something like: 
    If {TABLE.OpenCreQty} NOT EQUAL {TABLE.Quantity} Then
         0
    Else {TABLE.Quantity};
    NOTE: WHERE IT SAYS NOT EQUAL TO should be LESS THAN and GREATER THAN symbols. They don't show up in here.
    So the If is checking what was shipped with the order's quantity.  If they are not equal then show 0 otherwise show the order's quantity. 
    Now you can do a summary and sum this formula and you should get the proper numbers. 
    Good luck,
    Brian

  • Table  name in  CRM   to  get  the list  of  customers

    Hi  Gurus
    What is the  Table name  or  T  code  in  CRM  for   getting the list of  customers  with  reference to  sales   area. ie  Sales  org , Distribution channel  and  Division.
    Similar  to  the    KNVV table in   SD
    Regards
    Raj

    Hi Raj,
    There are some tables with this information. You can use CRMM_BUT_LNK0011, but you can also check for tables with prefix CRMM_BUT_LNK0* for more information.
    You have to use the partner GUID, to read this information.
    Kind regards,
    Garcia

  • Reqd. T-code in which list of customers display with CIN Details

    Dear All,
    Is there any t-code in which the List of Customers with cin details Display?Like the MKVZ,
    this is the t-code for List of Vendors Display.
    Thanks,
    Sumit.

    Dear Sir,
    I have found another t-code VCUST  for customer detail but in this CIN DETAILS are not there.
    so pls. suggest something...
    Thanks,
    Sumit.

  • CAML query on SharePoint list not working after reaching threshold limit

    I have written CAML query to filter and get list items. It was working fine, but the List items count crossed 5000 and its around 15000 items. In Server Object Model When i execute my query to get list items throws exception as " The
    attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator ".
    My Code:
    SPList list = web.Lists["ComplaintReturnsForm1"];
    string QIRIdNo = fldQIRIdNo.Text;
    SPQuery query = new SPQuery();
    query.Query = "<Where><Eq><FieldRef Name='fldQIRIdNo' /><Value Type='Text'>" + QIRIdNo + "</Value></Eq></Where>";
    SPListItemCollection itemcoll = list.GetItems(query);
    Please help me to fix it. 

    Hi Mario,
    Thanks a lot for your reply.
    query.Query = "<Where><Eq><FieldRef Name='fldQIRIdNo' /><Value Type='Text'>"
    + QIRIdNo + "
    in this CAML query i have indexed my field "fldQIRIdNo". Now i have more then 5000 items in list, and
    iam able to get my list item data without any error.
    Please let me know if my action is wrong.

Maybe you are looking for

  • How to get the values of the fields inside pageFragment

    Hi All, I am working on Jdeveloper 11.1.1.5. I have a fragment "home.jsff", in that fragment i have two textboxes(txt1,txt2); Then i have created a bounded taskflow "myTF"and dragged the home.jsff inside it and used as a default activity. Now finally

  • 4th Gen iPod Shuffle not detected by Windows(7)/iTunes

    Hi, I have an iPod Shuffle 4th Gen (I believe it's a 2GB).  I use windows 7. I'm having an issue where Windows and iTunes cannot detect my iPod shuffle. It was working fine, then I did a restore and set it into manual handling.  About 30 minutes late

  • Iweb domain name

    Hi, When publishing a site with iWeb, I always get very long domain names like www.ostendbeach.be/OSTENDBEACH/index.html in my browser. Can I choose to only see www.ostendbeach.be with no other referrals to sub-folders in my browser ? Thanx, Jan

  • Network fails after upgrade

    hey guys, i just installed Arch Linux, and the first thing i did waas update the whole system via pacman -Syu.  (i installed arch using the BASE iso only, so only the base system was installed)  it downloaded all the updates for my system and install

  • Two Calendars in one order

    Hi, I am looking to order two calendars in one order so that I can save on shipping. Is that possible? Thanks, M