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

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

  • 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

  • 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

  • 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

  • Flash Player Auto Upgrade ver 14, Won't Install: Error- Unable to Register

    The Flash Player Upgrade attempted to install but stopped and gave me an error: Unable to Register. I have been all through the forums and I believe I have tried everything suggested.  These have been my attemptsOS - Windows XP Pro, latest updates loaded.
    1- I read a suggestion to attempt a "clean install" .  I watched the YOUTUBE video that was on the page and followed it exactly.  Attempted to re-install ver 14, and recieved the same error. this is the link to the page I followed: Can not install Adobe Flash Player. Error messages are "Failed to - Microsoft Community
    2- I also downloaded the SubInACL file and the  reset_fp10.zip file, followed the instructions and ran the file.  Attempted to re-install ver 14 and got the same error, unable/failed to register.
    3- I have attempted this numerous ways, rebooting the computer in between each change, re-booting after I did all, and nothing seems to work.
    4- Downloaded Mozilla Firefox  at someones suggestion, attempted to download and install, still the same error.
    5- When I open AOL, it attempts to install Flash Runtime and the same thing happens.  Error, Failed to Register.
    6- Purchased a Registry Editor/Cleaner.  Ran this cleaner and it did speed up my computer.  Did clean uninstall of Flash Player making sure no files were on my computer. Same error.
    7- Finally, contacted Adobe by phone.  The tell me they can help and try to fix the problem, but it will cost me $39.95 per instance. And, I didn't get any warm feeling that there was a gaurantee that they could fix it. In fact, i could hardly understand the indian speaking tech support.
    8- I also was told that after 1pm EDT, the new Adobe help page would be up and there would be a fix on it.  Now, 3:20 EDT, and the page is still not up.
    Anyone have any suggestions to fix this.  I want to avoud the "F" word ,,, Format and re-install from scratch just to get this fixed.

    I'm using WinXP (Home Edition) with Service Pack 3, and IE ver 8.  When I tried the auto upgrade to Ver 14, I got the same results as you -- "failed to register".  What tickes me off the most is that the auto upgrade deleted the previous version of FlashPlayer that worked fine.  Now I get no flash content using IE8,
    Like you, I tried to install a previous version of FlashPlayer and got the idotic response "you need to install the latest version, Ver 14" which caused all the problems.
    Maybe the brainworks at Adobe can develop a fix soon.
    If not, I will never install another Adobe product on my newer Win8 computer.

  • Dynamic SMTP Port Error -Class not Registered

    Hi,BizTalk receiving the Invoice Message from Source and doing some transformation.After that Biztalk will send  email  dynamically via SMTP .Below is the code in message construct message assignment shape
    multipartMessage1.MessagePart_1= XMLdoc;
    multipartMessage1.MessagePart_2="This is message part2 as a string";
    multipartMessage1(SMTP.Subject) ="Email From Dynamic Port";
    multipartMessage1(SMTP.From) ="[email protected]";
    multipartMessage1(SMTP.SMTPHost) ="100.110.120.99";
    multipartMessage1.MessagePart_2(MIME.FileName) = "Attachment_Name";
    multipartMessage1(SMTP.SMTPAuthenticate) =0;
    SendInvoicePort(Microsoft.XLANGs.BaseTypes.Address)="mailto:[email protected]";
    When run the application, getting below error message.
    A message sent to adapter "SMTP" on send port "HelloWorld_1.0.0.0_Microsoft.Samples.BizTalk.HelloWorld.HelloSchedule_SendInvoicePort_d7ce16ba803d4f87"
    with URI "mailto:[email protected]" is suspended.
     Error details: Class not registered
     MessageId:  {0D6BBA1A-F384-4AD9-8B48-44A9C342DEFB}
     InstanceID: {EAFEADE1-8D05-4A7D-A908-7BC297788D06}
    After googling ,I have added
    multipartMessage1 (SMTP.EmailBodyTextCharset) = "UTF-8".but no use.
    I’ve spent many hours on this issue .Please advise how to resolve this issue

    Hi Singam,
    What is the default handler(host) configured for SMTP Adapter. Check it is 32 bit or 64 bit.
    This seems to be a known issue if Host is of 64 bit.
    Retrieving the COM class factory for component with CLSID {254B4003-2AA7-4C82-BB2E-18BA7F22DCD2} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
    When you use BizTalk in 64 bit version, and the Mime/Smime encoder you’ve got this error. To resolveit, just put your pipeline on a 32 bit Host.
    Mime/SMIME encoder error :
    Class not registered (Exception from HRESULT: 0×80040154 (REGDB_E_CLASSNOTREG)) 
    http://social.technet.microsoft.com/wiki/contents/articles/7204.biztalk-server-list-of-errors-and-warnings-causes-and-solutions.aspx
    As you are using Dynamic Send Port it will run under the default host make it of 32 bit, restart the host and see if the issue is resolved or not.
    Thanks,
    Prashant
    Please mark this post accordingly if it answers your query or is helpful.

  • Error in : Purchase order Creation using BAPI_PO_CREATE1

    Hell  guys,
    I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
    I want the new PO to have all the characteristics of an existing PO. whose PO # is  stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in the std FM - MEPO_DOC_ITEM_GET . It raises an exception of failure. I am trying to create many new PO's in the loop below. If there is just one row, sometimes, it creates the PO even with the exception failure ( which is pretty weird).
    Am i making any mistake while filling the header or item or schedule lines for the BAPI_PO_CREATE1 ? Any tips or clues why I am getting a dump ?
    DATA: i_insert,
            i_create_order,
            i_cycle     TYPE cycle,
            i_qty_acpt  TYPE dzmeng,
            i_dly_date  TYPE vbak-vdatu,
            i_item      TYPE roijnomiio .
      DATA: i_order TYPE symsgv,
            i_return TYPE swd_return .
      DATA: i_vbak      TYPE vbak,
            i_vbap      TYPE vbap,
            i_ekko      TYPE ekko,
            i_ekpo      TYPE ekpo,
            i_bsoh      TYPE bapisdhd1,
            i_bsohx     TYPE bapisdhd1x,
            i_bpoh      TYPE bapimepoheader,
            i_bpohx     TYPE bapimepoheaderx,
            i_vbeln     TYPE vbeln_va,
            i_posnr     TYPE posnr_va,
            i_contr     TYPE vbeln_va,
            i_conit     TYPE posnr_va,
            i_ebeln     TYPE ebeln,
            i_ebelp     TYPE ebelp,
            i_pargr     TYPE pargr,
            i_thead     TYPE thead,
            i_line      TYPE tline,
            i_note      TYPE txw_note,
            i_new_vbeln TYPE vbeln_va,
            i_new_ebeln TYPE ebeln,
            i_wa_bsoi   TYPE bapisditm,
            i_wa_bsoix  TYPE bapisditmx,
            i_wa_bsop   TYPE bapiparnr,
            i_wa_bsos   TYPE bapischdl,
            i_wa_bsosx  TYPE bapischdlx,
            i_wa_vbpa   TYPE vbpa,
            i_wa_vbkd   TYPE vbkd,
            i_wa_bpoi   TYPE bapimepoitem,
            i_wa_bpoix  TYPE bapimepoitemx,
            i_wa_bpos   TYPE bapimeposchedule,
            i_wa_bposx  TYPE bapimeposchedulx,
            i_wa_bpop   TYPE bapiekkop,
            i_wa_ekpa   TYPE ekpa,
            i_message   TYPE char72,
            i_bapiretn  TYPE bapiret2,
            i_bapiret2  TYPE TABLE OF bapiret2 INITIAL SIZE 1,
            i_vbpa      TYPE TABLE OF vbpa INITIAL SIZE 1,
            i_vbkd      TYPE TABLE OF vbkd INITIAL SIZE 1,
            i_ekpa      TYPE TABLE OF ekpa INITIAL SIZE 1,
            i_bsoi      TYPE TABLE OF bapisditm INITIAL SIZE 1,
            i_bsoix     TYPE TABLE OF bapisditmx INITIAL SIZE 1,
            i_bsos      TYPE TABLE OF bapischdl INITIAL SIZE 1,
            i_bsosx     TYPE TABLE OF bapischdlx INITIAL SIZE 1,
            i_bsop      TYPE TABLE OF bapiparnr INITIAL SIZE 1,
            i_bpoi      TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
            i_bpoix     TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
            i_bpos      TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
            i_bposx     TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
            i_bpop      TYPE TABLE OF bapiekkop INITIAL SIZE 1,
            i_text_tab  TYPE TABLE OF tline INITIAL SIZE 1,
            i_line_tab  TYPE TABLE OF tline INITIAL SIZE 1,
            i_txw_note  TYPE TABLE OF txw_note INITIAL SIZE 1,
            i_oij_el_doc_mot TYPE oij_el_doc_mot .
      CONSTANTS: c_char_c VALUE 'C',
                 c_char_e VALUE 'E',
                 c_char_p VALUE 'P',
                 c_char_g VALUE 'G',
                 c_char_i VALUE 'I',
                 c_char_s VALUE 'S',
                 c_char_x VALUE 'X',
                 c_zsw(3) VALUE 'ZSW',
                 c_nomit_stat(4) VALUE 'ZDNY' .
      DATA : lv_nomtk_split        TYPE oij_nomtk.
      DATA : i_order_split_create  TYPE TABLE OF zsws_order_split.
      DATA : wa_order_split_create TYPE zsws_order_split.
      LOOP AT i_order_split_create INTO wa_order_split_create.
        IF NOT i_create_order IS INITIAL .
          CLEAR: i_create_order .
              MOVE: wa_order_split_create-docnr  TO i_ebeln,
                    wa_order_split_create-docitm TO i_ebelp .
              CALL FUNCTION 'ME_EKKO_SINGLE_READ'
                   EXPORTING
                        pi_ebeln         = i_ebeln
                   IMPORTING
                        po_ekko          = i_ekko
                   EXCEPTIONS
                        no_records_found = 1
                        OTHERS           = 2.
              IF sy-subrc <> 0 .
              ENDIF .
    * Fill PO Header
              i_bpoh-comp_code   = i_ekko-bukrs .
              i_bpoh-doc_type    = i_ekko-bsart .
              i_bpoh-vendor      = i_ekko-lifnr .
              i_bpoh-langu       = i_ekko-spras .
              i_bpoh-pmnttrms    = i_ekko-zterm .
              i_bpoh-purch_org   = i_ekko-ekorg .
              i_bpoh-pur_group   = i_ekko-ekgrp .
              i_bpoh-currency    = i_ekko-waers .
              i_bpoh-agreement   = i_ekko-konnr .
              i_bpoh-incoterms1  = i_ekko-inco1 .
              i_bpoh-incoterms2  = i_ekko-inco2 .
    * Fill PO update indicator 'X'
              i_bpohx-comp_code  = c_char_x .
              i_bpohx-doc_type   = c_char_x .
              i_bpohx-vendor     = c_char_x .
              i_bpohx-langu      = c_char_x .
              i_bpohx-pmnttrms   = c_char_x .
              i_bpohx-purch_org  = c_char_x .
              i_bpohx-pur_group  = c_char_x .
              i_bpohx-currency   = c_char_x .
              i_bpohx-agreement  = c_char_x .
              i_bpohx-incoterms1 = c_char_x .
              i_bpohx-incoterms2 = c_char_x .
              CALL FUNCTION 'ME_EKPO_SINGLE_READ'
                   EXPORTING
                        pi_ebeln         = i_ebeln
                        pi_ebelp         = i_ebelp
                   IMPORTING
                        po_ekpo          = i_ekpo
                   EXCEPTIONS
                        no_records_found = 1
                        OTHERS           = 2.
              IF sy-subrc <> 0 .
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
              ENDIF .
    * Fill PO Item
              i_wa_bpoi-po_item    = i_ekpo-ebelp .
              i_wa_bpoi-material   = i_ekpo-matnr .
              i_wa_bpoi-plant      = i_ekpo-werks .
              i_wa_bpoi-stge_loc   = i_ekpo-lgort .
              i_wa_bpoi-quantity   = wa_order_split_create-qty_acptd .
              i_wa_bpoi-po_unit    = i_ekpo-meins .
              i_wa_bpoi-tax_code   = i_ekpo-mwskz .
              i_wa_bpoi-val_type   = i_ekpo-bwtar .
              i_wa_bpoi-item_cat   = i_ekpo-pstyp .
              i_wa_bpoi-acctasscat = i_ekpo-knttp .
              i_wa_bpoi-agreement  = i_ekpo-konnr .
              i_wa_bpoi-agmt_item  = i_ekpo-ktpnr .
              APPEND i_wa_bpoi TO i_bpoi .
    * Fill PO Item update indicator 'X'
              i_wa_bpoix-po_item    = i_ekpo-ebelp .
              i_wa_bpoix-po_itemx   = c_char_x .
              i_wa_bpoix-material   = c_char_x .
              i_wa_bpoix-plant      = c_char_x .
              i_wa_bpoix-stge_loc   = c_char_x .
              i_wa_bpoix-quantity   = c_char_x .
              i_wa_bpoix-po_unit    = c_char_x .
              i_wa_bpoix-tax_code   = c_char_x .
              i_wa_bpoix-val_type   = c_char_x .
              i_wa_bpoix-item_cat   = c_char_x .
              i_wa_bpoix-acctasscat = c_char_x .
              i_wa_bpoix-agreement  = c_char_x .
              i_wa_bpoix-agmt_item  = c_char_x .
              APPEND i_wa_bpoix TO i_bpoix .
    * Fill PO Item Schedule
              i_wa_bpos-po_item       = i_ekpo-ebelp .
              i_wa_bpos-sched_line    = '0001' .
              i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
              i_wa_bpos-quantity      = wa_order_split_create-qty_acptd .
              APPEND i_wa_bpos TO i_bpos .
    * Fill PO Item schedule update indicator 'X'
              i_wa_bposx-po_item       = i_ekpo-ebelp .
              i_wa_bposx-sched_line    = '0001' .
              i_wa_bposx-delivery_date = c_char_x .
              i_wa_bposx-quantity      = c_char_x .
              APPEND i_wa_bposx TO i_bposx .
              CLEAR: i_pargr .
              SELECT SINGLE pargr
                INTO i_pargr
                FROM t161
               WHERE bstyp = i_ekko-bstyp
                 AND bsart = i_ekko-bsart .
              CLEAR i_ekpa[].
              CALL FUNCTION 'MM_READ_PARTNERS'
                   EXPORTING
                        application = c_char_p
                        ebeln       = i_ebeln
                        bstyp       = i_ekko-bstyp
                        pargr       = i_pargr
                   TABLES
                        x_ekpa      = i_ekpa[].
              LOOP AT i_ekpa INTO i_wa_ekpa .
                i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
                i_wa_bpop-langu = sy-langu .
                IF NOT i_wa_ekpa-lifn2 IS INITIAL .
                  i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
                ELSE .
                  i_wa_bpop-buspartno = i_wa_ekpa-parnr .
                ENDIF .
                APPEND i_wa_bpop TO i_bpop .
                CLEAR: i_wa_ekpa, i_wa_bpop .
              ENDLOOP .
              CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
              CALL FUNCTION 'BAPI_PO_CREATE1'
                   EXPORTING
                        poheader         = i_bpoh
                        poheaderx        = i_bpohx
                   IMPORTING
                        exppurchaseorder = i_new_ebeln
                   TABLES
                        return           = i_bapiret2
                        poitem           = i_bpoi[]
                        poitemx          = i_bpoix[]
                        poschedule       = i_bpos[]
                        poschedulex      = i_bposx[].
              i_order = i_new_ebeln .
              SHIFT i_order LEFT DELETING LEADING '0' .
              i_return-errortype = c_char_i .
              i_return-workarea  = c_zsw .
              i_return-message   = '064' .
              i_return-variable1 = i_order .
            loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .
            append i_bapiretn to t_bapi_return .
          endloop .
          if t_bapi_return[] is initial .
             i_create_order = c_char_x .
               CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'
                   EXPORTING
                        act_return = i_return. "Popup with new PO no.
          ENDCASE .                                     " Docind
        ENDIF .
      ENDLOOP.

    Hi Shareen,
    I think in the following parts of the code,
              CALL FUNCTION 'MM_READ_PARTNERS'
                   EXPORTING
                        application = c_char_p
                        ebeln       = i_ebeln
                        bstyp       = i_ekko-bstyp
                        pargr       = i_pargr
                   TABLES
                        x_ekpa      = i_ekpa[].
    Error in : Purchase order Creation using BAPI_PO_CREATE1
    Posted: Mar 20, 2006 7:39 PM      Reply      E-mail this post 
    Hell guys,
    I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
    I want the new PO to have all the characteristics of an existing PO. whose PO # is stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in the std FM - MEPO_DOC_ITEM_GET . It raises an exception of failure. I am trying to create many new PO's in the loop below. If there is just one row, sometimes, it creates the PO even with the exception failure ( which is pretty weird).
    Am i making any mistake while filling the header or item or schedule lines for the BAPI_PO_CREATE1 ? Any tips or clues why I am getting a dump ?
    DATA: i_insert,
            i_create_order,
            i_cycle     TYPE cycle,
            i_qty_acpt  TYPE dzmeng,
            i_dly_date  TYPE vbak-vdatu,
            i_item      TYPE roijnomiio .
      DATA: i_order TYPE symsgv,
            i_return TYPE swd_return .
      DATA: i_vbak      TYPE vbak,
            i_vbap      TYPE vbap,
            i_ekko      TYPE ekko,
            i_ekpo      TYPE ekpo,
            i_bsoh      TYPE bapisdhd1,
            i_bsohx     TYPE bapisdhd1x,
            i_bpoh      TYPE bapimepoheader,
            i_bpohx     TYPE bapimepoheaderx,
            i_vbeln     TYPE vbeln_va,
            i_posnr     TYPE posnr_va,
            i_contr     TYPE vbeln_va,
            i_conit     TYPE posnr_va,
            i_ebeln     TYPE ebeln,
            i_ebelp     TYPE ebelp,
            i_pargr     TYPE pargr,
            i_thead     TYPE thead,
            i_line      TYPE tline,
            i_note      TYPE txw_note,
            i_new_vbeln TYPE vbeln_va,
            i_new_ebeln TYPE ebeln,
            i_wa_bsoi   TYPE bapisditm,
            i_wa_bsoix  TYPE bapisditmx,
            i_wa_bsop   TYPE bapiparnr,
            i_wa_bsos   TYPE bapischdl,
            i_wa_bsosx  TYPE bapischdlx,
            i_wa_vbpa   TYPE vbpa,
            i_wa_vbkd   TYPE vbkd,
            i_wa_bpoi   TYPE bapimepoitem,
            i_wa_bpoix  TYPE bapimepoitemx,
            i_wa_bpos   TYPE bapimeposchedule,
            i_wa_bposx  TYPE bapimeposchedulx,
            i_wa_bpop   TYPE bapiekkop,
            i_wa_ekpa   TYPE ekpa,
            i_message   TYPE char72,
            i_bapiretn  TYPE bapiret2,
            i_bapiret2  TYPE TABLE OF bapiret2 INITIAL SIZE 1,
            i_vbpa      TYPE TABLE OF vbpa INITIAL SIZE 1,
            i_vbkd      TYPE TABLE OF vbkd INITIAL SIZE 1,
            i_ekpa      TYPE TABLE OF ekpa INITIAL SIZE 1,
            i_bsoi      TYPE TABLE OF bapisditm INITIAL SIZE 1,
            i_bsoix     TYPE TABLE OF bapisditmx INITIAL SIZE 1,
            i_bsos      TYPE TABLE OF bapischdl INITIAL SIZE 1,
            i_bsosx     TYPE TABLE OF bapischdlx INITIAL SIZE 1,
            i_bsop      TYPE TABLE OF bapiparnr INITIAL SIZE 1,
            i_bpoi      TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
            i_bpoix     TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
            i_bpos      TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
            i_bposx     TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
            i_bpop      TYPE TABLE OF bapiekkop INITIAL SIZE 1,
            i_text_tab  TYPE TABLE OF tline INITIAL SIZE 1,
            i_line_tab  TYPE TABLE OF tline INITIAL SIZE 1,
            i_txw_note  TYPE TABLE OF txw_note INITIAL SIZE 1,
            i_oij_el_doc_mot TYPE oij_el_doc_mot .
      CONSTANTS: c_char_c VALUE 'C',
                 c_char_e VALUE 'E',
                 c_char_p VALUE 'P',
                 c_char_g VALUE 'G',
                 c_char_i VALUE 'I',
                 c_char_s VALUE 'S',
                 c_char_x VALUE 'X',
                 c_zsw(3) VALUE 'ZSW',
                 c_nomit_stat(4) VALUE 'ZDNY' .
      DATA : lv_nomtk_split        TYPE oij_nomtk.
      DATA : i_order_split_create  TYPE TABLE OF zsws_order_split.
      DATA : wa_order_split_create TYPE zsws_order_split.
      LOOP AT i_order_split_create INTO wa_order_split_create.
        IF NOT i_create_order IS INITIAL .
          CLEAR: i_create_order .
              MOVE: wa_order_split_create-docnr  TO i_ebeln,
                    wa_order_split_create-docitm TO i_ebelp .
              CALL FUNCTION 'ME_EKKO_SINGLE_READ'
                   EXPORTING
                        pi_ebeln         = i_ebeln
                   IMPORTING
                        po_ekko          = i_ekko
                   EXCEPTIONS
                        no_records_found = 1
                        OTHERS           = 2.
              IF sy-subrc <> 0 .
              ENDIF .
    Fill PO Header
              i_bpoh-comp_code   = i_ekko-bukrs .
              i_bpoh-doc_type    = i_ekko-bsart .
              i_bpoh-vendor      = i_ekko-lifnr .
              i_bpoh-langu       = i_ekko-spras .
              i_bpoh-pmnttrms    = i_ekko-zterm .
              i_bpoh-purch_org   = i_ekko-ekorg .
              i_bpoh-pur_group   = i_ekko-ekgrp .
              i_bpoh-currency    = i_ekko-waers .
              i_bpoh-agreement   = i_ekko-konnr .
              i_bpoh-incoterms1  = i_ekko-inco1 .
              i_bpoh-incoterms2  = i_ekko-inco2 .
    Fill PO update indicator 'X'
              i_bpohx-comp_code  = c_char_x .
              i_bpohx-doc_type   = c_char_x .
              i_bpohx-vendor     = c_char_x .
              i_bpohx-langu      = c_char_x .
              i_bpohx-pmnttrms   = c_char_x .
              i_bpohx-purch_org  = c_char_x .
              i_bpohx-pur_group  = c_char_x .
              i_bpohx-currency   = c_char_x .
              i_bpohx-agreement  = c_char_x .
              i_bpohx-incoterms1 = c_char_x .
              i_bpohx-incoterms2 = c_char_x .
              CALL FUNCTION 'ME_EKPO_SINGLE_READ'
                   EXPORTING
                        pi_ebeln         = i_ebeln
                        pi_ebelp         = i_ebelp
                   IMPORTING
                        po_ekpo          = i_ekpo
                   EXCEPTIONS
                        no_records_found = 1
                        OTHERS           = 2.
              IF sy-subrc <> 0 .
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
              ENDIF .
    Fill PO Item
              i_wa_bpoi-po_item    = i_ekpo-ebelp .
              i_wa_bpoi-material   = i_ekpo-matnr .
              i_wa_bpoi-plant      = i_ekpo-werks .
              i_wa_bpoi-stge_loc   = i_ekpo-lgort .
              i_wa_bpoi-quantity   = wa_order_split_create-qty_acptd .
              i_wa_bpoi-po_unit    = i_ekpo-meins .
              i_wa_bpoi-tax_code   = i_ekpo-mwskz .
              i_wa_bpoi-val_type   = i_ekpo-bwtar .
              i_wa_bpoi-item_cat   = i_ekpo-pstyp .
              i_wa_bpoi-acctasscat = i_ekpo-knttp .
              i_wa_bpoi-agreement  = i_ekpo-konnr .
              i_wa_bpoi-agmt_item  = i_ekpo-ktpnr .
              APPEND i_wa_bpoi TO i_bpoi .
    Fill PO Item update indicator 'X'
              i_wa_bpoix-po_item    = i_ekpo-ebelp .
              i_wa_bpoix-po_itemx   = c_char_x .
              i_wa_bpoix-material   = c_char_x .
              i_wa_bpoix-plant      = c_char_x .
              i_wa_bpoix-stge_loc   = c_char_x .
              i_wa_bpoix-quantity   = c_char_x .
              i_wa_bpoix-po_unit    = c_char_x .
              i_wa_bpoix-tax_code   = c_char_x .
              i_wa_bpoix-val_type   = c_char_x .
              i_wa_bpoix-item_cat   = c_char_x .
              i_wa_bpoix-acctasscat = c_char_x .
              i_wa_bpoix-agreement  = c_char_x .
              i_wa_bpoix-agmt_item  = c_char_x .
              APPEND i_wa_bpoix TO i_bpoix .
    Fill PO Item Schedule
              i_wa_bpos-po_item       = i_ekpo-ebelp .
              i_wa_bpos-sched_line    = '0001' .
              i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
              i_wa_bpos-quantity      = wa_order_split_create-qty_acptd .
              APPEND i_wa_bpos TO i_bpos .
    Fill PO Item schedule update indicator 'X'
              i_wa_bposx-po_item       = i_ekpo-ebelp .
              i_wa_bposx-sched_line    = '0001' .
              i_wa_bposx-delivery_date = c_char_x .
              i_wa_bposx-quantity      = c_char_x .
              APPEND i_wa_bposx TO i_bposx .
              CLEAR: i_pargr .
              SELECT SINGLE pargr
                INTO i_pargr
                FROM t161
               WHERE bstyp = i_ekko-bstyp
                 AND bsart = i_ekko-bsart .
              CLEAR i_ekpa[].
              CALL FUNCTION 'MM_READ_PARTNERS'
                   EXPORTING
                        application = c_char_p
                        ebeln       = i_ebeln
                        bstyp       = i_ekko-bstyp
                        pargr       = i_pargr
                   TABLES
                        x_ekpa      = <b>i_ekpa[].</b>
              LOOP AT i_ekpa INTO i_wa_ekpa .
                i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
                i_wa_bpop-langu = sy-langu .
                IF NOT i_wa_ekpa-lifn2 IS INITIAL .
                  i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
                ELSE .
                  i_wa_bpop-buspartno = i_wa_ekpa-parnr .
                ENDIF .
                APPEND i_wa_bpop TO i_bpop .
                CLEAR: i_wa_ekpa, i_wa_bpop .
              ENDLOOP .
              CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
              CALL FUNCTION 'BAPI_PO_CREATE1'
                   EXPORTING
                        poheader         = i_bpoh
                        poheaderx        = i_bpohx
                   IMPORTING
                        exppurchaseorder = i_new_ebeln
                   TABLES
                        return           = i_bapiret2
                    <b>    poitem           = i_bpoi[]
                        poitemx          = i_bpoix[]
                        poschedule       = i_bpos[]
                        poschedulex      = i_bposx[].</b>
    it should be only i_bpoi, i_bpoix, i_bpos, i_bposx but not  i_bpoi[], i_bpoix[], i_bpos[], i_bposx[].
    CHange the code as follows:
    DATA: i_insert,
            i_create_order,
            i_cycle     TYPE cycle,
            i_qty_acpt  TYPE dzmeng,
            i_dly_date  TYPE vbak-vdatu,
            i_item      TYPE roijnomiio .
      DATA: i_order TYPE symsgv,
            i_return TYPE swd_return .
      DATA: i_vbak      TYPE vbak,
            i_vbap      TYPE vbap,
            i_ekko      TYPE ekko,
            i_ekpo      TYPE ekpo,
            i_bsoh      TYPE bapisdhd1,
            i_bsohx     TYPE bapisdhd1x,
            i_bpoh      TYPE bapimepoheader,
            i_bpohx     TYPE bapimepoheaderx,
            i_vbeln     TYPE vbeln_va,
            i_posnr     TYPE posnr_va,
            i_contr     TYPE vbeln_va,
            i_conit     TYPE posnr_va,
            i_ebeln     TYPE ebeln,
            i_ebelp     TYPE ebelp,
            i_pargr     TYPE pargr,
            i_thead     TYPE thead,
            i_line      TYPE tline,
            i_note      TYPE txw_note,
            i_new_vbeln TYPE vbeln_va,
            i_new_ebeln TYPE ebeln,
            i_wa_bsoi   TYPE bapisditm,
            i_wa_bsoix  TYPE bapisditmx,
            i_wa_bsop   TYPE bapiparnr,
            i_wa_bsos   TYPE bapischdl,
            i_wa_bsosx  TYPE bapischdlx,
            i_wa_vbpa   TYPE vbpa,
            i_wa_vbkd   TYPE vbkd,
            i_wa_bpoi   TYPE bapimepoitem,
            i_wa_bpoix  TYPE bapimepoitemx,
            i_wa_bpos   TYPE bapimeposchedule,
            i_wa_bposx  TYPE bapimeposchedulx,
            i_wa_bpop   TYPE bapiekkop,
            i_wa_ekpa   TYPE ekpa,
            i_message   TYPE char72,
            i_bapiretn  TYPE bapiret2,
            i_bapiret2  TYPE TABLE OF bapiret2 INITIAL SIZE 1,
            i_vbpa      TYPE TABLE OF vbpa INITIAL SIZE 1,
            i_vbkd      TYPE TABLE OF vbkd INITIAL SIZE 1,
            i_ekpa      TYPE TABLE OF ekpa INITIAL SIZE 1,
            i_bsoi      TYPE TABLE OF bapisditm INITIAL SIZE 1,
            i_bsoix     TYPE TABLE OF bapisditmx INITIAL SIZE 1,
            i_bsos      TYPE TABLE OF bapischdl INITIAL SIZE 1,
            i_bsosx     TYPE TABLE OF bapischdlx INITIAL SIZE 1,
            i_bsop      TYPE TABLE OF bapiparnr INITIAL SIZE 1,
            i_bpoi      TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
            i_bpoix     TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
            i_bpos      TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
            i_bposx     TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
            i_bpop      TYPE TABLE OF bapiekkop INITIAL SIZE 1,
            i_text_tab  TYPE TABLE OF tline INITIAL SIZE 1,
            i_line_tab  TYPE TABLE OF tline INITIAL SIZE 1,
            i_txw_note  TYPE TABLE OF txw_note INITIAL SIZE 1,
            i_oij_el_doc_mot TYPE oij_el_doc_mot .
      CONSTANTS: c_char_c VALUE 'C',
                 c_char_e VALUE 'E',
                 c_char_p VALUE 'P',
                 c_char_g VALUE 'G',
                 c_char_i VALUE 'I',
                 c_char_s VALUE 'S',
                 c_char_x VALUE 'X',
                 c_zsw(3) VALUE 'ZSW',
                 c_nomit_stat(4) VALUE 'ZDNY' .
      DATA : lv_nomtk_split        TYPE oij_nomtk.
      DATA : i_order_split_create  TYPE TABLE OF zsws_order_split.
      DATA : wa_order_split_create TYPE zsws_order_split.
      LOOP AT i_order_split_create INTO wa_order_split_create.
        IF NOT i_create_order IS INITIAL .
          CLEAR: i_create_order .
              MOVE: wa_order_split_create-docnr  TO i_ebeln,
                    wa_order_split_create-docitm TO i_ebelp .
              CALL FUNCTION 'ME_EKKO_SINGLE_READ'
                   EXPORTING
                        pi_ebeln         = i_ebeln
                   IMPORTING
                        po_ekko          = i_ekko
                   EXCEPTIONS
                        no_records_found = 1
                        OTHERS           = 2.
              IF sy-subrc <> 0 .
              ENDIF .
    Fill PO Header
              i_bpoh-comp_code   = i_ekko-bukrs .
              i_bpoh-doc_type    = i_ekko-bsart .
              i_bpoh-vendor      = i_ekko-lifnr .
              i_bpoh-langu       = i_ekko-spras .
              i_bpoh-pmnttrms    = i_ekko-zterm .
              i_bpoh-purch_org   = i_ekko-ekorg .
              i_bpoh-pur_group   = i_ekko-ekgrp .
              i_bpoh-currency    = i_ekko-waers .
              i_bpoh-agreement   = i_ekko-konnr .
              i_bpoh-incoterms1  = i_ekko-inco1 .
              i_bpoh-incoterms2  = i_ekko-inco2 .
    Fill PO update indicator 'X'
              i_bpohx-comp_code  = c_char_x .
              i_bpohx-doc_type   = c_char_x .
              i_bpohx-vendor     = c_char_x .
              i_bpohx-langu      = c_char_x .
              i_bpohx-pmnttrms   = c_char_x .
              i_bpohx-purch_org  = c_char_x .
              i_bpohx-pur_group  = c_char_x .
              i_bpohx-currency   = c_char_x .
              i_bpohx-agreement  = c_char_x .
              i_bpohx-incoterms1 = c_char_x .
              i_bpohx-incoterms2 = c_char_x .
              CALL FUNCTION 'ME_EKPO_SINGLE_READ'
                   EXPORTING
                        pi_ebeln         = i_ebeln
                        pi_ebelp         = i_ebelp
                   IMPORTING
                        po_ekpo          = i_ekpo
                   EXCEPTIONS
                        no_records_found = 1
                        OTHERS           = 2.
              IF sy-subrc <> 0 .
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
              ENDIF .
    Fill PO Item
              i_wa_bpoi-po_item    = i_ekpo-ebelp .
              i_wa_bpoi-material   = i_ekpo-matnr .
              i_wa_bpoi-plant      = i_ekpo-werks .
              i_wa_bpoi-stge_loc   = i_ekpo-lgort .
              i_wa_bpoi-quantity   = wa_order_split_create-qty_acptd .
              i_wa_bpoi-po_unit    = i_ekpo-meins .
              i_wa_bpoi-tax_code   = i_ekpo-mwskz .
              i_wa_bpoi-val_type   = i_ekpo-bwtar .
              i_wa_bpoi-item_cat   = i_ekpo-pstyp .
              i_wa_bpoi-acctasscat = i_ekpo-knttp .
              i_wa_bpoi-agreement  = i_ekpo-konnr .
              i_wa_bpoi-agmt_item  = i_ekpo-ktpnr .
              APPEND i_wa_bpoi TO i_bpoi .
    Fill PO Item update indicator 'X'
              i_wa_bpoix-po_item    = i_ekpo-ebelp .
              i_wa_bpoix-po_itemx   = c_char_x .
              i_wa_bpoix-material   = c_char_x .
              i_wa_bpoix-plant      = c_char_x .
              i_wa_bpoix-stge_loc   = c_char_x .
              i_wa_bpoix-quantity   = c_char_x .
              i_wa_bpoix-po_unit    = c_char_x .
              i_wa_bpoix-tax_code   = c_char_x .
              i_wa_bpoix-val_type   = c_char_x .
              i_wa_bpoix-item_cat   = c_char_x .
              i_wa_bpoix-acctasscat = c_char_x .
              i_wa_bpoix-agreement  = c_char_x .
              i_wa_bpoix-agmt_item  = c_char_x .
              APPEND i_wa_bpoix TO i_bpoix .
    Fill PO Item Schedule
              i_wa_bpos-po_item       = i_ekpo-ebelp .
              i_wa_bpos-sched_line    = '0001' .
              i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
              i_wa_bpos-quantity      = wa_order_split_create-qty_acptd .
              APPEND i_wa_bpos TO i_bpos .
    Fill PO Item schedule update indicator 'X'
              i_wa_bposx-po_item       = i_ekpo-ebelp .
              i_wa_bposx-sched_line    = '0001' .
              i_wa_bposx-delivery_date = c_char_x .
              i_wa_bposx-quantity      = c_char_x .
              APPEND i_wa_bposx TO i_bposx .
              CLEAR: i_pargr .
              SELECT SINGLE pargr
                INTO i_pargr
                FROM t161
               WHERE bstyp = i_ekko-bstyp
                 AND bsart = i_ekko-bsart .
              CLEAR i_ekpa[].
              CALL FUNCTION 'MM_READ_PARTNERS'
                   EXPORTING
                        application = c_char_p
                        ebeln       = i_ebeln
                        bstyp       = i_ekko-bstyp
                        pargr       = i_pargr
                   TABLES
                        x_ekpa      = i_ekpa.
              LOOP AT i_ekpa INTO i_wa_ekpa .
                i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
                i_wa_bpop-langu = sy-langu .
                IF NOT i_wa_ekpa-lifn2 IS INITIAL .
                  i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
                ELSE .
                  i_wa_bpop-buspartno = i_wa_ekpa-parnr .
                ENDIF .
                APPEND i_wa_bpop TO i_bpop .
                CLEAR: i_wa_ekpa, i_wa_bpop .
              ENDLOOP .
              CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
              CALL FUNCTION 'BAPI_PO_CREATE1'
                   EXPORTING
                        poheader         = i_bpoh
                        poheaderx        = i_bpohx
                   IMPORTING
                        exppurchaseorder = i_new_ebeln
                   TABLES
                        return           = i_bapiret2
                        poitem           = i_bpoi
                        poitemx          = i_bpoix
                        poschedule       = i_bpos
                        poschedulex      = i_bposx.
              i_order = i_new_ebeln .
              SHIFT i_order LEFT DELETING LEADING '0' .
              i_return-errortype = c_char_i .
              i_return-workarea  = c_zsw .
              i_return-message   = '064' .
              i_return-variable1 = i_order .
            loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .
            append i_bapiretn to t_bapi_return .
          endloop .
          if t_bapi_return[] is initial .
             i_create_order = c_char_x .
               CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'
                   EXPORTING
                        act_return = i_return. "Popup with new PO no.
          ENDCASE .                                     " Docind
        ENDIF .
      ENDLOOP.

  • Error 'Program not registered' while testing RFC

    Hi
    I have created a RFC with type T. When I am testing the same through SM59, I am getting error:
    Logon     Connection Error
    Error Details     Error when opening an RFC connection
    Error Details     ERROR: program <program name>not registered
    Error Details     LOCATION: SAP-Gateway on host xxxxxx / sapgw01
    Error Details     DETAIL: TP <program name> not registered
    Error Details     COMPONENT: SAP-Gateway
    Error Details     COUNTER: 6268
    Error Details     MODULE: gwr3cpic.c
    Error Details     LINE: 1694
    Error Details     RETURN CODE: 679
    Error Details     SUBRC: 0
    Error Details     RELEASE: 700
    Error Details     TIME: Tue Jan 27 00:56:55 2009
    Error Details     VERSION: 2
    Can anybody help me in this?
    Thanks in advance

    Something helpful related to this
    The program in the above error should be registered in the gateway for this connection test to complete successfully. The server program rfcexec is responsible for its registration on the gateway.
    To register the program login into the OS level as sudo su - <sid>adm and execute the following command.
    rfcexec u2013g<program id> -a<gateway host name> -x<gateway service>
    rfcexec is the server program name, the <program id> can be obtained from SM59, it is case sensitive and should match with the entry in SM59. The <gateway host name> and <gateway service> can be obtained from the transaction SMGW. When this command is executed it goes to a hanging loop.
    The connection will fail once this command is terminated or the user executing this command logs off
    To avoid this, instead of using the above mentioned command an entry should be made in the file saprfc.ini
    To do this, execute the following command
    sudo su - <sid>adm
    rfcexec u2013D<destination name>
    <destination name> is the RFC destination name in SM59
    So now we are done with registering the server program, but how do we check it is registered, once a server program is registered it is displayed in the Logged on clients in SMGW.
    In transaction SMGW choose GOTO-> Logged on clients. There should be an entry for the server program in the screen that is displayed with system type Registered_TP (which indicates that the program is registered)

  • Help with error program not registered CPI-C error CM_ALLOCATE_FAILURE_RETR

    I have the following connection error in SM59 ...
    Connection error        program ZCCCOM_NZ_PMH01 not registered / CPI-C error CM_ALLOCATE_FAILURE_RETRY. 
    I have deleted and re-registered the program but still no connection. Any ideas as to what/where I am going wrong would be fantastic!!
    RFC Destin = CCCOM
    Type = T
    Gateway Host = ntchsapqas
    Gateway service = sapgw00
    ERROR                program ZCCCOM_NZ_PMH01 not registered      
    LOCATION             SAP-Gateway on host ntchsapqas / sapgw00    
    DETAIL               TP ZCCCOM_NZ_PMH01 not registered           
    COMPONENT            SAP-Gateway                                 
    COUNTER              19364                                       
    MODULE               gwr3cpic.c                                  
    LINE                 1593                                        
    RETURN CODE          679                                         
    SUBRC                    0                                       
    RELEASE              46D                                         
    TIME                 Tue Jun 10 14:47:28 2008                    
    VERSION              2

    Something helpful related to this
    The program in the above error should be registered in the gateway for this connection test to complete successfully. The server program rfcexec is responsible for its registration on the gateway.
    To register the program login into the OS level as sudo su - <sid>adm and execute the following command.
    rfcexec u2013g<program id> -a<gateway host name> -x<gateway service>
    rfcexec is the server program name, the <program id> can be obtained from SM59, it is case sensitive and should match with the entry in SM59. The <gateway host name> and <gateway service> can be obtained from the transaction SMGW. When this command is executed it goes to a hanging loop.
    The connection will fail once this command is terminated or the user executing this command logs off
    To avoid this, instead of using the above mentioned command an entry should be made in the file saprfc.ini
    To do this, execute the following command
    sudo su - <sid>adm
    rfcexec u2013D<destination name>
    <destination name> is the RFC destination name in SM59
    So now we are done with registering the server program, but how do we check it is registered, once a server program is registered it is displayed in the Logged on clients in SMGW.
    In transaction SMGW choose GOTO-> Logged on clients. There should be an entry for the server program in the screen that is displayed with system type Registered_TP (which indicates that the program is registered)

Maybe you are looking for

  • Maximum Cells exceeded Error

    Hi Guys, guide me pls// i am getting an error while opening a report.. like Maximum cells exceeded error... how i can i over come this??

  • Variant Issue in Abap Program

    I came across this strange issue with Variants: Please let me know if anyone has come cross this issue. Issue:   I select a variant for a Zreport which has email address in the selection screen. Now i select another variant in which there is no email

  • Master slide shows up in presentation

    I am new to Keynote, so maybe this is jusy a misunderstanding of how master slides are supposed to work.  I put all the background elements on my master slide.  I applied the master to all 5 of my presentation slides.  Each slide essentially adds ano

  • Reading a fle format thats part ascii and part binary

    Hey I'm trying to write a importer for the PLY filke format. That file format starts of with a header in ascii and then continues with either the data in ascii or in binary. When the data is in ascii I have no problem reading the file but when the da

  • AJAX - JavaScript - HTML

    Hi all, I am currently trying to find editors or IDEs for AJAX,HTML,Java. I am currently using Eclipse for my JAVA projects. Can you please suggest me which editor do you prefer to write html,javascript, or AJAX. I am not really interested in visual