我如何查询 select GL/Accounts 的金额、营业额和运营成本? SAP B1

How can I do query which will select GL/Accounts with their amount, Turnover and Operating Costs? SAP B1

如何在会计科目表中查询 select GL/Accounts 的营业额和运营成本?

例如

SELECT GL/Account,来自 OACT 的金额 their_type='Turnover'

SELECT GL/Account,来自 OACT 的金额 their_type='Operating Costs'

我试图在 SAP B1 的 OACT table 中搜索,但没有存储营业额、运营成本或资产的列,....

如何在不设置一一账户条件的情况下进行上述查询?

例如

SELECT GL/Account,Amount FROM OACT WHERE AcctCode='0001' or AcctCode='0002' or AcctCode='0003' or AcctCode='0004'

请任何人帮助我

您必须加入具有金额的 JDT1 的 OACT table。

我不确定会计科目表的卢旺达标准,但你可以这样:

SELECT T0.AcctCode, T0.AcctName, T0.FatherNum, SUM(T1.Debit - T1.Credit) * -1 AS 'Amount'
FROM OACT T0
INNER JOIN JDT1 T1 ON T0.[AcctCode] = T1.[Account] 
WHERE T0.AcctCode LIKE '41%' AND T0.Postable = 'Y'
AND (T1.RefDate BETWEEN {?StartDate} AND {?EndDate})

GROUP BY T0.AcctCode, T0.AcctName, T0.FatherNum

以上假设所有以41开头的账户都是指营业额。也不确定您所做的所有发布是否都是在一个级别上完成的,例如4 个或多个级别。

虽然接受的答案可能对您有所帮助,但我想让您知道 OACT 有一个名为 ActType 的列,其值是 E 用于支出或运营成本,I 用于利润或营业额,N 用于 none 的费用或利润。

SELECT T0.AcctCode, T0.AcctName, T0.FatherNum, SUM(T1.Credit - T1.Debit) AS    
'Balance' FROM JDT1 T1
INNER JOIN OACT T0 ON T0.[AcctCode] = T1.[Account] 
WHERE T0.ActType='I' 
AND (T1.RefDate BETWEEN {?StartDate} AND {?EndDate}) 
GROUP BY T0.AcctCode, T0.AcctName, T0.FatherNum

运营成本

SELECT T0.AcctCode, T0.AcctName, T0.FatherNum, SUM(T1.Debit - T1.Credit) AS    
'Balance' FROM JDT1 T1
INNER JOIN OACT T0 ON T0.[AcctCode] = T1.[Account] 
WHERE T0.ActType='E' 
AND (T1.RefDate BETWEEN {?StartDate} AND {?EndDate}) 
GROUP BY T0.AcctCode, T0.AcctName, T0.FatherNum

请注意,有些帐户同时是 TurnOverOperatingCost。在这种情况下,他们的 actType 将是 N