Purchse order Query

SELECT T0.[DocNum], T1.[DocNum], T2.[BaseRef] FROM ORDR T0 , OPOR T1 INNER JOIN POR1 T2 ON T1.DocEntry = T2.DocEntry WHERE T2.BaseRef=T0.DocNum
i have problem in this query it is showing that sale order who purchase order is posted but my client want all sale order number if any purcahse order is posted then it will show number against that sale order otherwise show blank or some text
i think their is problem in this part "WHERE T2.BaseRef=T0.DocNum "
plz help me

hI ajit
following is the query that would give the purchase order document number whose base document is sales order
SELECT   distinct opor.docnum AS "purchase order doc num" ,ordr.docnum AS" sales order doc num"
FROM         RDR1 INNER JOIN
                      POR1 ON RDR1.DocEntry = POR1.DocEntry INNER JOIN
                      ORDR ON RDR1.DocEntry = ORDR.DocEntry INNER JOIN
                      OPOR ON RDR1.DocEntry = OPOR.DocEntry
where por1.baseentry = rdr1.trgetentry and por1.basetype= '17'
Regards
Manish

Similar Messages

  • 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

  • What is the exact difference between Purchse order and purchase requisition

    Hi all,
    What is the exact difference between Purchse order and purchase requisition.
    Thx

    Hi,
    <b>Purchase Requisition</b>-> Staff in an orgn places Pur requisition for want of some goods/products - ME51
    Related Table EBAN
    Request for Quotation(RFQ)-> The Purchase dept in the orgn calls/requests for the quotation for the products against which PR was raised. - ME41
    Vendor Evaluation->After receving the RFQ's, after comparison a Vendor is finalised based on the terms and conditions.
    <b>Purchase Order(PO)</b>-> Pur order was issued to that vendor asking him to supply the goods/products -ME21N
    Tables:EKKO,EKPO
    Goods Receipt Note(GRN)->Vendor supplies the material/Products to the orgn-
    MB01
    Goods Issue (GI) -> People receives their respective itesm for which they have placed the Requisitions
    Vendor, Material ,Qty are mandatory for PO.
    Regards,
    Padmam.

  • Purchse Order Qty Increase

    Hi
    I am using SAP B1 2007B Version.  I have created  purchase order. in the purchase order e.g Row 1 Item Qty 100 & Row 2 Item Qty-100. We have received row 1 item qty 100 & make the grpo. Now in Purchse order row 1 is closed . I want to amend/ Increase qty 100 to 150 in purchase order row no 1.
    Regards
    Dadrwal

    HI,
    Re: Purchase Order Issue
    Regards
    Mk

  • 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

  • Purchse order price variances

    hi friends
    is there any standard report for purchse order price variances???
    what is the use of MRN0 Report??
    regrds
    raj

    Please check these answered links:
    Re: Purchase Price Variance
    Re: Material Valuation as per Market Price
    Re: STD Price

  • Send Idoc For Purchse Order

    Hi Friends,
    I have Configure All  the things require to send idoc for purchse order..........when i m creating purchase order from source system
    it's getting send to traget system....................
    but in target system giving error in idoc.that
    VKORG, VTWEG, SPART cannot be determined for customer S004 , vendor 0006000023
    i m using message type....ORDERS............
    can antbody pls tell me how to maintain  VKORG, VTWEG, SPART
    in oreders message type.......there no fields in this message type.......i have checked it through se19...............

    Hi ,
    I have same problem ,
    How to send IDOC of Purchase Order to URL of our vendor.
    The Idoc is created , but how to send it to the web?
    Anyone knows?
    Thanks
    Edited by: Moshe Stein on Feb 28, 2008 11:08 AM

  • Purchse order

    Hi Friends,
    Any one have the idia about tax calculation in purchse order
    in script if any one have than plz send me the code or information about if it ll helpfull than points will be awarded.
    Thanks and Regards,
    Devalla Tarun Kumar

    plz dont say konv table is used to tax calculation.
    Than what you want apart from tables?
    Code?
    No i cannot give code specially for tax calculation it might looses our sales confidentiality
    Really Sorry.
    Amit.

  • Purchse Order printing

    what is Tcode for Purchse Order printing?

    You can use RSNAST00 Program to print po ,here you need to pass PO Number,Output type NEU(Stnadard),Application -EF,Medium -1.
    Before this ,just goto ME21N or ME22N ,Click on messages -> further data -> scehdule peridacally.
    Normally we use RSNAST00 for ALE,EDI..
    Thanks
    Seshu

  • Sale Order Query Print layout/Crystal Report Query required

    Hi Experts,
    I created a Sale Order. Items included in it are service and material.
    (I created a BOM, bound the child material item to the parent service item. Moreover child item will have unit price where as parent item will not have unit price)
    I need the report on it please let me know how i can do it.
    I tried with below query
    select a.DocEntry, a.DocNum, a.CardCode, a.CardName, b.DocEntry,b.ItemCode, b.Dscription, b.Quantity, b.Price, b.LineTotal, a.DocTotal, a.VatSum 
    from ORDR a inner join RDR1 b on a.DocEntry = b.DocEntry
    --and b.TreeType <> 'N'
    where a.docnum = '14240621'
    output of above query is
    DocEntry
    DocNum
    CardCode
    CardName
    DocEntry
    ItemCode
    Description
    Qty
    Unit Price
    Line Total
    DocTotal
    Tax Amount
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    302010001
    PROVIDING & LAYING
    17.62
    2493.76
    43940.05
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0001
    Material for PROVIDING & LAYING
    17.62
    2800
    49336
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    305010005
    BM CM INCLUDING CEMENT
    10.055
    1980
    19908.9
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0002
    Material for BM CM  INCLUDING CEMENT
    10.055
    1650
    16590.75
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    302040001
    P/APPLYING
    65
    116.5
    7572.5
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0003
    Material for P/APPLYING
    65
    65
    4225
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    301000001
    P& FIXING
    2.233
    31625.05
    70618.74
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0004
    Material for P& FIXING
    2.233
    44000
    98252
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    306010001
    PROVIDING RMC
    3
    3593
    10779
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0005
    Material for PROVIDING RMC
    3
    4847
    14541
    354652
    18888.46
    and my desired output is
    Unit price of both child item and parent item should be display in single column. ie. cumulative in Unit Price Column and Linetotal respectively.
    DocEntry
    DocNum
    CardCode
    CardName
    DocEntry
    ItemCode
    Description
    Qty
    Unit Price
    Line Total
    DocTotal
    Tax Amount
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    302010001
    PROVIDING & LAYING
    17.62
    5293.76
    93276.05
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    305010005
    BM CM  INCLUDING CEMENT
    10.055
    3630
    36499.65
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    302040001
    P/APPLYING
    65
    181.5
    11797.5
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    301000001
    P& FIXING
    2.233
    75625.05
    168870.7
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    306010001
    PROVIDING RMC
    3
    8440
    25320
    354652
    18888.46
    please let me know the update on this.
    with regards

    Hi Nagarajan,
    thanks for reply..
    1) Yes, i.e i have taken into BomType: Template
    2) i did not get any helpful output by using treetype by keeping 'S' and 'N', i kept in comment.
    3) Actually MT0001-05 - these are material item- unit prices are fixed. see in attached image
         for parent item, unit prices are not fixed. I give the price for them in Sale Order.
         I want unit price for parent and child should be summed/cumulative for Sale Order print.
         (in my above post, first matrix exactly same as sale order line items plz check it)
    Please help me, how i can achieve this by query(for PLd or Crystal report)
    With Regards

  • Order Query in SQ01 using Table Joins in CRM

    Hello Experts,
    I am trying to create a query using table joins in SQ01 in CRM because I need a report that will give me all transactions for a selected Business Partner.  I am unable to display any results when running my query.  I have found other threads which give a list of possible tables to join together, but the fields used in the joins were not described. 
    The tables I have joined in my query are as follows:
    CRMD_ORDERADM_H
    CRMD_ORDER_INDEX
    CRMD_PARTNER
    BUT_000
    I have used SE16 to try to search for additional tables to use for linking the Business Partner with a transaction, but I have been unsuccessful.
    Would anyone please give advice as how to proceed? 
    Reward points are available!
    Thank you in advance,
    David

    David
    The link with be the GUID.
    CRMD_ORDERADM_H = Document Header Table
    CRMD_ORDERADM_I = Document Line item Table
    CRMD_LINK = Lists various ‘link’ GUIDs, to
    access order Information
    The Table CRMD_ORDERADM_H will contain you transactions , once you find the GUID of your sales transaction in the table CRMD_ORDERADM_H.
    You then need to check the table CRMD_LINK.
    In this table you will then find a number in 11 = sales. This refers to the table CRMD_SALES. There are also links to many other tables ie Shipping, pricing, org etc.
    CRMM_BUT_SET0140 - for Sales Group, Sales Office, District
    CRMM_BUT_LNK0141 - for Sales Area data
    Transaction CRMD_BUS2000115 allows you to see all sales transactions for a BP. CRMD_BUS2000126 shows you activities for selected BP.
    Regards
    M

  • Open Orders Query showing all open AP Orders

    Hi All,
    I wish to generate a report that shows all open AP Purchase Orders as well as all orders that are partially inviced.
    I have been using the following query but it is not giving me complete results:
    SELECT
    T1.[DocNum] AS 'PO NUMBER',
    T1.[DocDate] AS 'POSTING DATE',
    T1.[DocDueDate] AS 'DUE DATE',
    T1.[TaxDate] AS 'DOC DATE',
    T1.[Comments] AS 'REMARKS',
    T1.[CardCode] AS 'CUSTOMER/VENDOR CODE',
    T1.[CardName] AS 'CUSTOMER/VENDOR NAME',
    T0.[LineTotal] AS 'LINE TOTAL',
    T0.[OcrCode] AS 'PROFIT CENTER',
    T1.[PaidSum] AS 'PAID',
    T0.[Project] AS 'PROJECT CODE',
    T0.[LineNum] AS 'ROW NUMBER',
    T0.[LineStatus] AS 'LINE STATUS',
    T1.[DocStatus] AS 'PR STATUS'
    FROM
    POR1 T0  INNER JOIN OPOR T1 ON T0.DocEntry = T1.DocEntry
    WHERE
    T1.DOCSTATUS <>'C'
    AND
    T0.LineStatus <> 'C'
    ORDER BY T1.docentry
    I need to add to this query a column to show PO's that have been partially invoiced, a column to show if the invoices have been paid and another column to show the balances for those particular orders.
    HELP PLEASE!
    Robinson

    Thanks Carin,
    That was very helpful, BUT:
    1. I still wish to view all open orders that have been partially invoiced
    2. I still wish to see all the Purchase Orders that have been partially invoiced and paid
    3. I finally want to see the balances for these Purchase Orders that have been partially invoiced.
    I don't seem to find the correct fields containing the information. So far all that I was able to establish is that OPOR.DocTotal is the total amount for the Purchase Order. However, OPOR.PaidToDate does not give an accurate value of what is invoiced or paid.
    I wish to add the following fields. A field showing the corresponding Invoice number for the partially invoiced order, the amount paid for that PO and the balance.
    Thank you.
    Robinson

  • Open Sales Order Query

    Hello Experts,
    I would like to pull all Open Sales Orders that do not have purchase orders and are more than 180 days old.
    I tried the following query but does not seems to work exactly:
    select t0.DocNum
    ,t0.DocDate
    ,DateAdd(Day,180,t0.DocDate) as Due180Days
    , t0.DocDueDate
    , t1.PymntGroup
    , t0.OwnerCode
    , t2.firstName
    , t2.lastName from ordr t0
    inner join OCTG t1 on t0.GroupNum = t1.GroupNum
    inner join OHEM t2 on t0.OwnerCode = t2.empID
    where (t1.PymntGroup like '%prepaid%'
    or t1.PymntGroup like '%deposit%')
    and t0.DocStatus ='O'and t0.PoPrss='N' and DATEADD(Day,180,t0.DocDate)>180
    and t0.OwnerCode=18
    Any hlep would be appreciated.
    Regards,
    Praneeth

    Hello Praneeth,
    You may try this:
    select t0.DocNum,t0.DocDate,DateAdd(Day,180,t0.DocDate) as Due180Days,
    t0.DocDueDate, t1.PymntGroup, t0.OwnerCode, t2.firstName, t2.lastName
    from ordr t0
    inner join OCTG t1 on t0.GroupNum = t1.GroupNum
    inner join OHEM t2 on t0.OwnerCode = t2.empID
    where (t1.PymntGroup like '%prepaid%'
    or t1.PymntGroup like '%deposit%')
    and t0.DocStatus ='O'and t0.PoPrss='N' and DATEDIFF(DD,t0.DocDate,GetDate())>180
    and t0.OwnerCode=18
    What is exactly the issue not seems to work?
    Thanks,
    Gordon

  • Work Order Query

    Hello Experts,
    I have a query for work order.
    1) if parts have been reserved in a work order, what is the method of converting those parts to confirmations?
    2) Is there any report which shows parts that have been reserved on work orders ? Or any way to see this?
    Regards
    Himanshu

    Hi,
    For reservation confirmations got to IW42, it will automatically take movement type 261.
    For reservations, goto IW40 and select layout view, there you will get option for Reservations.
    Hope it is helpful.
    Thanks

  • Problem in Sales Order Query

    Hi All,
    I have problem....This is query which ic combination of Sales Order, Return, Delivery and AR Invoice.....Please tell me why this query is not working ......I want Document No, Quantity, Doc Date from Sales Order, Return, Delivery and AR Invoice and Tax bifergation also.....I per my view this query there should not be any problem but it is not working...please tell me where I am wrong....Just copy and paste this query and check in ur system.......
    SELECT b.Doc_Num1 as 'SO. No.',
    b.DocDate    as      'SO. Date',
    b.Doc_Num2   AS      'Del.Doc.No.',
    b.DocDate    AS      'Delivery Date',
    b.Doc_Num3   as      'A/R Invoice No.',
    b.DocDate    as      'Inv. Date',
    b.Doc_Num4   AS      'RETURN Doc.No.',
    b.DocDate    as      'Ret.Date',
    b.CardName   as      'Vendor Name',
    b.NumAtCard  as      'Bill No. & Date',
    b.ItemCode   as      'Item Code',
    b.Dscription as      'Dscription',
    b.Quantity1  as      'AR Invoice Quantity',
    b.Quantity2  as      'Sales Order Quantity',
    b.Quantity3  as      'Delivery Quantity',
    b.Quantity4  as      'Return Quantity',
    b.LineTotal  as      'Base Amt.(Rs.)',
    b.WTSum           AS      'TDS (Rs.)',
    b.DocTotal    as     'Total (Rs.)',
    sum(b.BED)    as           'Bed Value',
    sum(b.EDCS)   as          'EDCS Value',
    sum(b.HECS)   as          'HECS Value',
    sum(b.VAT)        as           'VAT Value',
    sum(b.CST)        as           'CST Value',
    sum(b.CVD)        as           'CVD Value',
    sum(b.SerTax)  as           'SERTAX Value',
    sum(b.CSonSerTax) as      'CS Value',
    sum(b.HECS_ST)      as      'HESC Value' 
    from (
    select *,( a.Bed + a.EDCS + a.HECS + a.VAT + a.CST +a.CVD + a.SerTax + a.CSonSerTax  + a.HECS_ST ) as Filter from (SELECT distinct
    T0.DocNum,
    T0.DocDate,
    T2.DocNum,
    T2.DocDate,
    M.DocNum,
    M.DocDate,
    M.CardName,
    M.NumAtCard,
    L.ItemCode,
    L.Dscription,
    L.Quantity,
    T1.Quantity,
    T3.Quantity,
    S.DocNum,
    S.DocDate,
    X.Quantity,
    L.LineTotal,
    M.DocEntry,
    M.[DiscSum],
    M.WTSum,
    M.DocTotal,
    M.WTSum,
    M.DocTotal,

    Hi Sonal,
    Try this,
    SELECT  T0.DocNum as 'SO. No.',
    T0.DocDate as 'SO. Date',
    T2.DocNum AS 'Del.Doc.No.',
    T2.DocDate AS 'Delivery Date',
    M.DocNum as 'A/R Invoice No.',
    M.DocDate as 'Inv. Date',
    T4.DocNum AS 'Return No.',
    T4.DocDate AS 'Return Date',
    M.CardName as 'Vendor Name',
    M.NumAtCard as 'Bill No. & Date',
    ISNULL(L.ItemCode,'Service Item') as 'Item Code',
    L.Dscription,
    L.Quantity,
    (Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=10 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
    (Select Sum(LineTotal) From INV3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
    M.WTSum AS 'TDS (Rs.)',
    M.DocTotal as 'Total (Rs.)'
    FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN ODLN T2 ON T2.DocEntry = T1.TrgetEntry
    INNER JOIN DLN1 T3 on T3.DocEntry = T2.Docentry
    INNER JOIN OINV M ON M.DocEntry = T3.TrgetEntry
    LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry
    LEFT JOIN ORDN T4 ON T4.DocEntry = L.TrgetEntry
    LEFT JOIN RDN1 T5 ON T5.DocEntry = T4.DocEntry
    LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry
    WHERE M.DocDate >= '[%0]' AND M.DocDate <= '[%1]'
    GROUP BY
    T0.DocNum,T0.DocDate,T2.DocNum,T2.DocDate, M.DocNum,M.DocDate,T4.DocNum, T4.DocDate, M.CardName,M.NumAtCard,L.ItemCode,L.Dscription,L.Quantity,
    M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    ORDER BY
    T0.DocNum,T0.DocDate,T2.DocNum,T2.DocDate, M.DocNum,M.DocDate,T4.DocNum,T4.DocDate, M.CardName,M.NumAtCard,L.ItemCode,L.Dscription,L.Quantity,
    M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    Regards,
    Madhan.

Maybe you are looking for

  • How to Use the same iview for both KM End User and the KM Administrator

    Hi friends, *This is my scenario :* How to Use the same iview for both KM End User and the KM Administrator but with different Context Menu Options. i followed these steps but im getting same context menu for both KM End User and the KM Administrator

  • How do I run a Java Application on Pocket PC 2003 (iPAQ 2210)

    I am writing an application for the iPAQ 2210. It will need to commuunicate over GPRS sending POST requests to a server (I think I will be using the Java.net package) the user interface will be very simple (a few buttons and text boxes) and will capt

  • Scan to email on Color LaserJet Pro MFP M177fw

    I am trying to download the Printable "Scan to Email" onto my  Color LaserJet Pro MFP M177fw but It keeps throwing an error? When I  bought the printer (yesterday) i was told that I could set it up to Scan in a document and have it automatically send

  • Book - map font keeps resetting

    I have a book that I started in iPhoto '09 and I should have finished it there. Working with fonts has become super annoying. I'm using the Travel theme, and on one of my map pages the fonts won't stay put. I set them the way I need, go to another pa

  • Questions on import/export

    Hello Everybody, I am learing the import/export feature of the portal. I have couple questions 1. Can I import the portal desktop and all the related framework page and theme. Will it be intact after the import? 2.I have a folder in KM with various d