如何在此查询中添加文档总数列?

2020-09-30 01:42发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)选择 T0.DocNum A...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


选择

T0.DocNum AS'发票编号',
T0.DocStatus,T0.Jrnlmemo,
T0.NumAtCard AS'客户参考编号',

T1.SlpName AS'销售人员',

-T0.SlpCode AS'SP代码',

T0.DocDate AS"发布日期",

T0.CardCode AS'客户代码'

T0.CardName AS'CustomerName',

T0.Address2 AS'ShipToAddress'

" Credit Memos" AS"文档类型",

(((T0.DocTotal)* -1)AS'总计文档',

(((((T0.DocTotal-T0.VatSum)-T0.TotalExpns)* -1)AS'产品销售',

(((T0.GrosProfit)* -1)AS'毛利润',

案例

当((((T0.DocTotal-T0.VatSum)-T0.TotalExpns)* -1)= 0.00 THEN 0.00

ELSE((((T0.GrosProfit)* -1)/(((((T0.DocTotal-T0.VatSum)-T0.TotalExpns)* -1))* 100

以"毛利润%"结尾,

(((T0.PaidToDate)* -1)AS'Paid To Date',

(((T0.DocTotal-T0.PaidToDate)* -1)AS'在文档上打开'

FROM ORIN T0

内部联接OSLP T1

打开T0.SlpCode = T1.SlpCode

在哪里

(T1.SlpName LIKE'%% [%0] %%'或'[%0]'='')

AND T0.TaxDate> ='[%1]'

AND T0.TaxDate <='[%2]'

UNION

选择

T0.DocNum AS'发票编号',
T0.DocStatus,T0.Jrnlmemo,
T0.NumAtCard AS'客户参考编号',

T1.SlpName AS'销售人员',

-T0.SlpCode AS'SP代码',

T0.DocDate AS"发布日期",

T0.CardCode AS'客户代码'

T0.CardName AS'CustomerName',

T0.Address2 AS'ShipToAddress'

"发票" AS"文档类型",

(T0.DocTotal)作为"文档总数",

(((T0.DocTotal-T0.VatSum)-T0.TotalExpns)作为"产品销售",

(T0.GrosProfit)AS'毛利润',

案例

当((((T0.DocTotal-T0.VatSum)-T0.TotalExpns))= 0.00 THEN 0.00

ELSE((T0.GrosProfit)/(((T0.DocTotal-T0.VatSum)-T0.TotalExpns))* 100

以"毛利润%"结尾,

(T0.PaidToDate)AS'Paid To Date',

(T0.DocTotal-T0.PaidToDate)为"在文档上打开"

从OINV T0

内部联接OSLP T1

打开T0.SlpCode = T1.SlpCode

在哪里

(T1.SlpName LIKE'%% [%0] %%'或'[%0]'='')

AND T0.TaxDate> ='[%1]'

AND T0.TaxDate <='[%2]'