有时候SAPB1会出现现金流量表的数据不对,其实不是现金流量表模板的问题,而是日记账分录对应的现金流子表OCFT不对而导致的。
所以需要去查询具体的数据,然后进行后台更新处理。
以下语句供参考:
SELECT T1.TransId,T1.Line_ID,T1.Account,T1.Debit,T1.Credit,T3.CFWId,T4.CFWName
FROM OJDT T0
INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
INNER JOIN OCFT T3 ON T1.Account = T3.Account AND T0.TransId = T3.JDTId AND T1.Line_ID = T3.JDTLineId
INNER JOIN OCFW T4 ON T3.CFWId = T4.CFWId
WHERE T1.RefDate BETWEEN '20230101' AND '20230131' AND T3.CFWId =15
SELECT TOP (1000) [CFTId]
,[CFWId]
,[Debit]
,[Credit]
,[SysCredit]
,[SysDebit]
,[FCDebit]
,[FCCredit]
,[FCCurrency]
,[Account]
,[BatchNum]
,[JDTId]
,[JDTLineId]
,[TransType]
,[BaseRef]
,[PaymentMen]
,[PaymentRef]
,[PostDate]
,[ValueDate]
,[Status]
FROM [SBO_JL].[dbo].[OCFT]
WHERE JDTID= 621
SELECT T0.[CFWId], T0.[Debit],T0.[Credit],T0.JDTID,T0.Account,T0.*
FROM [dbo].[OCFT] T0
WHERE T0.JDTId =622 AND CFWID=15
UPDATE OCFT
SET CFWId=999
WHERE JDTId =622 AND CFWID=15 AND JDTLineId=3
SELECT T0.[CFWId], T0.[Debit],T0.[Credit],T1.TRANSID
FROM [dbo].[OCFT] T0
INNER JOIN [dbo].[OJDT] T1 ON T0.[JDTId] = T1.[TransId]
WHERE T0.[CFWId] IS NOT NULL AND T0.[JDTId] IS NOT NULL AND T1.[RefDate] >='20230101' AND T1.[RefDate] <= '20230131' AND T0.[Status] <> 'v' AND T0.[Status] <> 's'
AND T0.[TransType] <> 140 AND T0.[TransType] <> 123 AND T0.[TransType] <> 29 AND T0.[TransType] <> 157 AND T0.CFWID=15
--GROUP BY T0.[CFWId]