SAles related query

If i want to sell only particular quantity of material to a customer (say 100 pieces/month), can i control that functionality with condition update?, till now i know the functionality of condition update is, it can be used for specific price or say discounts, say till 3 orders system will pick different price, the moment 4th order will be created, different price will be there.
my scenario is, i don't want any of my customer to have monopoly of the product in the market which i am producing.
Please help.

Dear Nitesh,
as other colleagues said, there are many possibilities, how you can control this. One of very often used possibilities is the allocation functionality. Here you can practically indicate the limit, how many goods can you sell to determined customer. Then the availability check will take this limit into consideration and can confirm maximally the quantity allowed for a concrete period (for example, 100 pc in June, 100 pc in July, 100 pc in August etc.)
You can find the Customizing setting for the allocation functionality under:
SPRO => Sales and Distribution => Basic Functions => Availability Check and Transfer of Requirements => Availability check => Availability Check Against Product Allocation => ...
Of course, alternatively you can use outline agreements like contracts or scheduling agreements without delivery schedules, which have the target quantity.
I hope, this info helps you a little bit further.
Kind regards,
Akmal Vakhidov
Development Support SD, SAP, Walldorf/Germany

Similar Messages

  • Posting key for payment documents with sales related check

    Hi,
    sometime during 2010 posting key for posting cusotmer payments was changed in other attibutes to sales related.  a correction has been made to the posting key but now I need to correct all the documents in BSEG field XUMSW and remove the sales related check.
    does anyone know of a way or a program that will do this?
    your help is greatly appreciated.
    CM

    Hi,
    You cannot change XUMSW (sales related item) in OB32.Here most of the fields are there for changeble option.but for your case it is not applicable.
    It means you cant change that field.
    If you want really modify it for certain documents you need to writ Query to change in table level.
    Normal BDC and LSMW will not work.
    Thanks
    ANJI REDDY

  • Omit sales related info in Materials report

    Hi Experts,
    I have a Material Master report, which gets fields only from non-sales related tables. But I still see two rows for each material, one ofr each Sales Org.
    Previously the report had data like Sales Org, Dist Channel nad Repair Cat which were pulled from MVKE table. Now I have removed all these and also Company Code field was removed that comes from T001 table.
    So my question is why does the report still show two rows for each material eventhoug there are no Sales related fileds being pulled into the report.
    thanks,
    ACS
    I still have the Company Code in the selection criteria, can this be the reason?

    Gattu,
    Thanks for your reply.
    However, the problem goes like this.
    I am working on an existing BO report. This report works perfectly(shows only the open sales orders) except for some leakage(some delivered items too get it).
    The existing report's query have filters only one MRP Element and Order Category.
    Could there be anything that can be done with these objects?
    Thanks,
    Arun KK

  • How can I related Query name with Query elements?

    Hello gurus!
    I am working with BI7, content technical, well I need to find out a solution where I can related Query name with query elements (KYF, CKY, Restricted Key Figures, var, etc)
    In master data 0tctquery, exist the query element, but, I can not related with object are from what query...
    Do you know how I can do it??? some solution???
    Best Regards

    "it is impossible to relate both tables" ???
    hmmm... these are exactly the tables the Query Designer uses to "build" up the query... so trust me, they do relate
    now to get this information in an InfoCube is a totally different thing... how do you expect to report on this if you should get it in an InfoCube? let's take a simple example... assume you have a query (QUERY_1) which looks like:
                                      Sales  Sales
    Sales Org Customer    Qty      Value
    1000         ABC           10 PC  500 €
    1000         DEF             5 PC  250 €
    in your Cube you would get:
    QueryName  QueryElement
    QUERY_1    0SALESORG
    QUERY_1    0CUSTOMER
    QUERY_1    ZSLSQTY
    QUERY_1    ZSLSVAL
    if you have free characteristics, you'll add more lines... same for variables, CKFs, RKFs, conditions, ...
    I guess it would be better to create a little ABAP report using the above tables (oh, you'll be needing a lot more tables if you wish more detail)

  • Sales Analysis Query

    Dear Experts,
    Want to Sales Analysis Query same as Sales Analysis in SAP
    In standard SAP when we run report with anual slection criteria for eg, 01/04/2010 To 31/03/12
    it's show in one column not display in compare with Quaterwise & Monthwise report.
    Result for query is
    Customer Code, Customer Name, Year2010 (Sales), Year2011 (Sales), Year2012 (Sales)
    Please help me.
    BR
    Deep

    Ok........
    It was my query mistake.......
    Please try this......
    SELECT Distinct T0.CardCode,T0.CardName, 
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2006%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2006',
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2007%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2007',
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2008%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2008',
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2009%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2009',
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2010%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2010',
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2011%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2011',
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2012%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2012'
    FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    Group By SUBSTRING((CONVERT(VARCHAR(11),T0.DOCDATE,106)),8,11), T1.ItemCode, T0.CardName, t0.CardCode
    Regards,
    Rahul

  • Sales Analysis query issue

    Experts,
    I have compiled a Sales Analysis Query for a client who need more information than the Sales Analysis in SBO can give them.
    I have found that if I only run the Months of July and August (choose these randomly) I get the correct amounts in the July and August columns.
    When I add these months to the whole query, July and August gets multiplied. The more invoices I add for a specific customer the more it is multiplied.
    I need to know what is wrong with the whole query. Any help would be appreciated.
    Here is the July & August query that is correct:
    SELECT T0.[CardCode], T0.[CardName],
    (SUM(T9.Debit) - sum(T9.Credit)) AS 'July',
    (SUM(T10.Debit) - sum(T10.Credit)) AS 'August'
    FROM  OCRD T0
    LEFT JOIN JDT1 T9 ON T9.ShortName = T0.CardCode AND Month(T9.Duedate) = 7  AND Year(T9.Duedate) = 2010 AND T9.TransType in ('13','14')
    LEFT JOIN JDT1 T10 ON T10.ShortName = T0.CardCode AND Month(T10.Duedate) = 8 AND Year(T10.Duedate) = 2010 AND T10.TransType in ('13','14')
    WHERE T0.CardType = 'C'
    Group By T0.[CardCode], T0.[CardName]
    Here is the Total query that mulitplies the data per month:
    SELECT T0.CardCode, T0.CardName,
    (SUM(T1.Debit) - sum(T1.Credit)) AS 'Total Sales 2009', ((SUM(T1.Debit) - sum(T1.Credit))/12) AS '2009 Monthly Avg', (SUM(T2.Debit) - sum(T2.Credit)) AS 'Total Sales 2010',
    ((SUM(T2.Debit) - sum(T2.Credit))/Month(GetDate())) AS '2010 Monthly Avg',
    (SUM(T3.Debit) - sum(T3.Credit)) AS 'January 2010',
    (SUM(T4.Debit) - sum(T4.Credit)) AS 'February 2010',
    (SUM(T5.Debit) - sum(T5.Credit)) AS 'March 2010',
    (SUM(T6.Debit) - sum(T6.Credit)) AS 'April 2010',
    (SUM(T7.Debit) - sum(T7.Credit)) AS 'May 2010',
    (SUM(T8.Debit) - sum(T8.Credit)) AS 'June 2010',
    (SUM(T9.Debit) - sum(T9.Credit)) AS 'July 2010',
    (SUM(T10.Debit) - sum(T10.Credit)) AS 'August 2010',
    (SUM(T11.Debit) - sum(T11.Credit)) AS 'September 2010',
    (SUM(T12.Debit) - sum(T12.Credit)) AS 'October 2010',
    (SUM(T13.Debit) - sum(T13.Credit)) AS 'November 2010',
    (SUM(T14.Debit) - sum(T14.Credit)) AS 'December 2010'
    FROM  OCRD T0
    LEFT JOIN JDT1 T1 ON T1.ShortName = T0.CardCode AND Year(T1.Duedate) = 2009 AND T1.TransType in ('13','14')
    LEFT JOIN JDT1 T2 ON T2.ShortName = T0.CardCode AND Year(T2.Duedate) = 2010 AND T2.TransType in ('13','14')
    LEFT JOIN JDT1 T3 ON T3.ShortName = T0.CardCode AND Month(T3.Duedate) = 1  AND Year(T3.Duedate) = 2010 AND T3.TransType in ('13','14')
    LEFT JOIN JDT1 T4 ON T4.ShortName = T0.CardCode AND Month(T4.Duedate) = 2 AND Year(T4.Duedate) = 2010 AND T4.TransType in ('13','14')
    LEFT JOIN JDT1 T5 ON T5.ShortName = T0.CardCode AND Month(T5.Duedate) = 3 AND Year(T5.Duedate) = 2010 AND T5.TransType in ('13','14')
    LEFT JOIN JDT1 T6 ON T6.ShortName = T0.CardCode AND Month(T6.Duedate) = 4 AND Year(T6.Duedate) = 2010 AND T6.TransType in ('13','14')
    LEFT JOIN JDT1 T7 ON T7.ShortName = T0.CardCode AND Month(T7.Duedate) = 5 AND Year(T7.Duedate) = 2010 AND T7.TransType in ('13','14')
    LEFT JOIN JDT1 T8 ON T8.ShortName = T0.CardCode AND Month(T8.Duedate) = 6 AND Year(T8.Duedate) = 2010 AND T8.TransType in ('13','14')
    LEFT JOIN JDT1 T9 ON T9.ShortName = T0.CardCode AND Month(T9.Duedate) = 7 AND Year(T9.Duedate) = 2010 AND T9.TransType in ('13','14') 
    LEFT JOIN JDT1 T10 ON T10.ShortName = T0.CardCode AND Month(T10.Duedate) = 8 AND Year(T10.Duedate) = 2010 AND T10.TransType in ('13','14')
    LEFT JOIN JDT1 T11 ON T11.ShortName = T0.CardCode AND Month(T11.Duedate) = 9 AND Year(T11.Duedate) = 2010 AND T11.TransType in ('13','14') 
    LEFT JOIN JDT1 T12 ON T12.ShortName = T0.CardCode AND Month(T12.Duedate) = 10 AND Year(T12.Duedate) = 2010 AND T12.TransType in ('13','14')
    LEFT JOIN JDT1 T13 ON T13.ShortName = T0.CardCode AND Month(T13.Duedate) = 11 AND Year(T13.Duedate) = 2010 AND T13.TransType in ('13','14')
    LEFT JOIN JDT1 T14 ON T14.ShortName = T0.CardCode AND Month(T14.Duedate) = 12 AND Year(T14.Duedate) = 2010 AND T14.TransType in ('13','14')
    WHERE T0.CardType = 'C'
    Group By T0.CardCode, T0.CardName

    Hi,
    Try this
    SELECT T0.CardCode, T0.CardName,
    (SUM(T1.Debit) - sum(T1.Credit)) AS 'Total Sales 2009', ((SUM(T1.Debit) - sum(T1.Credit))/12) AS '2009 Monthly Avg', (SUM(T1.Debit) - sum(T1.Credit)) AS 'Total Sales 2010',
    ((SUM(T1.Debit) - sum(T1.Credit))/Month(GetDate())) AS '2010 Monthly Avg',
    ((sum(Case DATENAME(month,T1.DueDate) when 'January' then T1.Debit  else 0 end)-sum(Case DATENAME(month,T1.DueDate) when 'January' then T1.Credit  else 0 end))) Jan,
    (sum(Case DATENAME(month,T1.DueDate) when 'February' then T1.Debit  else 0 end)-sum(Case DATENAME(month,T1.DueDate) when 'February' then T1.Credit else 0 end))[Feb],
    (sum(Case DATENAME(month,T1.DueDate) when 'March' then T1.Debit  else 0 end)-sum(Case DATENAME(month,T1.DueDate) when 'March' then T1.Credit else 0 end))Mar,
    (sum(Case DATENAME(month,T1.DueDate) when 'April' then T1.Debit  else 0 end)-sum(Case DATENAME(month,T1.DueDate) when 'April' then T1.Credit else 0 end))Apr,
    (sum(Case DATENAME(month,T1.DueDate) when 'May' then T1.Debit  else 0 end)-sum(Case DATENAME(month,T1.DueDate) when 'May' then T1.Credit else 0 end))May,
    (sum(Case DATENAME(month,T1.DueDate) when 'June' then T1.Debit  else 0 end)-sum(Case DATENAME(month,T1.DueDate) when 'June' then T1.Credit else 0 end))Jun,
    (sum(Case DATENAME(month,T1.DueDate) when 'July' then T1.Debit  else 0 end)-sum(Case DATENAME(month,T1.DueDate) when 'July' then T1.Credit else 0 end))Jul,
    (sum(Case DATENAME(month,T1.DueDate) when 'August' then T1.Debit  else 0 end)-sum(Case DATENAME(month,T1.DueDate) when 'August' then T1.Credit else 0 end))Aug,
    (sum(Case DATENAME(month,T1.DueDate) when 'September' then T1.Debit  else 0 end)-sum(Case DATENAME(month,T1.DueDate) when 'September' then T1.Credit else 0 end))Sep,
    (sum(Case DATENAME(month,T1.DueDate) when 'October' then T1.Debit  else 0 end)-sum(Case DATENAME(month,T1.DueDate) when 'January' then T1.Credit else 0 end))Oct,
    (sum(Case DATENAME(month,T1.DueDate) when 'November' then T1.Debit  else 0 end)-sum(Case DATENAME(month,T1.DueDate) when 'November' then T1.Credit else 0 end))Nov,
    (sum(Case DATENAME(month,T1.DueDate) when 'December' then T1.Debit  else 0 end)-sum(Case DATENAME(month,T1.DueDate) when 'December' then T1.Credit else 0 end)) Dec
    FROM  OCRD T0
    LEFT JOIN JDT1 T1 ON T1.ShortName = T0.CardCode AND Year(T1.Duedate) = 2010   AND T1.TransType in ('13','14')
    WHERE T0.CardType = 'C'
    group by DATENAME(month,T1.DueDate), T0.CardCode, T0.CardName
    Thanks,
    Neetu

  • Combined Purchase Order and Sales Order Query. (Including Stand Alone Docs)

    Hi,
    I need some help please!
    I am looking for a query that will show all the Purchase Orders with all their base document Sales Orders. However I also need to show those stand alone Purchase orders and Sales Orders.
    What I have is two queries, one for the PO fields en one for The SO fields. I would like a way to combine these two so I have one query with the relevant PO and SO info next to each other.
    The final query will have a top heading structure like this:
    Status,Purchase No.,Supplier No.,Supplier Name,Week,Month,Del Method,Country,Method,Rep.|Status,Rep.,Sales No.,Customer No.,Customer Name,Customer Order no.,Cust. Del date,Doc total,Del Method
    +(The first part is for the purchase order section, the second part starting at the second 'Status' is the sales order section)
    +Purchase Order Query:
    SELECT
      T0.DocStatus 'Status',
      T0.DocNum'Purchase Order No.',
      T0.CardCode 'Supplier No.',
      T0.CardName'Supplier Name',
      DATEPART(ww,T0.DocDuedate)'Week',
      DATEPART(mm,T0.DocDuedate) 'Month',
      T1.TrnspName 'Delivery Method',
      T2.Country 'Country',
      T0.JrnlMemo 'Method',
      T3.SlpName 'Rep.'
    FROM OPOR T0 
    INNER JOIN OSHP T1 ON T0.TrnspCode = T1.TrnspCode
    INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode
    INNER JOIN OSLP T3 ON T0.SlpCode = T3.SlpCode
    Sales Order Query:
    SELECT
      T0.DocStatus 'Status',
      T2.SlpName 'Rep.',
      T0.DocNum 'Sales Order No.',
      T0.CardCode 'Customer No.',
      T0.CardName 'Customer Name',
      T0.NumAtCard 'Customer Order no.',
      T0.DocDueDate 'Cust. Delivery date',
      T0.DocTotal ' Doc total',
      T1.TrnspName ' Delivery Method'
    FROM ORDR T0 
    INNER JOIN OSHP T1 ON T0.TrnspCode = T1.TrnspCode
    INNER JOIN OSLP T2 ON T0.SlpCode = T2.SlpCode
    The problem I am having is that if I combine these queries it excludes all those records with blank/empty data fields.
    I do not mind having to go to crystal reports to get what I want.
    Any suggestions?
    Thanks!

    Hi thanks GordonDu,
    I have tried a union before, and yours works great. However my problem is to display the  PO en SO columns next to each other and not underneath each other.
    Something like this:
    Po No          Supplier          SO No           Customer
    1234           Sup 1             9876              Cust 1
    1235           Sup 2             no SO             Cust 2
    1236           Sup 3             9877              Cust 3
    1237           Sup 4             9878              Cust 4
    1238           Sup 5             no SO             Cust 4
    I have this query, but with this it drops all those Purchase Orders made Stand Alone and without a SO number.
    SELECT
      T2.DocNum AS 'Purchase Order No.',
      T0.DocNum AS 'Sales Order No.',
      T2.CardCode AS 'Supplier No.',
      T2.CardName AS 'Supplier Name'
    FROM ORDR T0 
       INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
       INNER JOIN OPOR T2 ON T2.DocEntry = T1.PoTrgEntry
    Though using your Union gives me all the information I want and the ability to expand on that, my problem is the "Display" part. I am sure I am doing something stupid somwhere 
    Edited by: Desmond Moll on Mar 7, 2012 8:03 AM

  • Urgent! Sales-related item?

    Does anyone know where the field XUMSW (sales-related item) is checked when posting a vendor(yes, actually)  invoice (FI-AR invoice)? Me and two co-workers are debugging a program when parking an invoice in FV60, and are about to come to a solution on an existing problem.. This field information is very important, but unfortunately a black hole for us.
    Thanks,
    Eaj

    Thanks.
    To be more specific; when is this indicator checked in the first place?
    The function modules FI_DUPLICATE_INVOICE_CHECK checkes <i>if</i> the indicator is checked. But we need to know at what point the indicator is set in the first place.
    CORRESPONDENCE_REQUEST/CORRESPONDENCE_REQUEST_POSTING unfortunately isn't relevant.

  • The workbook report no authorization, but related query can show part data

    Dear All,
    We meet an error, The workbook report no authorization, but related query can show part data.
    We have a workbook, it have 1 queries, and when we key in condition to run it, in one field we put on one more condition(Z3XXX = ' WZO'  & ' WZA")(User didn't have authorization for this condition),  and workbook report no authorization.
    Then we checked  authorization check log and it show "You do not have sufficient authorization on Z3XXX = ' WCO'.
    But when we execute the related query with same condition. the query can open and show WZA's data.
    I'd like to know the reason.
    thanks & Best Regards,
    Kent Yu

    Dear All,
    We meet an error, The workbook report no authorization, but related query can show part data.
    We have a workbook, it have 1 queries, and when we key in condition to run it, in one field we put on one more condition(Z3XXX = ' WZO'  & ' WZA")(User didn't have authorization for this condition),  and workbook report no authorization.
    Then we checked  authorization check log and it show "You do not have sufficient authorization on Z3XXX = ' WCO'.
    But when we execute the related query with same condition. the query can open and show WZA's data.
    I'd like to know the reason.
    thanks & Best Regards,
    Kent Yu

  • Multi-part related query reports

    http://download-east.oracle.com/docs/html/B10310_01/orbr_concepts1.htm#1012365
    Can someone provide me better info about 'Multi-part related query reports '

    Hi,
    yes you can have multiple query in your report. So you have multiple groups in your data model. Then you must put multiple repeating frames in your layout in order to extract data from your queries, selecting the desired group in the source property of your repeating frame.
    Bye
    Raffy

  • Monthly Sales Order query Doc Status problem

    Hi Experts,
    I am having an problem while making a total monthly sales order query in which I am not getting the document status which are Open - Printed. Also note that these document which are open printed are not having any target document.
    SELECT T0.[DocStatus],T1.[TargetType],T0.[CANCELED],T0.[CardCode], T0.[CardName], T0.[NumAtCard], T5.[SeriesName], T0.[DocNum], T0.[DocDate], T0.[DocDueDate], T0.[DocTotal],T0.[Max1099]'Total Before Discount',T0.[TotalExpns],T4.[descript]'Territory',T2.[SlpName]'Employee Name'
    ,T0.[discsum]  FROM ORDR T0  ,RDR1 T1,OSLP T2,OCRD T3,OTER T4,NNM1 T5  where  T0.DocEntry = T1.DocEntry AND T0.SlpCode = T2.SlpCode AND T0.CardCode = T3.CardCode
    AND T3.Territory = T4.territryID AND T0.Series = T5.Series and T0.[CANCELED]='N' and T1.[TargetType] is not null
    My mission for the above query is to have Total Monthly Sales Orders with value exluding the cancelled and closed sales sales ( close here means - which are manually done by right click on sales order screen and selecting Close )
    Please guied how to solve this issue because in the back end for Sales Order which have turned to deleivery are showing doc status as closed and the sales order which are manually closed are also showing doc status as closed. How to diffrentiate between them.
    Waiting for a positve feedback.
    Regards,
    Rahul

    Try this one:
    SELECT DISTINCT T0.[DocStatus],T0.[CardCode], T0.[CardName], T0.[NumAtCard], T5.[SeriesName],
    T0.[DocNum], T0.[DocDate], T0.[DocDueDate], T0.[DocTotal],T0.[Max1099]'Total Before Discount',
    T0.[TotalExpns],T4.[descript]'Territory',T2.[SlpName]'Employee Name',T0.[discsum]
    FROM DBO.ORDR T0
    INNER JOIN DBO.RDR1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN DBO.OSLP T2 ON T0.SlpCode = T2.SlpCode
    INNER JOIN DBO.OCRD T3 ON T0.CardCode = T3.CardCode
    INNER JOIN DBO.OTER T4 ON T3.Territory = T4.territryID
    INNER JOIN DBO.NNM1 T5 ON T0.Series = T5.Series
    where  T0.[CANCELED]='N' and T1.[TargetType] != -1
    Thanks,
    Gordon

  • Converting Relational query to XML

    set serveroutput on
    This is the code of a query to convert a relational query to xml. This code runs fine when I place the where condition at the end. e.g. where h.hospital_id=1. however when i place no such condition it begins returning errors such as
    set serveroutput on
    set long 10000000
    set linesize 50000
    set lines 20000
    set pagesize 0
    set pages 5
    set feedback off
    set head off
    SET TRIMSPOOL ON
    set long 200000000
    set linesize 32000
    set pagesize 0
    set pages 0
    set feedback off
    set head off
    Select XMLELEMENT("have:HospitalStatus",XMLAttributes('urn:oasis:names:tc:emergency:EDXL:HAVE:1.0 edxl-have_cs01.xsd' AS
                                      "xsi:schemaLocation",
                                              'urn:oasis:names:tc:emergency:EDXL:HAVE:1.0' AS
                                      "xmlns:have",
                                    'http://www.georss.org/georss' AS
                                      "xmlns:n3",
                                    'http://www.opengis.net/gml' AS
                                      "xmlns:gml",
                                    'http://www.w3.org/2001/XMLSchema-instance' AS
                                      "xmlns:xsi",
                                    'urn:oasis:names:tc:ciq:xal:3' AS
                                      "xmlns:xal",
                                    'urn:oasis:names:tc:ciq:xnl:3' AS
                                      "xmlns:xnl",
                                    'urn:oasis:names:tc:ciq:xpil:3' AS
                                      "xmlns:xpil"                                        
         xmlagg(                    
         xmlelement("have:Hospital",
         xmlforest
              (     h.hospital_id,          
                   xmlforest(
                   xmlforest(
                   h.name,               
                   h.info,          
                   h.addresses     ,          
                   h.contact_numbers) as "OrganizationInformation",     
                   xmlforest(
                   h.geo_location) as "OrganizationGeoLocation",
                   h.comments) as "Organization"
                   xmlelement("have:EmergencyDepartmentStatus",
                   (select xmlagg(
                   xmlforest(
                             eds.date_updated,
                   xmlforest(
                             eds.ems_traffic_status,
                             eds.ems_traffic_reason) as "EMSTraffic",          
                   xmlforest(
                             tcl.url,
                             tc.date_updated,
                             tc.code_value,
                             tc.ems_capacity
                        ) as "EMSCapacity",     
                   xmlforest(
                             tcl.url,
                             tc.date_updated,
                             tc.code_value,
                             tc.ems_census) as "EMSCensus",
                             xmlforest(
                             eds.ems_amb_offload_status,
                             eds.ems_amb_offload_min) as "EMSAmbulanceStatus",
                             xmlforest(
                             eds.ems_air_offload_status,
                             eds.ems_air_offload_min )as "EMSAirTransportStatus"
                   from EmergencyDepartmentStatus eds,TriageCode tc,TriageCodeListURN tcl
                   where eds.hospital_id = h.hospital_id and tc.hospital_id = h.hospital_id and tcl.hospital_id = h.hospital_id)),     
                             xmlelement("have:HospitalBedCapacityStatus",
                   (select xmlagg(xmlelement("have:BedCapacity",
                   xmlforest(
                             mb.date_updated,
                             mb.bed_no,
                             mb.bed_type,
                             xmlforest(
                             mb.capacity_status,
                             mb.available_count,
                             mb.baseline_count,
                             mb.additional_24hr,
                             mb.additional_72hr) as "Capacity",
                             mb.comments
                   from MainBeds mb
                   where mb.hospital_id = h.hospital_id and mb.bed_no NOT IN(select mb.bed_no from MainBeds mb, SubBeds sb where mb.bed_no=sb.bed_no )
                   (select xmlagg(xmlelement("have:BedCapacity",
                   xmlforest(
                             mb.date_updated,
                             mb.bed_no ,
                             mb.bed_type,
                             xmlforest(
                             mb.capacity_status
                                                 ) as "Capacity",
                             mb.comments
                                  ),(select xmlagg(
                   xmlforest(
                                  sb.date_updated,
                                  sb.bed_no,
                                  sb.sub_bed_no,
                                  xmlforest(
                                  sb.capacity_status,
                                  sb.available_count,
                                  sb.baseline_count,
                                  sb.additional_24hr,
                                  sb.additional_72hr) as "Capacity",
                                  sb.comments
                                  )from SubBeds sb  where mb.bed_no = sb.bed_no and sb.bed_no=h.hospital_id )
                   from MainBeds mb
                   where mb.hospital_id = h.hospital_id and mb.bed_no in (select unique mb.bed_no from MainBeds md, SubBeds sb where sb.bed_no=mb.bed_no))
                   xmlelement("have:ServiceCoverageStatus",
                   (select xmlagg(
                   xmlforest(
                             scs.date_updated,
                             scs.burn,
                             xmlelement("CardiologySubType",
                                  xmlforest(scs.cardiology_invasive,
                                  scs.cardiology_non_invasssive)) as "CardiologyIndicator",
                             scs.dialysis,
                             scs.emergency_dept,
                             scs.hyperbaric_chamber,
                             scs.infectious_diseases,
                             scs.neonatology,
                             xmlforest(xmlforest(
                                  scs.neurology_invassive,
                                  scs.neurology_non_invasssive) as "NeurologySubType") as "NeurologyIndicator",
                             xmlforest(xmlforest(
                                  scs.obgyn_with_labor,          
                                  scs.obgyn_without_labor) as "OBGYNSubType")as "OBGYNIndicator",
                             scs.opthalmology,
                             scs.orthopedic,
                             scs.pediatrics,
                             xmlforest(
                                  xmlforest(scs.psychiatry_adult_general,
                                  scs.psychiatry_pediatric) as"PsychiatrySubType")as "PsychiatryIndicator",
                             xmlforest(
                                  xmlforest(
                                  sst.date_updated,
                                  sst.general_ward,
                                  sst.adult_general,
                                  sst.pediatrics,
                                  sst.orthopedics,
                                  sst.nuero_surgery,
                                  sst.facial,
                                  sst.cardio_thoracic,
                                  sst.hand,
                                  sst.reimplantation,
                                  sst.spinal,
                                  sst.vascular,
                                  sst.anesthesia) as "SurgerySubTypes") as "SurgeryIndicator",
                             xmlforest(xmlforest(
                             scs.ambulance_services,
                             scs.air_transport_services) as "TransportServicesSubType") as "TransportServicesIndicator",
                             xmlforest(xmlforest(
                             scs.trauma_service,
                             scs.trauma_service_level) as "TraumaCenterServicesSubType")as "TraumaCenterServicesIndicator"
                   from ServiceCoverageStatus scs, SurgerySubTypes sst
                   where scs.hospital_id = h.hospital_id and sst.hospital_id = h.hospital_id)),
                   xmlelement("have:HospitalFacilityStatus",
                   (select xmlagg(     
                   xmlforest(
                             hfs.date_updated,               
                             hfs.hospital_eoc_status,
                             hfs.hospital_eoc_plan,          
                             hfs.clinical_status,
                             xmlforest(
                                  dc.date_updated,
                                  dc.decon_capacity_status,
                                  dc.amb_patients_capacity,
                                  dc.non_amb_patients_capacity) as "DeconCapacity",
                             xmlforest(
                             mc.date_updated,
                             mc.morgue_capacity_status,
                             mc.morgue_capacity_units) as "MorgueCapacity",
                             hfs.facility_status,               
                             hfs.security_status,     
                             xmlforest(
                                  ah.date_update,
                                  ah.admissions,
                                  ah.discharges,
                                  ah.deaths) as "Activity24hr",
                             hfs.comments,
                             hfs.clinical_operations,     
                             hfs.resources_information
                   from HospitalFacilityStatus hfs,Activity24hr ah,MorgueCapacity mc,DeconCapacity dc
                   where hfs.hospital_id = h.hospital_id and ah.hospital_id = h.hospital_id and mc.hospital_id = h.hospital_id
                   and dc.hospital_id = h.hospital_id)),     
                   xmlelement("have:HospitalResourceStatus",
                   (select xmlagg(
                   xmlforest(
                             hr.date_updated,
                             hr.staffing,
                             hr.facility_operations,
                             hr.clinical_operations,     
                             hr.comments
                   from HospitalResourceStatus hr
                   where hr.hospital_id = h.hospital_id)),
              xmlforest(h.last_update_time) as "UpdateTime"
              ))).extract('/*')
    from hospital h;__________________________________________________________________________________________________________
    ERROR:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00225: end-element tag "HOSPITAL_EOC_STATUS" does not match start-element tag "have:HospitalStatus"
    Error at line 1
    ORA-06512: at "SYS.XMLTYPE", line 111
    Edited by: 872489 on 14-Jul-2011 03:59
    Edited by: 872489 on Jul 14, 2011 9:11 AM
    Apologies for lack of formatting earlier

    Please repost this and use the tag with some decent formatting.
    See the FAQ Posting Guidelines on the main page of this XMLDB OTN Forum                                                                                                                                                                                                                                                                                               

  • Warranty related query for sales item

    hi I need a report for checking an sales item is under warranty or not & also I want to know the status of the products which comes under warranty is in open state or closed state Regards, K.Ramasamy

    Hi,
    Try this query:
    SELECT T0.[ItemCode], T0.[ItemName], T1.[TmpltName], T1.[Deleted] FROM OITM T0  inner join OCTT T1 on  T0.[WarrntTmpl]  =  T1.[TmpltName] WHERE T0.[SellItem]  = 'y'
    Thanks.

  • Drag & Relate Query iView Problem

    Hi,
    I just trying the weblog
    1-2-3 Drag&Relate (or D&R for dummies)
    So all the steps mentioned in that i have followed properly but in Content Admin --> unification under Business Objects i do get sales and stores and i define them according to weblog as source and destination but under <b>edit</b> mode Relation Type is <b>Empty</b> which i think should be <b>manual</b> or something and all the other things are same as shown is screen-shot of the weblog and also in the enduser screen i get message
    <b>Query execution failed. Exception message: Error trying to execute a query statement against MetaMatrix: Error trying to establish connection to the EIS : null</b>
    So i have no clue what could be possible problem
    Kindly Help
    Regards,
    Ricky

    Hi,
    Drag&Relate and Related links iviews are 2 different types of iviews.
    1) Drag&Relate iview is part of the unification capability of the portal which can be used to get meaningful data by creating relations between business objects. Check
    http://help.sap.com/saphelp_nw04/helpdata/en/76/c6693e54d6d112e10000000a11405a/frameset.htm
    2) Related links iviews are iviews which are added as links or refernce iviews to existing iviews or pages so that it is easier to find them while navigating in the portal.
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/5f6c3eabbce712e10000000a11405a/frameset.htm
    Cheers!!

  • Sales Order Query Join

    Hi I have a query which returns the sum of linetotals from sales orders related to a specific Business Partner and also related to a specific Item Code.
    The problem which I'm having is that when I am testing the reports I am finding out that some of the amounts are being multiplied for a number of times.
    I think that it is a join problem.
    The query is the below:
    select distinct
              t0.cardcode
    ,          t0.cardname
    ,          sum(t2.linetotal) as 'Total'
    ,          sum(t3.linetotal) as 'GATEWAY - IPLCS'
    ,          sum(t4.linetotal) as 'GATEWAY - IP TERMINATING CHRGS & LINKS'
    ,          sum(t5.linetotal) as 'Dedicated Symmetric International IP Bandwidth'
    ,          sum(t6.linetotal) as 'Dedicated Symmetric International IP Bandwidth Daily'
    ,          sum(t7.linetotal) as 'Shared IP Transit'
    ,          sum(t8.linetotal) as 'Premium IP'
    ,          sum(t9.linetotal) as 'IP Addresses'
    ,          sum(t10.linetotal) as 'DDos Service'
    ,          sum(t11.linetotal) as 'MIX'
    ,          sum(t12.linetotal) as 'PVC'
    ,          sum(t13.linetotal) as 'Short term IP Transit'
    ,          sum(t14.linetotal) as 'Shared Premium IP'
    ,          sum(t15.linetotal) as 'Shared Rack Co-Location - Setup And Installation Charge'
    ,          sum(t16.linetotal) as 'Shared Rack Co-Location'
    ,          sum(t17.linetotal) as 'Remote Hands / Engineering Support'
    ,          sum(t18.linetotal) as 'Rack Co-Location- Setup & Installation Charge'
    ,          sum(t19.linetotal) as 'Rack Co-Location Space'
    ,          sum(t20.linetotal) as 'Power'
    ,          sum(t21.linetotal) as 'Wireless Ip Microwave Link - Single-Homed Setup & Installation Charge'
    ,          sum(t22.linetotal) as 'Wireless Ip Microwave Link - Dual-Homed Setup & Installation Charge'
    ,          sum(t23.linetotal) as 'Wireless Ip Microwave Link - Recurring Charge Including Mca Fees'
    ,          sum(t24.linetotal) as 'Local Connectivity - Vlan'
    ,          sum(t25.linetotal) as 'Local Connectivity - Bandwidth Access Cost (Traffic)'
    ,          sum(t26.linetotal) as 'Local Connectivity - Activation And Installation Charges For Fibre-Based Ethernet Business Plus'
    ,          sum(t27.linetotal) as 'Local Connectivity - Ethernet Over Fibre'
    ,          sum(t28.linetotal) as 'International Private Leased Circuit'
    ,          sum(t29.linetotal) as 'International Private Leased Circuit Setup Fee'
    ,          sum(t30.linetotal) as 'Wireless link operating on the Unlicensed Band - Setup fee'
    ,          sum(t31.linetotal) as 'Wireless link operating on the Unlicensed Band - Recurring Charge'
    ,          sum(t32.linetotal) as 'GIGE LX SFP Module'
    ,          sum(t33.linetotal) as 'PSAX 1000 Fan/Alarm Module'
    ,          sum(t34.linetotal) as '-48 VDC PS PSAX 2300 4500'
    ,          sum(t35.linetotal) as 'Stratum/-48VDC PS PSAX 1000'
    ,          sum(t36.linetotal) as 'Alcatel Equipment TNEs FOR INVOICE POSTING ONLY'
    ,          sum(t37.linetotal) as 'Tower Site Works'
    from
              ocrd t0 left outer join ordr t1 on t0.cardcode = t1.cardcode
                        left outer join rdr1 t2 on t2.docentry = t1.docentry
                        left outer join rdr1 t3 on t3.docentry = t1.docentry and t3.itemcode = 'DSC000001'
                        left outer join rdr1 t4 on t4.docentry = t1.docentry and t4.itemcode = 'FLC000001'
                        left outer join rdr1 t5 on t5.docentry = t1.docentry and t5.itemcode = 'RVL000001'
                        left outer join rdr1 t6 on t6.docentry = t1.docentry and t6.itemcode = 'RVL000002'
                        left outer join rdr1 t7 on t7.docentry = t1.docentry and t7.itemcode = 'RVL000003'
                        left outer join rdr1 t8 on t8.docentry = t1.docentry and t8.itemcode = 'RVL000004'
                        left outer join rdr1 t9 on t9.docentry = t1.docentry and t9.itemcode = 'RVL000005'
                        left outer join rdr1 t10 on t10.docentry = t1.docentry and t10.itemcode = 'RVL000006'
                        left outer join rdr1 t11 on t11.docentry = t1.docentry and t11.itemcode = 'RVL000007'
                        left outer join rdr1 t12 on t12.docentry = t1.docentry and t12.itemcode = 'RVL000008'
                        left outer join rdr1 t13 on t13.docentry = t1.docentry and t13.itemcode = 'RVL000009'
                        left outer join rdr1 t14 on t14.docentry = t1.docentry and t14.itemcode = 'RVL0000010'                    
                        left outer join rdr1 t15 on t15.docentry = t1.docentry and t15.itemcode = 'RVM000001'
                        left outer join rdr1 t16 on t16.docentry = t1.docentry and t16.itemcode = 'RVM000002'
                        left outer join rdr1 t17 on t17.docentry = t1.docentry and t17.itemcode = 'RVM000003'
                        left outer join rdr1 t18 on t18.docentry = t1.docentry and t18.itemcode = 'RVM000004'
                        left outer join rdr1 t19 on t19.docentry = t1.docentry and t19.itemcode = 'RVM000005'
                        left outer join rdr1 t20 on t20.docentry = t1.docentry and t20.itemcode = 'RVM000006'
                        left outer join rdr1 t21 on t21.docentry = t1.docentry and t21.itemcode = 'RVN000001'
                        left outer join rdr1 t22 on t22.docentry = t1.docentry and t22.itemcode = 'RVN000002'
                        left outer join rdr1 t23 on t23.docentry = t1.docentry and t23.itemcode = 'RVN000003'
                        left outer join rdr1 t24 on t24.docentry = t1.docentry and t24.itemcode = 'RVN000004'
                        left outer join rdr1 t25 on t25.docentry = t1.docentry and t25.itemcode = 'RVN000005'                    
                        left outer join rdr1 t26 on t26.docentry = t1.docentry and t26.itemcode = 'RVN000006'
                        left outer join rdr1 t27 on t27.docentry = t1.docentry and t27.itemcode = 'RVN000007'
                        left outer join rdr1 t28 on t28.docentry = t1.docentry and t28.itemcode = 'RVN000008'
                        left outer join rdr1 t29 on t29.docentry = t1.docentry and t29.itemcode = 'RVN000009'
                        left outer join rdr1 t30 on t30.docentry = t1.docentry and t30.itemcode = 'RVN0000010'
                        left outer join rdr1 t31 on t31.docentry = t1.docentry and t31.itemcode = 'RVN0000011'
                        left outer join rdr1 t32 on t32.docentry = t1.docentry and t32.itemcode = 'TNE000001'
                        left outer join rdr1 t33 on t33.docentry = t1.docentry and t33.itemcode = 'TNE000002'
                        left outer join rdr1 t34 on t34.docentry = t1.docentry and t34.itemcode = 'TNE000003'
                        left outer join rdr1 t35 on t35.docentry = t1.docentry and t35.itemcode = 'TNE000004'
                        left outer join rdr1 t36 on t36.docentry = t1.docentry and t36.itemcode = 'TNE000005'
                        left outer join rdr1 t37 on t37.docentry = t1.docentry and t37.itemcode = 'TNE000006'
    where
              t0.groupcode in (100,114)
    group by
              t0.cardcode
    ,          t0.cardname
    Can you help please?
    Thanks,
    vankri
    Edited by: vankri on Nov 10, 2009 1:02 PM

    Try something like this with all your required items:
    Select  t0.cardcode , t0.cardname , sum(t2.linetotal) as 'Total'
      ,(select sum(r.linetotal) from rdr1 r join ordr o on r.docentry=o.docentry
              where o.cardcode=t0.Cardcode and r.ItemCode= u2019DSC000001')
                        as 'GATEWAY - IPLCS'
      ,(select sum(r.linetotal) from rdr1 r join ordr o on r.docentry=o.docentry
              where o.cardcode=t0.Cardcode and r.ItemCode= u2019FLC000001u2019)
                        as 'GATEWAY - IP TERMINATING CHRGS & LINKS'
    From ocrd t0 left outer join ordr t1 on t0.cardcode = t1.cardcode
                      left outer join rdr1 t2 on t2.docentry = t1.docentry
    group by t0.cardcode ,t0.cardname

Maybe you are looking for

  • How Can I Send an innovative idea to apple ?

    How Can I Send an innovative idea to apple ? 

  • New Wireless MAC keyboard & mighty mouse very slow in retrieving information & sending

    Good evening, I just purchased these items last night from the Apple store, they are both installed on my bluetooth. I do have OS Lion. Whenever I want to go to another site for example this site it spins and spins and takes approx 1 min which feels

  • Usage of Bapi_Transaction_Commit?

    Sorry for not noticing that it is an ABAP Programming forum. Hi, How can I use Bapi_Transaction_Commit in conjunction with a standard BAPI_A( for e.g) in webdynpros? wdContext.currentBAPI_AElement.modelobject.execute(); The above source code would im

  • Oracle BI Apps questions, kindly help

    Hi All, I wanted to checkout the preconfigured reports that come with Oracle BI applications, for this i had download and installed OBIEE 10.1.3.4.1 ORacle BI Applications 7.9.5 Informatica PowerCenter 8.6.0 Oracle EBS R12, Question 1) I see that the

  • Not Taking screen shots

    Hi, i have a mac mini, and a third party keyboard. whenever i try to take a screenshot, nothing happens. the keyboard is connected to a hub. does anyone know what to do? i have tried to connect it directly to the mac, but it doesn't help.