Simple Query for BPV is required.

I am very much new in Oracle EBS. I am needed of a simple query to develop Bank Payment Voucher report with fields mainly:
Header
Bank Payment Voucher No, Bank Name, Supplier Name, Supplier Site, Voucher Created By, Voucher Posted BY etc
Detail
account Code, Title , Description, Debit, Credit
This will help me to take start and explore further.
Thanx in advance.

Hi
You are using getdate() that means it is taking system date of today
Try this  :
SELECT T0.DocEntry, T0.Dscription, T0.Quantity, T0.ShipDate FROM DLN1 T0 Where
DateDiff(DD,T0.ShipDate,GetDate()) <= 1
ORDER BY T0.DocEntry
I haven't tested the query but should work .
Thank you
Bishal

Similar Messages

  • Two or more productid will be accquired by same customerid, by same shipvia, on the same day of the week of shipped date. i want the simple query for this.

    consider this situation,
     Two or more productid will be accquired by same customerid, by same shipvia, on the same  day of the week of shipped date. i want the simple query for this.
    my tables are  from northwind:
    [orders] = OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry.
    [orders details] = OrderID, ProductID, UnitPrice, Quantity, Discount.
    i tried some but it is not exact, it gives wrong result.
    select pd.CustomerID,pd.ProductID, pd.no_of_time_purchased, sd.ShipVia, sd.same_ship_count, shipped_day from
    select ProductID,o.CustomerID,COUNT(productid) as no_of_time_purchased
    from orders o join [Order Details] od on o.OrderID=od.OrderID group by ProductID,o.CustomerID
    having count(od.ProductID) >1) pd
    join
    (select OrderID,customerid, shipvia, count(shipvia)as same_ship_count, DATENAME(DW,ShippedDate)as shipped_day from orders
    group by customerid, ShipVia, ShippedDate having COUNT(ShipVia) > 1 ) sd
    on sd.CustomerID=pd.CustomerID

    Hi,
    I think I have a solution that will at least give you a clue how to go about it. I have simplified the tables you mentioned and created them as temporary tables on my side, with some fake data to test with. I have incldued the generation of these temporary
    tables for your review.
    In my example I have included:
    1. A customer which has purchased the same product on the same day, using the same ship 3 times,
    2. Another example the same as the first but the third purchase was on a different day
    3. Another example the same as the first but the third purchase was a different product
    4. Another example the same as the first but the third purchase was using a different "ShipVia".
    You should be able to see that by grouping on all of the columns that you wich to return, you should not need to perform any subselects.
    Please let me know if I have missed any requirements.
    Hope this helps:
    CREATE TABLE #ORDERS
     OrderID INT,
     CustomerID INT,
     OrderDate DATETIME,
     ShipVia VARCHAR(5)
    CREATE TABLE #ORDERS_DETAILS
     OrderID INT,
     ProductID INT,
    INSERT INTO #ORDERS
    VALUES
    (1, 1, GETDATE(), 'ABC'),
    (2, 1, GETDATE(), 'ABC'),
    (3, 1, GETDATE(), 'ABC'),
    (4, 2, GETDATE() - 4, 'DEF'),
    (5, 2, GETDATE() - 4, 'DEF'),
    (6, 2, GETDATE() - 5, 'DEF'),
    (7, 3, GETDATE() - 10, 'GHI'),
    (8, 3, GETDATE() - 10, 'GHI'),
    (9, 3, GETDATE() - 10, 'GHI'),
    (10, 4, GETDATE() - 10, 'JKL'),
    (11, 4, GETDATE() - 10, 'JKL'),
    (12, 4, GETDATE() - 10, 'MNO')
    INSERT INTO #ORDERS_DETAILS
    VALUES
    (1, 1),
    (2, 1),
    (3, 1),
    (4, 2),
    (5, 2),
    (6, 2),
    (7, 3),
    (8, 3),
    (9, 4),
    (10, 5),
    (11, 5),
    (12, 5)
    SELECT * FROM #ORDERS
    SELECT * FROM #ORDERS_DETAILS
    SELECT
     O.CustomerID,
     OD.ProductID,
     O.ShipVia,
     COUNT(O.ShipVia),
     DATENAME(DW, O.OrderDate) AS [Shipped Day]
    FROM #ORDERS O
    JOIN #ORDERS_DETAILS OD ON O.orderID = OD.OrderID
    GROUP BY OD.ProductID, O.CustomerID, O.ShipVia, DATENAME(DW, O.OrderDate) HAVING COUNT(OD.ProductID) > 1
    DROP TABLE #ORDERS
    DROP TABLE #ORDERS_DETAILS

  • How to write selection Query for the following requirment.

    Hi All,
    I am new to ABAP, I need a help ,
    I need to select all plants(WERKS) from MARC at Plant/Material level,
    then I need to take all sales organozation(VKORG) from T001w,
    then I need the company code(BUKRS) from TVKO based on VKORG,
    then I need the currency key(WAERS) from T001 based on BUKRS,
    Can any one help me in writing selection Query for the same?
    Thanks All,
    Debrup.

    Hi,
    Its easy for you if you learn SELECT with JOIN to complete your task. So SEARCH the forum with SELECT statement and you will get a lot of examples using which you can write your own.
    If you struck up anywhere revert back.
    Regards
    Karthik D

  • A simple query for an Account object *SOLUTION INSIDE*

    I've been trying to do a query to the Account object in CRM for release 16.
    This is the result after i run my app:
    Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Server
    at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:171)
    at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:102)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:240)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:210)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:103)
    at $Proxy30.accountQueryPage(Unknown Source)
    at integra.universal.accountWS.AccountWS.<init>(AccountWS.java:145)
    at integra.universal.accountWS.AccountWS.main(AccountWS.java:162)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 10 seconds)
    My code is :
    crmondemand.xml.account.query.AccountQuery queryCuenta = new AccountQuery();
    //Definimos el query a traves de QueryType
    * Cada clase tiene su propia definicion de QueryType
    * por lo que hay que ir a la direccion crmondemand.xml.<i>tipo</i>.query.QueryType
    crmondemand.xml.account.query.QueryType qt = new QueryType();
    //Definimos el valor del query
    qt.setValue("LIKE 'Ivan*'");
    //Llamamos los parametros de cada query para definir los campos de busqueda
    queryCuenta.setAccountName(qt);
    * queryCuenta.setAccountType(qt);
    * queryCuenta.setCreatedBy(qt2);
    * etc etc
    //agregamos a ListOfAccountQuery los parametros de busqueda
    crmondemand.xml.account.query.ListOfAccountQuery laqlaq = new ListOfAccountQuery();
    laqlaq.setAccount(queryCuenta);
    laqlaq.setPagesize(new BigInteger("20"));
    AccountQueryPageInput aqpi = new AccountQueryPageInput();
    * Generamos los objetos que reciben el parametro de busqueda y que regresan el resultado.
    URL wsURL, wsURL2 = null;
    //I can create the connection np.
    Conexion conecta = new Conexion();
    String jSessionId = conecta.conectaSiebel();
    String wsLocation = "https://secure-ausomxcia.crmondemand.com/Services/Integration";
    try {
    wsURL = new URL(wsLocation + ";jsessionid=" + jSessionId);
    wsURL2 = new URL(wsURL, "file:/C:/Some/Dir/Account.wsdl");
    } catch (MalformedURLException ex) {
    Logger.getLogger(AccountWS.class.getName()).log(Level.SEVERE, null, ex);
    Account_Service as = new Account_Service(wsURL2, new QName("urn:crmondemand/ws/ecbs/account/10/2004", "Account"));
    Account cuenta = as.getAccount();
    AccountQueryPageOutput aqpo = new AccountQueryPageOutput();
    //Agregamos al query la lista de propiedades a buscarse.
    aqpi.setViewMode("Manager");
    aqpi.setListOfAccount(laqlaq);
    aqpi.setBookId("");
    aqpi.setBookName("");
    aqpi.setLOVLanguageMode("");
    //Obtenemos el resultado en un objeto de tipo AccounQueryPageOutput
    aqpo = cuenta.accountQueryPage(aqpi); //The execution stops on this line.
    //Wrapper de una lista de AccountData objects
    // crmondemand.xml.account.data.ListOfAccountData lad = aqpo.getListOfAccount();
    //Estructura de datos que contiene cada AccountData object
    // List<AccountData> listaDeResultados = lad.getAccount();
    //Aqui recorremos la lista de objetos de tipo AccountData
    // for (AccountData accountData : listaDeResultados) {
    // accountData.getAccountName(); //Devuelven Strings y tipos basicos.
    Any suggestions really appreciated : )
    Edited by: user10957396 on Apr 28, 2009 1:01 PM
    Edited by: user10957396 on May 25, 2009 8:55 AM

    Thanxs for your reply Venky. You was right, i had to use wsdl instead of wsdl2, but that didn't fix it.
    Since i'm using release 16 i'm kinda lost, even that i think you guys did an amazing job with the new Web Services api(v2.0).
    Correct me if i'm wrong but i should use a code like this:
    endpoint = "https://secure-ausomxdsa.crmondemand.com/Services/Integration" + ";jsessionid=" + jsessionid;
    URL urlAddr = new java.net.URL( endpoint);
    crmondemand.ws.contact.Contact service = new crmondemand.ws.contact.ContactLocator();
    crmondemand.ws.contact.Default_Binding_Contact stub = service.getDefault(urlAddr);
    crmondemand.ws.contact.ContactWS_ContactQueryPage_Input contactlist = new crmondemand.ws.contact.ContactWS_ContactQueryPage_Input();
    crmondemand.ws.contact.ContactWS_ContactQueryPage_Output outlist = new crmondemand.ws.contact.ContactWS_ContactQueryPage_Output();
    crmondemand.xml.contact.Contact[] contacts = new crmondemand.xml.contact.Contact[1];
    crmondemand.xml.contact.Contact contact = new crmondemand.xml.contact.Contact();
    crmondemand.xml.contact.Activity[] activities = new crmondemand.xml.contact.Activity[1];
    crmondemand.xml.contact.Activity activity = new crmondemand.xml.contact.Activity();
    activity.setSubject("");
    activity.setType("");
    activity.setRowStatusOld("");
    activities[0] = activity;
    contact.setContactLastName("='Wallmueller'");
    contact.setContactFirstName("");
    contact.setContactId("");
    contact.setListOfActivity(activities);
    contacts[0] = contact;
    contactlist.setPageSize("10");
    contactlist.setUseChildAnd("false");
    contactlist.setStartRowNum("0");
    contactlist.setListOfContact(contacts);
    outlist = stub.contactQueryPage(contactlist);
    crmondemand.xml.contact.Contact[] results =
    new crmondemand.xml.contact.Contact[1];
    results = outlist.getListOfContact();
    crmondemand.xml.contact.Activity[] activitiesout =
    new crmondemand.xml.contact.Activity[1];
    int lenC = results.length;
    if (lenC > 0) {
    for (int i = 0; i < lenC; i++) {
    System.out.println(results.getContactFirstName());
    System.out.println(results[i].getContactLastName());
    System.out.println(results[i].getContactId());
    int lenA = results[i].getListOfActivity().length;
    if (lenA > 0) {
    for (int j = 0; j < lenA; j++) {
    activitiesout = results[i].getListOfActivity();
    System.out.println(" " + activitiesout[j].getSubject() + ", " + activitiesout[j].getType());
    that i found here [http://www.webbasedcrmsoftware.com.au/crm-on-demand-tutorials/65-java-access-to-crm-on-demand|http://www.webbasedcrmsoftware.com.au/crm-on-demand-tutorials/65-java-access-to-crm-on-demand]
    for the release 15. Wich is almost the same code i'm using for the new release besides lists(that now are actually lists) and i think i don't need to use any bindings.
    In particular for Account i found that only the name is a required field, so i'm just using that field for the query.
    Thanks in advance.

  • Shall u please build a query for the below requirement

    Existing:
    policy  endmt     type         CR      CCR
    101      0         CEED          10      4       
    101      1         CEED           2       6        
    101      2         NONCEED     1      14        
    101      3         CEED          11      3        
    101      4         CEED           6       1
    101      5         NONCEED     7       2
    101      6         NONCEED    10      3
    101      7         CEED           9       4Required Output:
    policy  endmt     type         CR      CCR  OUTPUT
    101      0         CEED          10      4         10
    101      1         CEED           2       6          6
    101      2         NONCEED     1      14         -2
    101      3         CEED          11      3          11
    101      4         CEED           6       1           1
    101      5         NONCEED     7       2          -6
    101      7         CEED           9       4           9Explanation:
    CASE1:For a policy if starting endorsement is 'CEED' then 'CR' Value should consider.
    CASE2:IF for the policy previous endorsement is 'CEED' and curent endorsement is 'CEED' then 'CCR' value
    CASE3: :IF for the policy previous endordement is 'CEED' and curent endorment is 'NONCEED' then
    Previous endorsement 'CR' *-1  value.
    CASE4::IF for the policy previous endordement is 'NONCEED' and curent endorment is 'NONCEED' then
    eliminate the current endorsement row
    CASE5:IF for the policy previous endorsement is 'NONCEED' and curent endorsement is 'CEED' then 'CR'
    Shall u please help in resolving it?
    Thanks
    Edited by: BluShadow on 15-Oct-2012 14:21
    added {noformat}{noformat} tags to help readability (though there's no helping poorly pasted data).  Please read {message:id=9360002} and learn to paste your code/data correctly.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    886380 wrote:
    Thanks ,but
    endorsement number may not be in sequence ,same endorsement number can repeat for a policy.
    Then that scenario it wont work.On what basis you will ORDE, if you have same endorsement number ?
    Something like this can be done (If you can find out some unique combination to ORDER. Here I am using "order by policy,endmt,type"
    SQL> WITH t AS
      2  (SELECT 101 policy, 0 endmt, 'CEED' type, 10 cr, 4 ccr FROM dual UNION
      3   SELECT 101 policy, 1 endmt, 'CEED' type, 2 cr, 6 ccr FROM dual UNION
      4   SELECT 101 policy, 2 endmt, 'NONCEED' type, 1 cr, 14 ccr FROM dual UNION
      5   SELECT 101 policy, 3 endmt, 'CEED' type, 11 cr, 3 ccr FROM dual UNION
      6   SELECT 101 policy, 4 endmt, 'CEED' type, 6 cr, 1 ccr FROM dual UNION
      7   SELECT 101 policy, 4 endmt, 'NONCEED' type, 7 cr, 2 ccr FROM dual UNION
      8   SELECT 101 policy, 6 endmt, 'NONCEED' type, 10 cr, 3 ccr FROM dual UNION
      9   SELECT 101 policy, 7 endmt, 'CEED' type, 9 cr, 4 ccr FROM dual)
    10  SELECT   t1.policy,
    11           t1.endmt,
    12           t1.cr,
    13           t1.ccr,
    14           CASE
    15           WHEN t1.type = 'CEED' THEN
    16             CASE
    17             WHEN t2.type = 'CEED' THEN t1.ccr
    18             ELSE t1.cr
    19             END
    20           WHEN t1.type = 'NONCEED' THEN
    21             CASE
    22             WHEN t2.type = 'CEED' THEN -t2.cr
    23             ELSE NULL
    24             END
    25           END output
    26  FROM     (select t.*,rownum rn
    27       from (select * from t order by   policy,endmt,type) t
    28           )
    29           t1 LEFT OUTER JOIN
    30     (select t.*,rownum rn
    31       from (select * from t order by   policy,endmt,type) t
    32           ) t2
    33           ON (t1.policy = t2.policy
    34               AND t1.rn -1 = t2.rn)
    35  WHERE   (t1.type = 'CEED'
    36  OR      (t1.type = 'NONCEED'
    37  AND      t2.type = 'CEED'))
    38  ORDER BY t1.policy,
    39           t1.endmt,t1.type;
        POLICY      ENDMT         CR        CCR     OUTPUT
           101          0         10          4         10
           101          1          2          6          6
           101          2          1         14         -2
           101          3         11          3         11
           101          4          6          1          1
           101          4          7          2         -6
           101          7          9          4          9
    7 rows selected.Edited by: jeneesh on Oct 17, 2012 12:10 PM

  • Query for Opening Stock + Purchase Qty + Sales Qty

    Hi ,
    Can anyboday help me by how to develop a query for the following requirement. If any custom query is available please provide me .We are working on SBO 2007B PL 8. The required report structure is 
        ItemNo ***OpeningStock**** Purchase ********* Sales****
    (Batchwise)** Qty*** Value ****Qty** Value ***Qty***Value
    Thanks & Regards
    Srini

    Hi Srini,
    I found this on the forum, see if it helps you;
    select b.Itemcode,b.Item_Description,b.UOM, b.rate as Rate,b.Opening_Stock,b.Receipt,b.Issue, b.Material_Revalue,b.Closing_Stock,b.Closing_Value from (select *,(case closing_stock when 0 then 0 else(Closing_Value/Closing_Stock)end) as Rate from( SELECT T0.Itemcode as 'Itemcode' ,min(T0.Dscription) as 'Item_Description', max(T1.InvntryUom) as UOM, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<'[%0]' and O1.transtype in (58,59,20,16,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<'[%0]' and O1.transtype in (58,21,19,60,15,67,-2,13)),0)+ (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.transtype in (-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.transtype in (-2)),0)))as Opening_Stock, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (20,18)),0) + isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (67)),0) + isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (58,59,16,14)),0)) as Receipt, (isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (13,15)),0) + isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (67)),0)+ isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (58,60,21,19)),0)) as Issue, isnull((select sum(Transvalue) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (162)),0) as Material_Revalue, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,59,20,16,14,19,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,21,19,60,15,67,-2,13)),0))as Closing_Stock, isnull((select sum(Transvalue) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,18,-2,67,59,20,16,14,15,13,21,19,60,69,162)),0) as Closing_Value FROM OINM T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode INNER JOIN OITB B1 ON T1.ItmsGrpCod=B1.ItmsGrpCod where ((B1.ItmsGrpNam>='[%2]' and B1.ItmsGrpNam<='[%3]') or ('[%2]'='' and '[%3]'='')) GROUP BY T1.itemcode,T0.Itemcode )a Where (a.Opening_Stock + a.Receipt + a.Issue + a.Material_Revalue + a.Closing_Stock + a.Closing_Value) <> 0 )b 
    Thanks,
    Joseph

  • Query  for  Closing Stock goes beyond a particular value.

    Hi,
    The query for the following requirement:
    The Closing Stock goes beyond a particular value. The Closing Value of items crosses the pre-defined value.

    Hi,
    Yes it is related to the user selected date and stock level. Not answered Closing the thread.
    Edited by: Neela M B on Aug 28, 2010 3:08 PM

  • How to write sql query for below example.

    Hi,
    I have requirement.
    There are number of rows and I need the result through query as follows.Please help me to proved sql query for below mentioned requirement.
    example: table TEST.
    COLA COLB COLC COLD
    MANAGER 5 NULL null
    SR.MANAGE 6 3 NULL
    VP 5 5 4
    I have to write the sql query if COLA IS MANAGER THEN CONSIDER MANGER RECORD,AND IF ANY COLUMN FILED IS NULL FOR MANGER THEN CONSIDER COLA IS SR.MANGER, AND IF ANY COLUMN FILED IS NULL FOR SR,MANGER THEN CONSIDER VP records.
    I need output as below.
    COLB COLC COLD
    5(MANGER) 3(sr.manger) 5(vp)
    Please provide the for above mentioned output.
    Thanks

    <<if COLA IS MANAGER THEN CONSIDER MANGER RECORD>>
    What does this sentence means? COLA does not cnatin a single record but the number of records with diffrent values.
    Regards
    Arun

  • How to write sql query for below mentioned eaxmple.

    Hi,
    I have requirement.
    There are number of rows and I need the result through query as follows.Please help me to proved sql query for below mentioned requirement.
    example: table TEST.
    COLA COLB COLC COLD COLE COLF MANAGER 5 NULL NULL 3 NULL
    SR.MANAGER 6 3 NULL NULL NULL
    VP 5 5 4 5 5
    I have to write the sql query if COLA IS MANAGER THEN CONSIDER MANGER RECORD,AND IF ANY COLUMN FILED IS NULL FOR MANGER THEN CONSIDER COLA IS SR.MANGER, AND IF ANY COLUMN FILED IS NULL FOR SR,MANGER THEN CONSIDER VP records.
    I need output as below.
    COLB COLC COLD COLE COLF
    5(manager) 3(sr.manger) 4(vp) 3(manger) 3(vp)
    Please provide the for above mentioned output.
    Thanks

    Duplicate thread. please view the answer posted in your first thread.
    how to write sql query.
    And, please don't post any duplicate thread.
    Regards.
    Satyaki De.

  • QUERY FOR GOODS RETURN -- GRPO -- PO HISTORY

    HI Folks
    I need to write a query for the following requirement.
    Goods Return
    It's Base GRPO (no & date)
    and it's PO (date & no)
    The above fields should be in the same query.
    Can anyone help me on this please.
    regards
    karthik

    Hi
    Select  T0.Project AS 'Job Number', T0.DocDate as [Date of Goods Return],T0.DocNum As [Good Return Number],T2.DocNum as [GRPO Number],
    T2.DocDate as [GRPO Date],T4.DocNum as [PO Number],T4.DocDate as [PO Date],T0.CardName as 'Vendor Name',SUM(t1.linetotal) as ' Basic'  
    FROM ORPD T0
              Inner Join RPD1 T1 on T0.DocEntry=T1.DocEntry
              Inner Join OPDN T2 on T1.BaseEntry=T2.DocEntry and T1.BaseType='20'
              Inner Join PDN1 T3 on T2.DocEntry=T3.DocEntry
              Inner Join OPOR T4 on T4.DocEntry = T3.BaseEntry and T3.BaseType ='22'
    GROUP BY T0.Project , T0.DocDate,T0.DocNum,T2.DocNum,
    T2.DocDate ,T4.DocNum ,T4.DocDate ,T0.CardName
    *When i run this query the BASIC amt is calculated by Multiplying basic * no of line items. Can anybody guide me where changes has to be made. And also i am going to add Freight,Excise,CST & VAT at document level in thus query.*
    regARDS
    KARTHIK

  • Printing simple query

    Hello.
    I want to create a button that send to the printer a simple query, for example...
    select text from orders
    where order_id = '735'
    My problem is that if I create a page to show this query, and try to print it through the browser "File / Print" command, other elements of the page are printed also.

    Hi Earl & everybody:
    I was trying to print without loss the format of the
    query result, which fit in the boxes in a pre printed
    paper.Have you created a form layout that matches your preprinted paper layout then?
    When I load the query in the sql query in the form
    region, the only way I can show the text in the right
    position,
    (' < here there are spaces > Sunday, October 15'
    ' < here there are spaces > Item < here there are
    spaces > Description < here there are spaces >
    Price')
    is modifying the query as
    SELECT '<PRE>' || ORDER_ROW || '</PRE>' RG
    FROM ORDERS
    which shows the right text position in the monospace
    font desired.I'm not sure why you're talking about modifying your SQL when you're having a page layout problem?
    But, an extra horizontal line is added between rows.
    the query result in sqlplus don't have the extra
    lines, and if I don't use the '<PRE>' and '</PRE>'
    tags in the query neither have the lines.
    I'm using a customized page POPUP pattern, with a css
    file, because the default patterns don´t displayed
    the monospace font.I think you need to put an example up on apex.oracle.com so we can see what you're doing.
    Earl

  • Query needed for the below requirement

    Hi,
    I have three tables structures like below.
    tableA - LINE_ID, VENDOR_ID,DEAL_SITE_ID
    tableB - LINE_ID, DEAL_SITE_ID
    tableC - DEAL_ID,VERSION, DEAL_SITE_ID
    Now the requirement is I have to fetch all distinct VENDOR_ID from tableA with some given DEAL_ID (100001) and VERSION (1), only Problem is in tableA the rows which have LINE_ID will not have DEAL_SITE_ID and vice versa. I've used the below query for this purpose but wanted to know if there is any better solution.
    select distinct VENDOR_ID from tableA where deal_site_id in
    (select deal_site_id from tableC where deal_id = 100001 and snapshot_ver = 1)
    UNION
    select distinct VENDOR_ID from tableA where line_id in
    (select line_id from tableB where deal_site_id in
    (select deal_site_id from tableC where deal_id = 100001 and snapshot_ver = 1))
    Regards,
    Subhadeep
    Edited by: sumajumd on Jul 17, 2012 2:33 AM

    Try regular joins (assuming column version should be snapshot_ver).
    Like this (untested):
    select tablea.vendor_id
    from   tablea
      inner join tablec on (tablea.deal_site_id = tablec.deal_site_id)
    where  tablec.deal_id      = 100001
    and    tablec.snapshot_ver = 1
    union
    select tablea.vendor_id
    from   tablea
      inner join tableb on (tableb.line_id      = tablea.line_id)
      inner join tablec on (tableb.deal_site_id = tablec.deal_site_id)
    where  tablec.deal_id      = 100001
    and    tablec.snapshot_ver = 1

  • Query for calculating raw material requirements for the remaining quantities in sale order.

    Dear SAP Experts,
    Clients requirement :
                                         Client wish to know the quantities of raw materials needs to run the production order inorder to complete the remaining quantities in sale order.
    Need Clarification:
                                  I"m using the below query for this requirement. I wish to know whether this query suits for my clients requirement or not. If its so, I need to know how to group by T4.[Code] (Raw material Name)   and need to get the sum of    T4.[Quantity]  (BOM quantity)      and  (T1.[OpenQty]*T4.[Quantity]) as TOTALQTY under each raw material group
    SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode],T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity] as salesorderQty , T1.[OpenQty], T2.onhand, T4.[Code] as Raw material Name,T4.[Quantity] as BOMQTY,  (T1.[OpenQty]*T4.[Quantity]) as TOTALQTY FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode] INNER JOIN OITT T3 ON T2.[ItemCode] = T3.[Code] INNER JOIN ITT1 T4 ON T3.[Code] = T4.[Father] WHERE  T0.[DocStatus] ='o' 

    You're posting in the Portuguese B1 space.
    You might want to post in the English one: SAP Business One Application

  • A simple query in My SQL what is the similer query for that in Oracle ???

    hello friends
    In My Sql if i have 1000 records in a table and i want to get the records from 400 to 550 then it is posible by giving the following query
    Select * from Table a , table b where condition "List 400,550" gives the records from 400 to 550
    what is the coresponding query for this in oracle database
    any one help me pls
    mail me to [email protected]

    Genericly, if you want records N through M from a SELECT statement, there's a wonderful article on asktom.oracle.com
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:127412348064
    Justin

  • Best design for Boolean function from simple query

    Hello,
    what is the most efficient, shorter, readable, simple way to make a boolean function that simply return true or false from a simple query that return 0 or 1 to n records?
    Is this solution using a cursor's the best (working...):
       FUNCTION is_date_present (p_date IN DATE)
          RETURN BOOLEAN
       IS
          CURSOR chk_cursor
          IS
             SELECT COUNT (*)
               FROM target_dates
              WHERE target_date = p_date;
          nb   NUMBER := 0;
       BEGIN
          OPEN chk_cursor;
          FETCH chk_cursor
           INTO nb;
          CLOSE chk_cursor;
          IF nb >= 1
          THEN
             RETURN TRUE;
          ELSE
             RETURN FALSE;
          END IF;
       END;Performance, clarity and simplicity are important...
    Thanks

    Well, I prefer (not tested):
    FUNCTION is_date_present (p_date IN DATE)
    RETURN BOOLEAN
    IS
    nb NUMBER := 0;
    BEGIN
    SELECT COUNT (*)
    INTO nb
    FROM target_dates
    WHERE target_date = p_date;
    IF nb >= 1 THEN
    RETURN TRUE;
    LSE
    RETURN FALSE;
    IF;
    END;Regards,
    MiguelWhy count multiple records when you only care if you get at least 1 occurrence? Just wasted cycles.
    FUNCTION is_date_present (p_date IN DATE)
    RETURN BOOLEAN
    IS
    nb NUMBER := 0;
    BEGIN
      SELECT COUNT (*)
      INTO nb
      FROM DUAL
      WHERE EXISTS
          SELECT NULL 
          FROM target_dates
          WHERE target_date = p_date
      IF nb >= 1 THEN
         RETURN TRUE;
      ELSE
         RETURN FALSE;
      END IF;
    END;Or you could just add a ROWNUM = 1 on to yours, either way.

Maybe you are looking for

  • Mail Receiver - Send file in ISO-8859-1 encoding

    Hi, I'm sending mail with an attachment using mail adapter, but instead of specified ISO-8859-1 it is converted to UTF-8 no BOM,. Because of that, some characters (ñ,ç, etc) are not transferred properly. Settings: Message protocol: XIPAYLOAD No mail

  • Error: accessor 'xfa.sourceSet.DataConnection.next()' is unknown.

    Only started using LCD ES a couple of days ago. I was able to connect a form via ODBC/MySQL. It correctly displays the first row. I was trying the following scipt on a "next" button: form1.#subform[0].dbNext::click - (FormCalc, client)xfa.sourceSet.D

  • Need a help..CSS & Jquery

    Hi, I am fairly new on jquery plug in. I create my website and try to have jquery-collapse effect on my left side bar (before green content). I have a sample jquery-plug in code as below, and I was trying to plug this code into my page many times, bu

  • AirPort Extreme & USB Telstra Dongle

    Need some help....I have an AirPort Extreme and now have a Telstra USB Dongle (?) that I plug directly into my Mac BookPro to connect to the net. Can I use this in the AirPort Extreme to set up wireless in my house? I have brought a MiniMac to connec

  • What is it with these Apple Curser Ads?

    These advertisements just started popping up this morning, 4/18/10 on my computer. They are tied to the curser someway. They block what I am trying to read and I find them very irritating!! Anyone know how to turn them OFF??? Jack Perry