Skip to Content
Author's profile photo Nagarajan K

Document History – Quantity change log query

Dear all,

It is similar to Change log function and this function give list of changed field. To find required field like quantity, just copy and paste it in query generator and execute below query.

Query:

SELECT

T2.DocNum,T2.[DocStatus], T2.[CardName],T2.[NumAtCard], T1.LineNum+1 as ‘Line’, ‘Qty’ as ‘Field’,

cast(T1.Quantity as varchar(18)) as ‘OldValue’, cast(T0.Quantity as varchar(18)) as ‘NewValue’, T2.UpdateDate, T4.[U_Name] as ‘UpdatedBy’, T2.[DocTime]

FROM

ADOC T2

JOIN ADO1 T1 ON T2.docentry = T1.docentry AND T2.Objtype = T1.Objtype and T1.Loginstanc = T2.LogInstanc-1

JOIN ADO1 T0 ON T2.docentry = T0.docentry AND T2.Objtype = T0.Objtype AND T1.LineNum = T0.LineNum

INNER JOIN OUSR T4 ON T2.UserSign2 = T4.INTERNAL_K

AND T0.LogInstanc = T2.Loginstanc

WHERE

T0.Quantity<>T1.Quantity AND T2.[CardCode] BETWEEN ‘AAA‘ AND ‘BBB‘ AND T2.[DocStatus] = ‘O’ AND DateDiff(d,T2.UpdateDate,GETDATE()) <= 0

Note:

Replace customer code AAA and BBB with your customer code.

Hope helpful.

Regards,

Nagarajan

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.