GRPO query

Hai
Below this QUERY  i neeed to ADD U_NAME field in OUSR TABLE. I will ADD This Field But When I will run the QUERY ERROR has to come
How do i will ADD ??
SELECT DISTINCT(T0.[DocNum]) AS 'GRN NO', T0.[DocDate] AS 'GRN DATE', T0.[NumAtCard] as 'Ref. No',T0.[CardName] AS 'NAME OF THE PARTY', T1.[ItemCode] AS 'PART NO', T1.[Dscription] AS 'PART DESCRIPTION', T1.[Quantity], T1.[Price], T1.[LineTotal] AS 'BASE AMOUNT',
T1.[LineTotal]+t1.[VatSum] as'TOTAL', T0.[DocStatus], T0.[UserSign] ,T6.[U_NAME]
FROM OPDN T0  INNER JOIN PDN1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OITM T4 ON T1. ItemCode = T4. ItemCode
INNER JOIN OITB  T5  ON T4.ItmsGrpCod = T5.ItmsGrpCod 
INNER JOIN OCRD T3 ON T3.CardCode=T0.CardCode 
INNER JOIN OUSR T6 ON T6.USER_CODE=T0.UserSign 
WHERE  T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1]   AND  t4.ItmsGrpCod  <>'111' AND (T5.[ItmsGrpNam]='[%3]' OR '[%3]'=' ') AND (T3.[CardName]='[%4]' OR '[%4]'=' ' ) AND T1.[BaseType]<>'21' AND (T0.[DocStatus]='[%5]' OR '[%5]'=' ' )
ORDER BY T0.[DocDate], T0.[DocNum]

hi,
i have added the user from OUSR table. check this SQL script and add your conditions accordingly
SELECT     T1.DocNum, T1.DocDate, T1.NumAtCard, T1.CardName, T2.ItemCode, T2.Dscription, T2.Quantity, T2.Price, T2.LineTotal, T2.LineTotal + T2.VatSum AS 'Total',
                      T1.DocStatus, T1.UserSign, T5.U_NAME
FROM         OCRD T0 INNER JOIN
                      OPDN  T1 INNER JOIN
                      PDN1  T2 ON T1.DocEntry = T2.DocEntry ON T0.CardCode = T1.CardCode INNER JOIN
                      OITB  T3 INNER JOIN
                      OITM  T4 ON T3.ItmsGrpCod = T4.ItmsGrpCod ON T2.ItemCode = T4.ItemCode INNER JOIN
                      OUSR  T5 ON T1.UserSign = T5.USERID
WHERE     (T4.ItmsGrpCod = 111)
GROUP BY T1.DocNum, T1.DocDate, T1.NumAtCard, T1.CardName, T2.ItemCode, T2.Dscription, T2.Quantity, T2.Price, T2.LineTotal, T2.LineTotal + T2.VatSum, T1.DocStatus,
                      T1.UserSign, T5.U_NAME
HAVING      (T1.DocDate BETWEEN CONVERT(DATETIME, '2011-12-01 00:00:00', 102) AND CONVERT(DATETIME, '2011-12-12 00:00:00', 102))
regards,
Fidel

Similar Messages

  • GRPO QUERY WITH FREIGHT

    Dear All
    When i run the following GRPO query (with freight) it shows me 2 lines when there is multiple freight lines in the freight screen. Can anybody guide where the changes is to be made in this query.
    SELECT T0.[DocNum] as 'GRPO Number',T0.[DocDate] as 'GRPO Date', t0.DocDueDate as 'Inspected Date',T0.[CardName]  as 'Vendor Name', T0.[Project] as 'JOB Number', T0.U_PRNo as 'PRS Number',T0.U_BILL as 'Bill Number',T0.U_DC as 'DC Number',t0.u_doc_ref as 'Document Reference 1',T1.[BaseRef] as 'PO Number',sum (t1.linetotal) as 'Basic', T2.LineTotal AS 'Freight & P&F',
    SUM(T3.TAXSUM) AS 'BEDAmt',
    sum(t4.taxsum) as 'ECessAmt',
    sum(t5.taxsum) as 'HECess Amt',
    sum(t6.taxsum) as 'BED on Freight',
    sum(t7.taxsum) as 'CESS on Freight',
    sum(t8.taxsum) as 'HECess on Freight',
    sum(t9.taxsum) as 'VAT ON Freight Amt',
    sum(t10.taxsum) as 'CST ON Freight Amt',
    sum(t11.taxsum) as 'VAT Amt',
    sum(t12.taxsum) as 'VAT along with Excise Amt',
    sum(t13.taxsum) as 'CST Amt',
    sum(t14.taxsum) as 'CST along with Excise Amt',
    sum(t15.taxsum) as 'AED Amt',
    T0.Doctotal as 'Total Amount of GRPO'
    FROM OPDN T0 INNER JOIN PDN1  T1 ON T0.DocEntry = T1.DocEntry
    LEFT OUTER JOIN PDN3 T2 ON T2.DocEntry = T1.DocEntry
    LEFT OUTER JOIN PDN4 T3 ON T3.DocEntry=T0.DocEntry and T0.DocEntry=T3.DocEntry AND T3.staType=-90 AND T1.LineNum=T3.LineNum
    LEFT OUTER JOIN PDN4 T4 ON T4.DocEntry=T0.DocEntry and T0.DocEntry=T4.DocEntry AND T4.staType=-60 AND T1.LineNum=T4.LineNum
    LEFT OUTER JOIN PDN4 T5 ON T5.DocEntry=T0.DocEntry and T0.DocEntry=T5.DocEntry AND T5.staType=7 AND T1.LineNum=T5.LineNum
    LEFT OUTER JOIN PDN4 T6 ON T6.DocEntry=T0.DocEntry and T0.DocEntry=T6.DocEntry AND T6.staType=22 AND T1.LineNum=T6.LineNum
    LEFT OUTER JOIN PDN4 T7 ON T7.DocEntry=T0.DocEntry and T0.DocEntry=T7.DocEntry AND T7.staType=23 AND T1.LineNum=T7.LineNum
    LEFT OUTER JOIN PDN4 T8 ON T8.DocEntry=T0.DocEntry and T0.DocEntry=T8.DocEntry AND T8.staType=24 AND T1.LineNum=T8.LineNum
    LEFT OUTER JOIN PDN4 T9 ON T9.DocEntry=T0.DocEntry and T0.DocEntry=T9.DocEntry AND T9.staType=25 AND T1.LineNum=T9.LineNum
    LEFT OUTER JOIN PDN4 T10 ON T10.DocEntry=T0.DocEntry and T0.DocEntry=T10.DocEntry AND T10.staType=26 AND T1.LineNum=T10.LineNum
    LEFT OUTER JOIN PDN4 T11 ON T11.DocEntry=T0.DocEntry and T0.DocEntry=T11.DocEntry AND T11.staType=1 AND T1.LineNum=T11.LineNum
    LEFT OUTER JOIN PDN4 T12 ON T12.DocEntry=T0.DocEntry and T0.DocEntry=T12.DocEntry AND T12.staType=14 AND T1.LineNum=T12.LineNum
    LEFT OUTER JOIN PDN4 T13 ON T13.DocEntry=T0.DocEntry and T0.DocEntry=T13.DocEntry AND T13.staType=4 AND T1.LineNum=T13.LineNum
    LEFT OUTER JOIN PDN4 T14 ON T14.DocEntry=T0.DocEntry and T0.DocEntry=T14.DocEntry AND T14.staType=13 AND T1.LineNum=T14.LineNum
    LEFT OUTER JOIN PDN4 T15 ON T15.DocEntry=T0.DocEntry and T0.DocEntry=T15.DocEntry AND T15.staType=-80 AND T1.LineNum=T15.LineNum
    WHERE T0.[Project] between '[%0]' and '[%1]' or T0.[DocDate] between '[%2]' and '[%3]'
    GROUP BY T0.[DocDate], T0.[DocNum],T0.[CardName], T0.[Project], T1.[BaseRef], T2.[LineTotal],T0.U_PRNo,t0.DocDueDate,T0.U_BILL,T0.U_DC,t0.U_DOC_REF,T0.Doctotal
    REGARDS
    KARTHIK

    Hello Karthik,
    Try This
    declare @todate as datetime
    declare @enddate as datetime
    SELECT @todate= /*min(T0.DocDate) FROM OINM T0 WHERE T0.DocDate=*/ '[%0]'
    SELECT @enddate= /*max(T0.DocDate) FROM OINM T0 WHERE T0.DocDate=*/'[%1]'
    select DISTINCT a.Docnum as "GRPO No" ,a.docdate AS "GRPO Date" ,
    a.cardname as "Supplier Name" ,a.DocDueDate ,
    (select sum(LineTotal) from PDN1 where docentry = a.docentry)as "Basic Value" ,
    (select sum(LineTotal) from PDN3 where docentry = a.docentry)as "Freight & P&F Am" ,a.DiscSum as 'Discount',
    (Select sum(taxsum) FROM PDN4 where docentry = a.docentry and statype=-90) as "BED" ,
    (Select SUM(taxsum) FROM PDN4 where docentry = a.docentry and statype=-60) as "Cess" ,
    (Select SUM(taxsum) FROM PDN4 where docentry = a.docentry and statype=7) as "HeCess" ,
    (Select SUM(taxsum) FROM PDN4 where docentry = a.docentry and statype=-80) as "AED" ,
    (Select SUM(taxsum) FROM PDN4 where docentry = a.docentry and statype=13) as "CST along with Excise Amt" ,
    (Select SUM(taxsum) FROM PDN4 where docentry = a.docentry and statype=4) as "CST" ,
    (Select SUM(taxsum) FROM PDN4 where docentry = a.docentry and statype=1) as "VAT" ,
    (Select SUM(taxsum) FROM PDN4 where docentry = a.docentry and statype=14) as "VAT along with Excise Amt" ,
    (Select SUM(taxsum) FROM PDN4 where docentry = a.docentry and statype=26) as "CST on Freight Amt" ,
    (Select SUM(taxsum) FROM PDN4 where docentry = a.docentry and statype=25) as "VAT on Freight Amt" ,
    (Select SUM(taxsum) FROM PDN4 where docentry = a.docentry and statype=22) as "BED on Freight Amt" ,
    (Select SUM(taxsum) FROM PDN4 where docentry = a.docentry and statype=23) as "CESS on Freight Amt" ,
    (Select SUM(taxsum) FROM PDN4 where docentry = a.docentry and statype=24) as "HECESS on Freight Amt" ,
    A.DocTotal as "Net Value"
    FROM OPDN A left OUTER JOIN PDN3 B ON A.DOCENTRY = B.DOCENTRY left OUTER JOIN PDN4 C
    ON A.DOCENTRY = C.DOCENTRY left outer join PDN3 h on A.DocEntry = h.DocEntry left outer join
    PDN1 d on a.docentry = d.docentry left outer join crd7 e on a.cardcode = e.cardcode Left Outer Join
    oitm g On d.ItemCode=g.ItemCode left outer join ochp f on f.absentry= g.chapterid where a.Docdate >=@todate
    and a.Docdate <=@enddate and g.itemcode=d.itemcode ORDER BY A.DOCNUM
    Regards:
    Balaji.S

  • How to join GRPO with AP invoice thru query ?

    hi all,
    How to join GRPO with AP invoice in sql query ?
    Jeyakanthan

    Hi Jeyakanthan
    Are you using query in SAP Business One or outside the system? If you select the tables in SAP Business One as OPCH and OPDN then no inner join will appear, as the links sit on the line level. You will need PCH1 and PDN1. The link can be found in both directions, but bear in mind that 1 AP Invoice could be based on more than 1 Goods Receipt PO. For this reason the best approach is to start at the AP Invoice line level and use the BaseType and BaseRef fields to view which lines were pulled from which Goods Receipt PO's.
    Kind regards
    Peter Juby

  • Goods Return - GRPO - PO QUERY

    Friends
    The following is the requirement for one of my client:-
    PROJECT CODE - GOODS RETURN DATE - GOODS RETURN # - GRPO # - GRPO DATE - PO # - po DATE - VENDOR NAME - BASIC - FREIGHT - EXCISE - VAT - CST - G/R DOC TOTAL
    I need the above for Document Level
    Would appreciate if someone can help me on this.
    regards
    KARTHIK

    GORDON
    Following is the query. Everything comes right. I did not get correct Tax Details. Can u pls guide me  where i had made errors in the query
    Select  T1.Project AS 'Job Number', T0.DocDate as [Date of Goods Return],T0.DocNum As [Good Return Number],T2.DocNum as [GRPO Number],
    T2.DocDate as [GRPO Date],T4.DocNum as [PO Number],T4.DocDate as [PO Date],T0.CardName as 'Vendor Name',T0.DOCTOTAL,
    (t0.DOCTOTAL) - (T0.VATSUM) - (T0.TotalExpns) as 'Basic',
    t0.totalexpns as 'Freight  & P&F Amt',
    Sum(T5.TaxSum) as 'BEDAmt',
    Sum(T6.TaxSum) as 'ECeSSAmt',
    Sum(T7.TaxSum) as 'HECess Amt',
    Sum(T8.TaxSum) as 'AED Amt',
    Sum(T9.TaxSum) as 'CST along with Excise Amt',
    Sum(T10.TaxSum) as 'CST Amt',
    Sum(T11.TaxSum) as 'VAT Amt',
    Sum(T12.TaxSum) as 'VAT along with Excise Amt',
    SUM(T13.TaxSum) as 'CST on Freight Amt',
    Sum(T14.TaxSum) as 'VAT on Freight Amt',
    Sum(T15.TaxSum) as 'BED on Freight',
    Sum(T16.TaxSum) as 'CESS on Freight',
    Sum(T17.TaxSum) as 'HECESS on Freight'       
    FROM ORPD T0 Inner Join RPD1 T1 on T0.DocEntry=T1.DocEntry
              Inner Join OPDN T2 on T1.BaseEntry=T2.DocEntry
              Inner Join PDN1 T3 on T2.DocEntry=T3.DOCENTRY
              Inner Join OPOR T4 on T4.DocEntry = T3.BaseEntry
    LEFT OUTER JOIN rpd4 T5 ON T5.DocEntry=T0.DocEntry and T0.DocEntry=T5.DocEntry AND T5.staType=-90 AND T1.LineNum=T5.LineNum
                      LEFT OUTER JOIN RPD4 T6 ON T6.DocEntry=T0.DocEntry and T0.DocEntry=T6.DocEntry AND T6.staType=-60 AND T1.LineNum=T6.LineNum
                      LEFT OUTER JOIN RPD4 T7 ON T7.DocEntry=T0.DocEntry and T0.DocEntry=T7.DocEntry AND T7.staType=7 AND T1.LineNum=T7.LineNum
                      LEFT OUTER JOIN RPD4 T8 ON T8.DocEntry=T0.DocEntry and T0.DocEntry=T8.DocEntry AND T8.staType=-80 AND T1.LineNum=T8.LineNum
                      LEFT OUTER JOIN RPD4 T9 ON T9.DocEntry=T0.DocEntry and T0.DocEntry=T9.DocEntry AND T9.staType=13 AND T1.LineNum=T9.LineNum
                      LEFT OUTER JOIN RPD4 T10 ON T10.DocEntry=T0.DocEntry and T0.DocEntry=T10.DocEntry AND T10.staType=4 AND T1.LineNum=T10.LineNum
                      LEFT OUTER JOIN RPD4 T11 ON T11.DocEntry=T0.DocEntry and T0.DocEntry=T11.DocEntry AND T11.staType=1 AND T1.LineNum=T11.LineNum
    LEFT OUTER JOIN RPD4 T12 ON T12.DocEntry=T0.DocEntry and T0.DocEntry=T12.DocEntry AND T12.staType=14 AND T1.LineNum=T12.LineNum
    LEFT OUTER JOIN RPD4 T13 ON T13.DocEntry=T0.DocEntry and T0.DocEntry=T13.DocEntry AND T13.staType=26 AND T1.LineNum=T13.LineNum
    LEFT OUTER JOIN RPD4 T14 ON T14.DocEntry=T0.DocEntry and T0.DocEntry=T14.DocEntry AND T14.staType=25 AND T1.LineNum=T14.LineNum
    LEFT OUTER JOIN RPD4 T15 ON T15.DocEntry=T0.DocEntry and T0.DocEntry=T15.DocEntry AND T15.staType=22 AND T1.LineNum=T15.LineNum
    LEFT OUTER JOIN RPD4 T16 ON T16.DocEntry=T0.DocEntry and T0.DocEntry=T16.DocEntry AND T16.staType=23 AND T1.LineNum=T16.LineNum
    LEFT OUTER JOIN POR4 T17 ON T17.DocEntry=T0.DocEntry and T0.DocEntry=T17.DocEntry AND T17.staType=24 AND T1.LineNum=T17.LineNum
    WHERE T0.DocDate >='[%0]' AND  T0.DocDate <='[%1]' AND T0.DocType = 'I'
    GROUP BY T1.Project,T0.DocDate,T0.DocNum,T2.DocNum,T2.DocDate,T4.DocNum,T4.DocDate,T0.CardName,t0.DOCTOTAL, T0.VATSUM,T0.TotalExpns
    regards
    KARTHIK

  • Wants Combain query of GRPO -Return- AP Invoice

    Dear All,
    Pls. help me for this query.
    A) GRPO :
    Vendor code
    Vendor name
    Doc Num
    Doc status
    Posting date
    Total Before discount
    Tax
    Freight
    Total Payment Due
    B) IF GOODS RETURNS ARE DONE THEN:
    Doc Num
    Doc status
    Posting date
    Total Before discount
    Tax
    Freight
    Total Payment Due
    C) IF AFTER GRPO ,AP INVOICE DONE THEN:
    Doc Num
    Vendor referance Number.
    Doc status
    Posting date
    Total Before discount
    Tax
    Freight
    Total Payment Due
    (A) ,(B),(C) should in a single query.
    If possible pls. send me query.
    Regards.
    Mahesh.

    Try this one:
    SELECT DISTINCt T1.CARDCODE, T1.CARDNAME , T1.DOCNUM GRPO#,T1.DocStatus 'GRPO Status', T1.DOCDATE 'GRPO Date', T1.DocTotal 'GRPO Total', T3.DOCNUM Return#,T3.DocStatus 'Return Status', T3.DOCDATE 'Return Date', T3.DocTotal 'Return Total',T5.DOCNUM Invoice#,T5.DocStatus 'Invoice Status', T5.DOCDATE 'Invoice Date', (T5.DocTotal-T5.VatSum-T5.TotalExpns-T5.DiscSum) 'Total Before Discount', T5.VatSum 'Tax', T5.TotalExpns 'Freight', (T5.DocTotal - T5.PaidToDate) 'Total Payment Due'
    FROM DBO.PDN1 T0
    INNER JOIN DBO.OPDN T1 ON T1.DOCENTRY = T0.DOCENTRY
    LEFT JOIN DBO.RPD1 T2 ON T2.BASEENTRY = T1.DOCENTRY
    LEFT JOIN DBO.ORPD T3 ON T2.DOCENTRY = T3.DOCENTRY
    LEFT JOIN DBO.PCH1 T4 ON T4.BASEENTRY = T1.DOCENTRY
    LEFT JOIN DBO.OPCH T5 ON T5.DOCENTRY = T4.DOCENTRY
    WHERE T1.DOCNUM like '[%0\]%'
    Thanks,
    Gordon

  • Query For GRPO

    Hi all,
            i want a report for GRPO, the query that i have made is as mentioned below;
    Select Docnum as Num, U_Gateno as Gate ,Docdate as Date, CardName as Party, U_Billno as Bill,  DocDate as Date  from opdn
    Select Dscription as Item, Quantity as Qnty,unitMsr as Unit, Taxcode as vat from pdn1
    now apart from these, i want the "unit price" and the "total"  which are variables. Also can anyone please help me how to join these SQL to get a single row report?
    Thanks in advance,
    Joseph Antony

    Hi all,
    I;m using the following SQL and its working fine;
    Select T0.Docnum as Num,T0.U_Gateno as Gate ,T0.Docdate as Date, T0.CardName as Party,
    T0.U_Billno as Bill,
    T0.DocDate as Date,T1.Dscription as Item,T1.Quantity as Qnty,T1.unitMsr as Unit,T1.Price as Rate,
    T1.Linetotal as Amount, T1.Linevat as Vat,(T1.Linevat+T1.LineTotal)as Grand
    from OPDN T0 INNER JOIN PDN1 T1 ON T0.DocEntry = T1.DocEntry
    UNION ALL
    Select NULL as Num, NULL as Gate, NULL as Date, NULL as Party,
    NULL as Bill,
    NULL as Date, NULL as Item, NULL, NULL as Unit, NULL as Rate,
    NULL as Amount, NULL as Linevat, SUM(T1.Linevat+T1.LineTotal) as Grand
    from OPDN T0 INNER JOIN PDN1 T1 ON T0.DocEntry = T1.DocEntry
    Thanks,
    Joseph

  • Query to open incoming excise invoice when in GRPO

    Can anybody send a query so that it will open incoming excise invoice when in GRPO....

    Hi Krishna,
    Try this,
    SELECT T0.[DocNum], T0.[DocDate], T0.[DocStatus], T0.[CardCode], T0.[CardName],
    T1.[ItemCode], T1.[Dscription], T1.[WhsCode], T1.[Quantity],
    T1.[PriceBefDi], T1.[TaxCode], T1.[VatSum], T1.[LineTotal], T0.[DocTotal]
    FROM OPDN T0
    INNER JOIN PDN1 T1 ON T0.DocEntry = T1.DocEntry
    WHERE
    T1.[Excisable] ='N'
    AND
    T0.[DocStatus]='O'
    OR
    T1.[TargetType]='-1'
    Regards,
    Madhan.

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

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

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

  • POs after GRPO -Balance Qty Query

    Dear Friends,
    Pls. send me query.
    Criteria :
    In PO:
             QTY   unitPrice    TOTAL
    Item1    10       2
    Item2    10       2     
    Item3    10       2
    If GRPO :
    Item1    5        2
    Item2    6            2     
    Item3    7        2
    Queries result should be such that.
          QtyBalance
    Item1    5               2         10
    Item2    4                   2        8
    Item3    3                2          6
    Regards,
    Mahesh.

    Hi Mahesh,
    Try this,
    SELECT      T0.ItemCode, T0.Dscription, SUM(T0.Quantity) AS [Bal Qty]
    FROM         (SELECT      T1.ItemCode, T1.Dscription, SUM(T1.Quantity) AS Quantity
                           FROM          OPOR T0 INNER JOIN
                                                  POR1 T1 ON T0.DocEntry = T1.DocEntry
                           GROUP BY  T1.ItemCode, T1.Dscription
                           UNION ALL
                           SELECT     T3.ItemCode, T3.Dscription, SUM(T3.Quantity * - 1) AS Quantity
                           FROM         OPDN T2 INNER JOIN
                                                 PDN1 T3 ON T2.DocEntry = T3.DocEntry
                           GROUP BY  T3.ItemCode, T3.Dscription) T0
    GROUP BY  T0.ItemCode, T0.Dscription
    Regards,
    Madhan.

  • Itemwise GRPO report with tax query.

    Greetings of the day, Experts,
    We require a report of the GRPO created for Item wise passed.  The report desired is Itemwise will all taxes, namely Excise Duty, HECess, EDCess, VAT4%, VAT5%, etc.  Though we did try to fetch but the same are being displayed in the row level and wish to have in the Column format where in distinctly indicating the values in the columns for the respective columns.
    We have tried this but get the values displayed are all the same.
    SELECT
    T0.DocEntry,
    T0.ItemCode,
    ISNULL((select sum(T1.TaxSum) from PDN4 T1 where T1.staType = '-90' and T1.DocEntry = T0.DocEntry), 0) 'Excise Duty',
    ISNULL((select sum(T1.TaxSum) from PDN4 T1 where T1.staType = '-60' and T1.DocEntry = T0.DocEntry),0) 'Educ Cess',
    ISNULL((select sum(T1.TaxSum) from PDN4 T1 where T1.staType = '-55' and T1.DocEntry = T0.DocEntry),0) 'HECess',
    ISNULL((select sum(T1.TaxSum) from PDN4 T1 where T1.staType = '1' and  T1.StaCode = 'VAT4' and T1.DocEntry = T0.DocEntry),0) 'Vat - 4%',
    ISNULL((select sum(T1.TaxSum) from PDN4 T1 where T1.staType = '1' and  T1.StaCode = 'VAT5' and T1.DocEntry = T0.DocEntry),0) 'Vat - 5%',
    from PDN1  T0
    Need your guidance.
    Thanks and regards.

    Hi........
    Try this......
    SELECT
    T0.DocEntry,
    T0.ItemCode,
    ISNULL((select sum(T1.TaxSum) from PDN4 T1 where T1.staType = '-90' and T1.DocEntry = T0.DocEntry And T4.LineNum=T1.LineNum ), 0) 'Excise Duty',
    ISNULL((select sum(T1.TaxSum) from PDN4 T1 where T1.staType = '-60' and T1.DocEntry = T0.DocEntry And T4.LineNum=T1.LineNum),0) 'Educ Cess',
    ISNULL((select sum(T1.TaxSum) from PDN4 T1 where T1.staType = '-55' and T1.DocEntry = T0.DocEntry And T4.LineNum=T1.LineNum),0) 'HECess',
    ISNULL((select sum(T1.TaxSum) from PDN4 T1 where T1.staType = '1' and T1.StaCode = 'VAT4' and T1.DocEntry = T0.DocEntry And T4.LineNum=T1.LineNum),0) 'Vat - 4%',
    ISNULL((select sum(T1.TaxSum) from PDN4 T1 where T1.staType = '1' and T1.StaCode = 'VAT5' and T1.DocEntry = T0.DocEntry And T4.LineNum=T1.LineNum),0) 'Vat - 5%',
    from PDN1 T0
    Regards,
    Rahul

  • Effects of Updating GRPO table from Update Query..

    Hi all,
    Wanted to know what are the repercussions of updating GRPO table with Update statement, Basically the client is not selected Project field in the GRPO rows in some of the documents during the Posting. Now the same is to be updated, as Invoices are created for most of them and payments also made document is un-editable.
    If i can update using UPDATE statement how will the system react? I know as per SAP guidelines, we cannot update the SAP Tables directly using INSERT or UPDATE statements but wanted to know what is the further effect on postings and SAP as a whole.
    Regards
    Rohan

    Hi,
    The using of update, insert or delete are not allowed in SAP B1. If you use it in B1 db, the maintenance contract with you will be stopped and your money will not be returned. The consequence of using the statements is the database inconsistency.
    Just an info, SAP AG support will use insert, update and delete statement only if the statements are needed and fix the db inconsistency. E.g., if your user is trying to add sales order and after add, the sales order row is empty and header is not empty. SAP will use  the statement to fix the database only if the cause of the error is explained to them. E.g. the server is suddenly shutdown because  the power supply is stopped and it made the sales order like that
    JimM

  • Closing stock report with GRPO

    Hai all
      Please help me to write this query,
    For example
    I have  query to take closing stock report ,but my requirement is ,i want split up for Closing stock and closingvalue
    like, if i have 40 closing stock means i want details how 40 is arrived
    for example i run closing stock report as on 2009-03-31
    means i want this format
    Itemcode ClosingStock Closing value
    ITM001         40                460
    ITM002         20                210.......
    ItemCode GRPOno. VendorCode quantity Rate  GRPO Date
    ITM001        10001          V0001      10       10      2009-02-01
    ITM001        10002          V0002      20       11     2009-03-15
    ITM001        10003          V0003      10       14    2009-03-31
    ITM002        10021          V0011      10       10      2009-02-11
    ITM002        10022          V0015      10       11     2009-03-14

    Hai Jeyakanthan A 
      I want small change in your query
    SELECT T0.ItemCode,T0.TransType, SUM(T0.InQty)-SUM(T0.OutQty) AS 'Closing Stock',SUM(T0.OpenValue) as 'Balance' FROM OINM T0
    *where docdate <= '[%0]'*
    GROUP BY T0.ItemCode,T0.TransType
    Having
    T0.TransType = 20 ORDER BY T0.ItemCode,T0.TransType
    I tried this query for taking closing stock for given date, its giving me correct result
    SELECT T0.ItemCode, T0.Ref1, T0.CardCode, T0.InQty, T0.Price, T0.DocDate FROM OINM T0 WHERE T0.TransType = 20 AND
    (T0.DocDate >= '[%0]' AND
    T0.DocDate <= '[%1]') ORDER BY T0.ItemCode, T0.Ref1, T0.CardCode, T0.InQty, T0.Price, T0.DocDate
    In this query i want only the GRPO no,date,price.... for closing stock quantity
    Edited by: Prasanna s on May 14, 2009 12:39 PM

  • Query Help for reporting on last receipt qty

    SBO Version: 8.82 PL11
    Hello Forum,
    I am looking for some help devising a command behind a crystal report. We are hoping to achieve the last receipt quantity. To arrive at this we would like it to get the last GRPO for an item and total the quantity on that particular GRPO. In addition to this, we want to consider all the lines on the document and SUM them.
    At present, the query I have is as follows:
    Select SUM(c0.Quantity) from PDN1 c0 WHERE c0.ItemCode = T1.ItemCode AND Shipdate = (select Max(ShipDate) from PDN1 C0  INNER JOIN OPDN c1 ON c0.DocEntry = c1.DocEntry where C0.Itemcode =T1.ItemCode AND c1.DocStatus <> 'C'))
    Any assistance would be greatly received.
    Thanks
    Sarah

    Hi Sarah,
    Please repost to the SAP Business One Application  space.
    -Abhilash

  • Query - Compare Goods receipt to AP Invoice

    Can anyone help wiht a query comparing the total of a goods receipt (doctotal) and the total of the AP Invoice it is linked to.
    Display GR docnum, GR docdate, GR doctotal, AP docunum and AP doctotal

    You may check this one first:
    SELECT DISTINCT T1.DOCNUM GRPO#, T1.DOCDATE 'GR Date', T1.DocTotalSy, T3.DOCNUM Invoice#, T3.DocTotalSy
    FROM PDN1 T0
    INNER JOIN OPDN T1 ON T1.DOCENTRY = T0.DOCENTRY
    LEFT JOIN PCH1 T2 ON T2.BASEENTRY = T0.DOCENTRY
    LEFT JOIN OPCH T3 ON T2.DOCENTRY = T3.DOCENTRY
    WHERE T3.DOCNUM like '[%0\]%'
    Happy New Year!
    Gordon

  • Open Quantity of PO in GRPO PLD

    Hi All
    How do you display the open quantity (which is still not delivered) of purchase order into the PLD of Goods Receipt PO?
    Thanks
    SV Reddy

    Hi SV,
    i think, it is possible on FMS.
    (or)
    Try to Create the Query PLD for example Check the below thread,
    Detailed , POs after GRPO -Balance Qty Query
    Regards,
    Madhan.

Maybe you are looking for