Update purchase register query

Hi All,
I want Updation in Following query, My client want item name and Quantity also in this.
SELECT  M.DocNum AS 'AP Inv. #', M.DocDate as 'Date', M.CardName as 'Vendor Name',M.NumAtCard as 'Vendor Ref',
(Select Sum(LineTotal) FROM PCH1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
(SELECT distinct (TaxRate) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
(SELECT distinct (TaxRate) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'ECess (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
(SELECT distinct (TaxRate) FROM PCH4 where statype=-55 and DocEntry=M.DocEntry) as 'Hcess (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=-55 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
(SELECT distinct (TaxRate) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as 'VAT (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
(SELECT distinct (TaxRate) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as 'CST (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
(SELECT distinct (TaxRate) FROM PCH4 where statype=-40 and DocEntry=M.DocEntry) as 'CVD (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=-40 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
(SELECT distinct (TaxRate) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as 'SERVICE (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
(SELECT distinct (TaxRate) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'Cess_sertax (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
(SELECT distinct (TaxRate) FROM PCH4 where statype=-10 and DocEntry=M.DocEntry) as 'Hcess_st (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=-10 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
(Select Sum(LineTotal) From PCH3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
M.WTSum AS 'TDS (Rs.)',
M.DocTotal as 'Total (Rs.)'
FROM OPCH M LEFT OUTER JOIN PCH1 L on L.DocEntry=M.DocEntry
LEFT OUTER JOIN PCH4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
LEFT OUTER JOIN PCH5 J ON M.DocEntry = J.AbsEntry
LEFT OUTER JOIN PCH3 Q ON M.DocEntry = Q.DocEntry
WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]')
GROUP BY
M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
ORDER BY
M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
Thanks
Deepak Tyagi

Dear Thanga ,
I am posting Again my Query and modify this with item name and quantity. This query is working well at my system..
SELECT  M.DocNum AS 'AP Inv. #', M.DocDate as 'Date', M.CardName as 'Vendor Name',M.NumAtCard as 'Vendor Ref',
(Select Sum(Quantity) FROM PCH1 L Where L.DocEntry=M.DocEntry) as 'TotQty',
(Select Sum(LineTotal) FROM PCH1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
(SELECT distinct (TaxRate) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
(SELECT distinct (TaxRate) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'ECess (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
(SELECT distinct (TaxRate) FROM PCH4 where statype=-55 and DocEntry=M.DocEntry) as 'Hcess (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=-55 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
(SELECT distinct (TaxRate) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as 'VAT (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
(SELECT distinct (TaxRate) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as 'CST (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
(SELECT distinct (TaxRate) FROM PCH4 where statype=-40 and DocEntry=M.DocEntry) as 'CVD (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=-40 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
(SELECT distinct (TaxRate) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as 'SERVICE (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
(SELECT distinct (TaxRate) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'Cess_sertax (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
(SELECT distinct (TaxRate) FROM PCH4 where statype=-10 and DocEntry=M.DocEntry) as 'Hcess_st (Rate)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=-10 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
(Select Sum(LineTotal) From PCH3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
M.WTSum AS 'TDS (Rs.)',
M.DocTotal as 'Total (Rs.)'
FROM OPCH M LEFT OUTER JOIN PCH1 L on L.DocEntry=M.DocEntry
LEFT OUTER JOIN PCH4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
LEFT OUTER JOIN PCH5 J ON M.DocEntry = J.AbsEntry
LEFT OUTER JOIN PCH3 Q ON M.DocEntry = Q.DocEntry
WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]')
GROUP BY
M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
ORDER BY
M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
Thanks & Regards
Deepak Tyagi

Similar Messages

  • Purchase register query based on down payment invoice

    Hai All,
    I am creating an invoice based on purchase order.The vat  tax is being calculated in the downpayment. I want the vat to be displayed in the downpayment invoice as well as the a/p invoice but i m not getting it in the a/p invoice. Pls guide me with the linking of tables to get the query working. I have formatted the fields req but could not link the tables...Pls guide me with that...
    Thanks & Regards,
    Neela

    Hi Neela,
    Check the thread.
    Re: Purchase register query based on down payment invoice
    FROM PCH1 T0
    INNER JOIN OPCH T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OSLP T2 ON T0.SlpCode = T2.SlpCode
    LEFT OUTER JOIN PCH12 T3 ON T1.DocEntry = T3.DocEntry
    LEFT JOIN ODPI T4 ON T1.CardCode = T4.CardCode
    INNER JOIN DPO1 T5 ON T0.ItemCode = T5.ItemCode
    Close the thread, if issue solved.
    Regards,
    Madhan.

  • Partywise & Itemwise purchase register query

    Dear Expert,
    I am new in SAP.
    I need Partywise & Itemwise purchase register query.
    BR
    Deep

    Dear Deep,
    Welcome To SAP Community Network Forum...
    Check this link...
    http://forums.sdn.sap.com/thread.jspa?messageID=6730337#6730337
    Thanks,
    Srujal Patel

  • Purchase Register query

    Hi
    I wrote query for Purchase register
    SELECT M.DocNum AS 'AP Inv. #', M.DocDate as 'Date', M.CardName as 'Vendor Name',M.NumAtCard as 'Bill No. & Dt.',L.ItemCode, L.Dscription,
    (Select Sum(LineTotal) FROM PCH1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=7 and DocEntry=M.DocEntry) as 'ACD (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-55 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=10 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=8 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
    (Select Sum(LineTotal) From PCH3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
    M.WTSum AS 'TDS (Rs.)',
    M.DocTotal as 'Total (Rs.)'
    FROM OPCH M LEFT OUTER JOIN PCH1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN PCH4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN PCH5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN PCH3 Q ON M.DocEntry = Q.DocEntry
    WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]')
    GROUP BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal,L.ItemCode,L.Dscription
    ORDER BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal
    I want the row level amount for Base amount field But it is giving me the total amount including every line item. excluding of tax.
    Same with the tax amount. I tried removing sum but it is not helped
    Regards
    Shashi
    Edited by: shashi mantripragada on Dec 29, 2008 10:11 AM
    Edited by: shashi mantripragada on Dec 29, 2008 12:05 PM
    Edited by: shashi mantripragada on Dec 29, 2008 2:14 PM

    Hi Shashi,
    You could use this query for tax amount and row level base amount
    SELECT M.DocNum AS 'AP Inv. #', M.DocDate as 'Date', M.CardName as 'Vendor Name',M.NumAtCard as 'Bill No. & Dt.',L.ItemCode, L.Dscription,L.LineTotal,L.vatsum,
    (Select Sum(LineTotal) FROM PCH1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=7 and DocEntry=M.DocEntry) as 'ACD (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-55 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=10 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=8 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
    (Select Sum(LineTotal) From PCH3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
    M.WTSum AS 'TDS (Rs.)',
    M.DocTotal as 'Total (Rs.)'
    FROM OPCH M LEFT OUTER JOIN PCH1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN PCH4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN PCH5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN PCH3 Q ON M.DocEntry = Q.DocEntry
    WHERE (M.DocDate >= %0 AND M.DocDate <= %1)
    GROUP BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal,L.ItemCode,L.Dscription,L.LineTotal,L.vatsum
    ORDER BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal,L.LineTotal,L.vatsum
    Regards,
    Vijay Kumar
    SAP Business One Forums Team

  • Error in Purchase Register Query

    Hello All..
    I made a Query of Purchase Register and its working fine when my Invoice is of One item But when i am taking two or three items then its showing wrong result of all the taxes..
    Please Sort it out as soon as possible
    ELECT M.DocNum AS 'AP Inv. #', M.DocDate as 'Date', M.CardName as 'Vendor Name',M.NumAtCard as 'Bill No. & Dt.',L.ItemCode, L.Dscription,
    (Select Sum(LineTotal) FROM PCH1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=7 and DocEntry=M.DocEntry) as 'ACD (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-55 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=10 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=8 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
    (Select Sum(LineTotal) From PCH3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
    M.WTSum AS 'TDS (Rs.)',
    M.DocTotal as 'Total (Rs.)'
    FROM OPCH M LEFT OUTER JOIN PCH1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN PCH4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN PCH5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN PCH3 Q ON M.DocEntry = Q.DocEntry
    WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]')
    GROUP BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal,L.ItemCode,L.Dscription
    ORDER BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal

    Hi  Gordon..
    Can you explain with any example..
    Thanks

  • Customized Query for purchase register

    Hi All,
    I need a query for purchase register which gives excise information with biferication.
    OPCH, PCH1, ORPC, RPC1 and IEI4
    In excel reporter we get the purchase register report But excise amount does not come in that report.
    So, I need Customised report for that.
    Regards
    Shashi

    hi shashi,
    SELECT M.DocNum AS 'AP Inv. #', M.DocDate as 'Date', M.CardName as 'Vendor Name',M.NumAtCard as 'Bill No. & Dt.',
    (Select Sum(LineTotal) FROM PCH1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=7 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=10 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=8 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
    (Select Sum(LineTotal) From PCH3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
    M.WTSum AS 'TDS (Rs.)',
    M.DocTotal as 'Total (Rs.)'
    FROM OPCH M LEFT OUTER JOIN PCH1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN PCH4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN PCH5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN PCH3 Q ON M.DocEntry = Q.DocEntry
    WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND (T.TrgetEntry = ' ')
    GROUP BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    ORDER BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    Jeyakanthan

  • Purchase Register - Header level query issue

    Hi Guru's,
    I tried the following query for Purchase Register (Header Level) but I am not able to get the following details -                              1) AP Invoices which are without PO
    2) Freight amount not getting reflected
    SELECT T0.DocNum as 'PO. No.',
    T0.DocDate as 'PO. Date',
    M.DocNum as 'A/P Invoice No.',
    M.DocDate as 'Inv. Date',
    M.CardName as 'Vendor Name',
    M.NumAtCard as 'Bill No. & Date',
    (Select Sum(LineTotal) FROM PCH1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=8 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-80 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=7 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
    (Select Sum(LineTotal) From PCH3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
    M.WTSum AS 'TDS (Rs.)',
    M.DocTotal as 'Total (Rs.)'
    FROM OPOR T0 INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OPDN T2 ON T2.DocEntry = T1.TrgetEntry
    INNER JOIN PDN1 T3 on T3.DocEntry = T2.Docentry
    INNER JOIN OPCH M ON M.DocEntry = T3.TrgetEntry
    LEFT OUTER JOIN PCH1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN PCH4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN PCH5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN PCH3 Q ON M.DocEntry = Q.DocEntry
    WHERE M.DocDate >= '[%0]' AND M.DocDate <= '[%1]'
    GROUP BY
    T0.DocNum,T0.DocDate,M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    ORDER BY
    T0.DocNum,T0.DocDate,M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    Regards,
    Abhishek

    Hi Abhishek,
    Try this Query Report, you will be get the exact result in  this Query.
    your requirement.
    1. A/P Invoice with Purchase Order.
    2. The Freight amount will display the Freight Column in the query.
    Try this below Query,
    SELECT T0.DocNum as 'PO. No.',
    T0.DocDate as 'PO. Date',
    M.DocNum as 'A/P Invoice No.',
    M.DocDate as 'Inv. Date',
    M.CardName as 'Vendor Name',
    M.NumAtCard as 'Bill No. & Date',
    (Select Sum(LineTotal) FROM PCH1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=7 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=10 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=8 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
    (Select Sum(LineTotal) From PCH3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
    M.WTSum AS 'TDS (Rs.)',
    M.DocTotal as 'Total (Rs.)'
    FROM OPOR T0 INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OPDN T2 ON T2.DocEntry = T1.TrgetEntry
    INNER JOIN PDN1 T3 on T3.DocEntry = T2.Docentry
    INNER JOIN OPCH M ON M.DocEntry = T3.TrgetEntry
    LEFT OUTER JOIN PCH1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN PCH4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN PCH5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN PCH3 Q ON M.DocEntry = Q.DocEntry
    WHERE M.DocDate >= '[%0]' AND M.DocDate <= '[%1]'
    GROUP BY
    T0.DocNum,T0.DocDate,M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    ORDER BY
    T0.DocNum,T0.DocDate,M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    Regards,
    Madhan.

  • Purchase Register, sale register, & Cenvat Tax Register

    How to Create Purchase register, Sales Register, Cenvat Tax Register with total Balance
    Regds
    Edited by: Philip Eller on Jun 4, 2008 8:36 AM

    Hi Sashi,
    Create a user query from Query Wizard for
    Sales Register from Tables -OINV,INV4.
    Purchase Register from Tables - OPCH,PCH4.
    Hope above answer will helpful to you.
    Jeyakanthan.

  • Purchase Register with Item

    Hi Friends,
                    I want purchase register report in which i can see all row on each docentry, I have a query like
    SELECT
    M.DocNum as 'A/P Invoice No.',
    M.DocDate as 'Inv. Date',
    M.CardName as 'Vendor Name',
    M.NumAtCard as 'Vendor Ref. No.',
    (Select Sum (isnull (LineTotal,0)) FROM pch1 L Where L.DocEntry=M.DocEntry) - isnull (((Select Sum (isnull(LineTotal,0)) FROM rpc1 r Where R.baseEntry=L.DocEntry)),0) as 'Base Amt(Rs.)',
    (SELECT AVG (TaxRATE) FROM pch4 where statype=1 and DocEntry=M.DocEntry) - isnull (((SELECT Sum(TaxRATE) FROM Rpc4 R4 where statype=1 and R4.DocEntry=R.DocEntry)),0) as ' VAT_RATE ',
    (SELECT Sum(TaxSum) FROM pch4 where statype=1 and DocEntry=M.DocEntry) - isnull(((SELECT Sum(TaxSum) FROM Rpc4 R4 where statype=1 and R4.DocEntry=R.DocEntry)),0) as ' VAT(Rs.)',
    (SELECT avg(TAXRATE) FROM pch4 where statype=4 and DocEntry=M.DocEntry) - isnull(((SELECT Sum(Taxrate) FROM Rpc4 R4 where statype=4 and R4.DocEntry=R.DocEntry)),0) as ' CST_RATE ',
    (SELECT Sum(TaxSum) FROM pch4 where statype=4 and DocEntry=M.DocEntry) - isnull(((SELECT Sum(TaxSum) FROM Rpc4 R4 where statype=4 and R4.DocEntry=R.DocEntry)),0) as ' CST(Rs.) ',
    (Select Sum(LineTotal) From pch3 Q Where Q.DocEntry=M.DocEntry) - isnull(((SELECT Sum(Linetotal) FROM Rpc3 R3 where R3.DocEntry=R.DocEntry)),0) AS 'Freight(Rs.)' ,
    (M.DocTotal - isnull(M.PaidToDate,0)) as 'Total (Rs.)'
    from opch M
    LEFT OUTER JOIN pch1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN pch4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN pch5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN pch3 Q ON M.DocEntry = Q.DocEntry
    left outer join RPC1 R On R.Baseentry = L.Docentry
    left outer join RPC4 R4 On R.docentry = R4.Docentry
    left outer join RPC3 R3 On R.docentry = R3.docentry
    left outer join ORPC RP On R.docentry = RP.docentry
    WHERE M.DocDate >= [%0] AND M.DocDate <= [%1] and m.doctype = 'I'
    GROUP BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,
    M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal,L.docentry,R.docentry,RP.Doctotal, M.Paidtodate
    ORDER BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,
    M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal
        My requirement is to show all row items corresponding to docnumber.
    Thanks
    Andy

    Hi Andy,
    Try:
    SELECT
    M.DocNum as 'A/P Invoice No.',
    M.DocDate as 'Inv. Date',
    M.CardName as 'Vendor Name',
    M.NumAtCard as 'Vendor Ref. No.',
    (Select Sum (isnull (LineTotal,0)) FROM pch1 L Where L.DocEntry=M.DocEntry) - isnull (((Select Sum (isnull(LineTotal,0)) FROM rpc1 r Where R.baseEntry=L.DocEntry)),0) as 'Base Amt(Rs.)',
    (SELECT AVG (TaxRATE) FROM pch4 where statype=1 and DocEntry=M.DocEntry) - isnull (((SELECT Sum(TaxRATE) FROM Rpc4 R4 where statype=1 and R4.DocEntry=R.DocEntry)),0) as ' VAT_RATE ',
    (SELECT Sum(TaxSum) FROM pch4 where statype=1 and DocEntry=M.DocEntry) - isnull(((SELECT Sum(TaxSum) FROM Rpc4 R4 where statype=1 and R4.DocEntry=R.DocEntry)),0) as ' VAT(Rs.)',
    (SELECT avg(TAXRATE) FROM pch4 where statype=4 and DocEntry=M.DocEntry) - isnull(((SELECT Sum(Taxrate) FROM Rpc4 R4 where statype=4 and R4.DocEntry=R.DocEntry)),0) as ' CST_RATE ',
    (SELECT Sum(TaxSum) FROM pch4 where statype=4 and DocEntry=M.DocEntry) - isnull(((SELECT Sum(TaxSum) FROM Rpc4 R4 where statype=4 and R4.DocEntry=R.DocEntry)),0) as ' CST(Rs.) ',
    (Select Sum(LineTotal) From pch3 Q Where Q.DocEntry=M.DocEntry) - isnull(((SELECT Sum(Linetotal) FROM Rpc3 R3 where R3.DocEntry=R.DocEntry)),0) AS 'Freight(Rs.)' ,
    (M.DocTotal - isnull(M.PaidToDate,0)) as 'Total (Rs.)',
    L.ItemCode,L.Quantity,L.LineTotal
    from opch M
    LEFT OUTER JOIN pch1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN pch4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN pch5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN pch3 Q ON M.DocEntry = Q.DocEntry
    left outer join RPC1 R On R.Baseentry = L.Docentry
    left outer join RPC4 R4 On R.docentry = R4.Docentry
    left outer join RPC3 R3 On R.docentry = R3.docentry
    left outer join ORPC RP On R.docentry = RP.docentry
    WHERE M.DocDate >= [%0\] AND M.DocDate <= [%1\] and m.doctype = 'I'
    GROUP BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,
    M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal,L.docentry,R.docentry,RP.Doctotal, M.Paidtodate,
    L.ItemCode,L.Quantity,L.LineTotal
    ORDER BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,
    M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal
    Thanks,
    Gordon

  • Tax conditions in purchase register report

    Hi all,
    I am developing a Purchase Register Report, I have a small doubt regarding Tax conditions.
    From which tables we will get the Tax Conditions like CST, SERVICE TAX, VAT etc.
    Previously I have developed Purchase Requisition Report,in that I have used the FM    'CALCULATE_TAX_ITEM' to get the Tax Condition Values. But in this purchase register report I am getting wrong values for the same FM.
    Please suggest me.
    Regards,
    Pradeep.

    Hi Pradeep,
    First of all let me clarify that you are generating report for Purchase orders generated or for MIRO posted documents
    If you are generating for purchase orders
    First use FM 'REFRESH_TAX_TABLES' for updating tax tables with latest changes
    Next use FM 'FIND_TAX_SPREADSHEET' to find out tax procedure or schema
    Then use FM 'CALCULATE_TAX_ITEM' to get taxes
    If you are generating report for MIRO documents
    Use BSET table for accounting document generated against MIRO
    Regards
    Krishna

  • Purchase Register In XL Reporter

    Hi Experts
    I am using SBO 2007 B PL 08. There is problem in Purchase Register in XL Reporter. It does not showing Tax Rate and Tax amount. Is there any way to check why it is not showing and How I change in XL Report . How can I create A Report in XL Reporter give some tips.
    Thanks
    Regards
    Gorge

    Gorge Ance 
    It seems you are new to XLR, i would advice its better to use Crystal Reports
    Because it is simple and flexible you can use dbo.tables or use your own query as command
    thanks
    Krish

  • Update Purchase Order number.(Link GL to PO)

    Hi all,
    Currently i am using the below query for one of our report(R12). However there is a need to update Purchase Order Number .Could anyone please help on how to link GL to PO and provide the updated query.The query is as follows.
    SELECT gjl.je_line_num,
        gjl.code_combination_id,
        SUM(NVL(GJL.accounted_dr, 0))                                     AS Accounted_DR,
        SUM(NVL(GJL.accounted_cr, 0))                                     AS Accounted_CR,
        ( SUM(NVL(GJL.accounted_dr, 0)) - SUM(NVL(GJL.accounted_cr, 0)) ) AS Accounted_Balance,
        gjb.actual_flag,
        NULL     AS "Check Number",
        gjb.name AS "Batch Name",
        TO_CHAR(gjh.currency_conversion_date, 'DD-Mon-YYYY') currency_conversion_date,
        ROUND(gjh.CURRENCY_CONVERSION_RATE,4) CURRENCY_CONVERSION_RATE,
        gjh.currency_conversion_type,
        NULL                                                          AS Document_Number,
        SUM(NVL(GJL.entered_dr, 0))                                   AS Entered_DR,
        SUM(NVL(GJL.entered_cr, 0))                                   AS Entered_CR,
        ( SUM(NVL(GJL.entered_dr, 0)) - SUM(NVL(GJL.entered_cr, 0)) ) AS Entered_Balance,
        gcc.segment1
        || '.'
        || gcc.segment2
        || '.'
        || gcc.segment3
        || '.'
        || gcc.segment4
        || '.'
        ||gcc.segment5
        || '.'
        || gcc.segment6
        || '.'
        || gcc.segment7
        || '.'
        || gcc.segment8 "Account Code",
        gl.currency_code AS "Ledger Currency",
        gjh.name         AS "Header Name",
        gjl.description  AS "Journal Line Description",
        NULL             AS party_name,
        NULL             AS party_id,
        GJH.period_name,
        TO_CHAR(gjh.POSTED_DATE, 'DD-Mon-YYYY') POSTED_DATE,
        NULL AS "Purchase Invoice Number",
        NULL AS "AP Invoice Line Description",
        NULL AS "Sales Invoice Number",
        gcc.segment1 Company ,
        gcc.segment2 Account,
        DECODE(gcc.segment2,NULL,'',apps.gl_flexfields_pkg.get_description_sql(gcc.chart_of_accounts_id,2,gcc.segment2)) AS "Seg2 Desc",
        gcc.segment3 AS "Business Model",
        gcc.segment4 Region,
        gcc.segment5 AS "Cost Profit Center",
        gcc.segment6 AS "Product Group",
        gcc.segment7 AS "Related Company",
        gcc.segment8 AS "Reserve",
        gjl.status   AS "Journal Line Status",
        GL.name      AS "LEDGER NAME",
        GJH.currency_code,
        GJH.je_category je_cat_f,
        GJCT.user_je_category_name je_category,
        GJH.je_source,
        NULL AS "Sales_order" ,
        NULL AS "Purchase Order Number"
      FROM APPS.gl_je_headers gjh,
        APPS.gl_je_batches gjb,
        APPS.gl_ledgers gl,
        APPS.gl_je_lines gjl,
        APPS.gl_code_combinations gcc,
        (SELECT je_category_name,
          user_je_category_name
        FROM APPS.GL_JE_CATEGORIES_TL
        WHERE language='E'
        ) GJCT
      WHERE gjh.je_from_sla_flag IS NULL
      --AND gjh.EXTERNAL_REFERENCE IS NULL
      AND gjb.je_batch_id         = gjh.je_batch_id
      AND gjh.ledger_id           = gl.ledger_id
      AND gjh.je_header_id        = gjl.je_header_id
      AND gcc.code_combination_id = gjl.code_combination_id
      AND GJH.JE_CATEGORY         = GJCT.je_category_name(+)
      AND GL.name NOT IN('NL ABX RepCorp USD (EUR)')
      GROUP BY gjl.je_line_num,
        gjl.code_combination_id,
        gjb.actual_flag,
        gjb.name,
        gjh.currency_conversion_date,
        ROUND(gjh.CURRENCY_CONVERSION_RATE,4),
        gjh.currency_conversion_type,
        gcc.segment1
        || '.'
        || gcc.segment2
        || '.'
        || gcc.segment3
        || '.'
        || gcc.segment4
        || '.'
        ||gcc.segment5
        || '.'
        || gcc.segment6
        || '.'
        || gcc.segment7
        || '.'
        || gcc.segment8,
        gl.currency_code,
        gjh.name,
        gjl.description,
        gjb.je_batch_id,
        gjb.status,
        gjb.posted_date,
        gjb.description,
        gl.name,
        gjh.name,
        GJH.period_name,
        gjh.posted_date,
        gcc.segment1,
        gcc.segment2,
        gcc.segment3,
        gcc.segment4,
        gcc.segment5,
        gcc.segment6,
        gcc.segment7,
        gcc.segment8,
        GL.name,
        gjl.status,
        GJH.je_category,
        GJCT.user_je_category_name,
        GJH.je_source,
        GJH.currency_code,
        DECODE(gcc.segment2,NULL,'',apps.gl_flexfields_pkg.get_description_sql(gcc.chart_of_accounts_id,2,gcc.segment2))

    Finally Resolved the problem by writing 2 exits.
    one exit 'EXIT_SAPLVEDB_007'  for identify correct item in the sales order by updating the customer purchase order item number i.e., VBAP-POSEX.  if we update the POSEX field then it wont create new item instead, it will update the item which it is referring to .
    2nd exit for updating the purchase order number. 
    I have tried to pass the program name, screen number, field name, field value etc to bdcdata in the exit 'EXIT_SAPLVEDB_002'. but I observed that it is not going to that screen in the debugging.
    when I try E1EDP02 with QUALF '044' it will update ship-to party's purchase order number.  so to update ship-to party's purchase order number it is going to that screen. 
    so I have used that thing to update purchase order number in sold-to party's purchase order number.
    so when it is going that screen iam changing the field name 'VBKD-BSTKD_E' to 'VBKD-BSTKD' in bdcdata.  Then it is worked.
    This is the solution I found in my time.
    Any way it is solved.  Hope it will be helpful for others who will get this problem.

  • How to retrieve apps after a complete iPod reset? The "App_Store Updates Purchase" tab isn't working!

    Hey Apple Community,
    I have a problem, but every problem has a story, so let me explain that first.
    Let's start of by saying that I bought my 32 Gb iPod in February, 2012.
    Over the course of the last 21 monts there have been about 370+ different apps on it (not all at ones of course). Of which I purchased about 26. I should also mension that my iPod hasn't been Jailbreaked at any point of time (I just don't trust it).
    Yesterday, I wanted to put some new songs and video's on it. So I connected my iPod to my PC (I use windows 8). When I opened, It told me that there was a new system update (iOS 6.1.5). Because I 'was' in a good mood and had the time, I pressed "Download and Install". The updates usually take some time to install so I minimalized iTunes and opened FireFox (to check my e-mail and watch some video's). About 8 minutes later, I got a notification from Windows telling me that iTunes had crashed. At that point the update wasn't done installing. I restarted my PC (just to be sure) and opened iTunes again. It immediately openened a notification, telling me that there was a damaged iPod connected to my PC. The only option I had was to restore it, which would mean that my iPod would get reset to it's manufacture settings. You can imagine that this sounded disturbing. Fortunately it also stated that I would get the option to restore it (to the way it was before the update/crash) after the reset. This would be done using the automated back-up system of iTunes. I started the reset and didn't touch my PC nor iPod until it was finished (just to be sure). Then I used the given 'restore to old state' option (the just installed version won't chance by doing this). After finishing, I immediately noticed that all of the apps that I installed were missing. In total about 100+ apps (about 60-70+ games, 30-40+ remaining apps). However I did get my photo's back (which are now backed up), that's nice! along with my music and video's. The missing apps are reinstallable but the saves aren't. Imagion 21 monts worth of game saves gone in a flash for more then 60 games. Of the 100+ app there are about 30 that I really want back, however I am unable the recall all of the names.
    So I went into the App_Store > Updates > Purchased tab. Here comes the real problem. The purchase tab doesn't load, it isn't even displaying the choice to switch from 'all' to 'not on this device'. I've tried some things to get is to work again: restart my iPod, log out and back in my iOS accant (in the app store) and a combination of the last 2 things. This didn't work however.
    My questions are:
    1) Is this problem fixable? If yes, how?
    2) If not, what would be the second best option of retrieving the missing apps?
    Thanks before hand,
    Sebgear

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up                                                                
    - Restore to factory settings/new iOS device.             
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar                                      
    Also, you should be able to redownload via iTunes on the computer. See that method included here:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • Purchase Register report in SAP BI

    Dear All,
    Please suggest me any standard Purchase Register report  is available in BI or how to achieve this requirement in BI.
    Please let me know process.
    Thank
    Regards,
    Sai.k

    Hi,
    while there is always a new requirement, one needs to discuss  with the functional consultants and find out which tables are being used which may fulfill the scenario. We also need to identify the list of characteristic and Keyfigues the client wants to analyze.
    Also SAP Help is a good source to find more of a standard stream lined objects. Need to analyze if standard objects satisfy the requirement or customization is required.
    Please perform the steps as Rama has suggested...
    thank you

  • Purchase Register Report

    Hi Friends,
             I need to develop the Purchase Register Report with Vendor details, TIN number, Invoice details, E1 purchases with purchase base value and VAT and CST percentages. But Iam new to the Purchase module. I know the basic tables for purchasing. but can anybody guide me the tables for TIN number with VAT and CST percentages and how to proceed?
    Thanking you in advance
    Regards,
    Murali

    I don't know the fields but a few pointers that might be helpful:
    1) Ask your functional analyst - it's part of their job to provide you with the field location or any guidance on that
    2) At least someone should be able to point you where the fields are on the screen. Then you should be able to go the usual route - F1 -> Technical info, etc.
    3) Respective functional forum might be a better place for such questions if for some reason p. 1 and 2 above are not feasible.
    4) You can always use SQL Trace (ST05) to find where the information is being read from or written to. Start the trace, run the transaction, stop the trace and analyze the list. Voila - no need to ask anyone ever again.

Maybe you are looking for