尝试获得AR帐户的回报率

2020-09-06 21:10发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)我正在尝试列出SAP B1中所有...

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

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


我正在尝试列出SAP B1中所有活动帐户的列表,以按发票金额查找发票商品的退货百分比。 现在,我从系统中获取汇总。

选择
 OCRD.CardCode,
 OCRD.Cardname,
 ISNULL((从OCRD上的ORIN内部联接OCRD中选择SELECT SUM(DocTotal).CardCode = ORIN.CardCode WHERE DocType ='I'AND CANCELED ='N'AND YEAR(DocDate)= YEAR(getdate())-1),0  )
/
 NULLIF(ISNULL((从OCRD上的OINV内连接OCRD中选择SUM(DocTotal).CardCode = OINV.CardCode WHERE DocType ='I'AND CANCELED ='N'AND YEAR(DocDate)= YEAR(getdate())-1)  ,0),0)
 AS"百分比"
 来自OCRD
 OCRD.CARDTYPE ='C'和OCRD.FROZENFOR ='N'
 GROUP BY OCRD.CardCode,OCRD.CARDNAME
 OCRD.CardName的订单

 
4条回答
d56caomao
2020-09-06 22:12

嗨约翰娜,

这是解决方法:

 SELECT
 W.Cardcode,
 (从OCRD中选择CardName,其中CardCode = W.CardCode)作为" CardName",
 WhsCode,
 总和(W. [INVOICE])作为"应收帐款总额",
 总和(W. [RET_INVOICE])为'Total Return Inv',
 Sum(W. [RET_INVOICE])/NULLIF(Sum(W. [INVOICE]),0)作为"百分比"
 从
 (选择
 S.CardCode,S.WhsCode,
 当S. [DocType] ='INV'然后SUM([Total])ELSE 0 END为'INVOICE'的情况下,
 S. [DocType] ='RET_INV'时,SUM([Total])ELSE 0 END为'RET_INVOICE'的情况
 从
 (选择T0.CardCode,T1.WhsCode,'INV'作为'DocType',
 SUM(T0.DocTotal)[总计]来自OINV T0内联接INV1 T1在T0上。[DocEntry] = T1。[DocEntry]
 T0.DocType ='I'和T0.CANCELED ='N'
 按T0.Cardcode,T1.Whscode分组
 全联盟
 选择T0.CardCode,T1.WhsCode," RET_INV"作为" DocType",
 SUM(T0.DocTotal)[总计]来自ORIN T0内连接RIN1 T1在T0上。[DocEntry] = T1。[DocEntry]
 T0.DocType ='I'和T0.CANCELED ='N'
 按T0.CardCode,T1.WhsCode分组
 )S
 按S.Cardcode,S.WhsCode,S。[DocType]分组
 瓦
 按W.Cardcode,W.WhsCode分组
 W.Cardcode的订单

谢谢,

Aziz

一周热门 更多>