查询日期错误

2020-09-03 22:22发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)我试图使我可以在日期范围中使用[...

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

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


我试图使我可以在日期范围中使用[%0]和[%1],但是由于出现错误,似乎没有任何效果。 我需要设置参数吗?

错误是一揽子协议(OOAT)

 SELECT DISTINCT'INVOICED'AS'TYPE',T0。[DocNum],T0。[Printed],T0。[DocStatus],
 T0。[DocDate],T0。[DocDueDate],T0。[CardCode],T0。[CardName],T0。[NumAtCard],
 T0。[VatSum],T0。[DocTotal],T0。[Comments],T1。[AddID],T1。[State2],
 (选择总和(T3.TaxSum)
 从RDR4 T3
 T3.DocEntry = T0.DocEntry和T3.staType = 2
 )
 作为" GST",
 (选择总和(T3.TaxSum)
 从RDR4 T3
 T3.DocEntry = T0.DocEntry和T3.staType = 1
 )
  作为" QST",
  T0。[Doctotal]-T0。[VatSum]作为"小计"
 从ORDR T0内联接OCRD T1到T0.CardCode = T1.CardCode
 T0。[DocDate]> ='[2019-08-19]'和T0。[DocDate] <='2019-08-19'和T0。[FatherCard] ='Shoppershead'AND T0。[CANCELED] ='  N'和T0。[DocStatus] ='C'
 全联盟
 SELECT'CREDITED'AS'TYPE',T0。[DocNum],T0。[Printed],T0。[DocStatus],
 T0。[DocDate],T0。[DocDueDate],T0。[CardCode],T0。[CardName],T0。[NumAtCard],
 -T0。[VatSum],-T0。[DocTotal],T0。[Comments],T1。[AddID],T1。[State2],
 (选择-SUM(T3.TaxSum)
 从RDN4 T3
 T3.DocEntry = T0.DocEntry和T3.staType = 2
 )
 作为" GST",
 (选择-SUM(T3.TaxSum)
 从RDN4 T3
 T3.DocEntry = T0.DocEntry和T3.staType = 1
 )
  作为" QST",
  -(T0。[Doctotal]-T0。[VatSum])作为'SUBTOTAL'
 从ORDN T0内联接OCRD T1到T0.CardCode = T1.CardCode
 T0。[DocDate]> ='2019-08-01'AND T0。[DocDate] <='2019-08-19'AND T0。[FatherCard] ='Shoppershead'AND T0。[CANCELED] ='N'  AND T0。[DocStatus] ='C'

 按DOCNUM订购
 
3条回答
zhangjiyang1323
2020-09-03 22:51 .采纳回答

乔纳森,你好,

请尝试使用日期作为参数的代码:

将@fromdate声明为datetime
 声明@Tilldate为日期时间
 从ORDR T0中选择@fromdate = T0.DocDate,其中T0.DocDate ='[%01]'
 从ORDR T0中选择@Tilldate = T0.DocDate,其中T0.Docdate ='[%02]'
 设置@fromdate ='[%01]'
 设置@Tilldate ='[%02]'

 SELECT DISTINCT'INVOICED'AS'TYPE',T0。[DocNum],T0。[Printed],T0。[DocStatus],
 T0。[DocDate],T0。[DocDueDate],T0。[CardCode],T0。[CardName],T0。[NumAtCard],
 T0。[VatSum],T0。[DocTotal],T0。[Comments],T1。[AddID],T1。[State2],
 (选择总和(T3.TaxSum)
 从RDR4 T3
 T3.DocEntry = T0.DocEntry和T3.staType = 2
 )
 作为" GST",
 (选择总和(T3.TaxSum)
 从RDR4 T3
 T3.DocEntry = T0.DocEntry和T3.staType = 1
 )
  作为" QST",
  T0。[Doctotal]-T0。[VatSum]作为"小计"
 从ORDR T0内联接OCRD T1到T0.CardCode = T1.CardCode
 T0。[DocDate]> = @ fromdate和T0。[DocDate] <= @Tilldate
 AND T0。[FatherCard] ='Shoppershead'AND T0。[CANCELED] ='N'AND T0。[DocStatus] ='C'
 全联盟
 SELECT'CREDITED'AS'TYPE',T0。[DocNum],T0。[Printed],T0。[DocStatus],
 T0。[DocDate],T0。[DocDueDate],T0。[CardCode],T0。[CardName],T0。[NumAtCard],
 -T0。[VatSum],-T0。[DocTotal],T0。[Comments],T1。[AddID],T1。[State2],
 (选择-SUM(T3.TaxSum)
 从RDN4 T3
 T3.DocEntry = T0.DocEntry和T3.staType = 2
 )
 作为" GST",
 (选择-SUM(T3.TaxSum)
 从RDN4 T3
 T3.DocEntry = T0.DocEntry和T3.staType = 1
 )
  作为" QST",
  -(T0。[Doctotal]-T0。[VatSum])作为'SUBTOTAL'
 从ORDN T0内联接OCRD T1到T0.CardCode = T1.CardCode
 T0。[DocDate]> = @ fromdate和T0。[DocDate] <= @Tilldate
 AND T0。[FatherCard] ='Shoppershead'AND T0。[CANCELED] ='N'AND T0。[DocStatus] ='C'

 按DOCNUM订购
 

谢谢

Aziz

一周热门 更多>