SII: Documents amb errors 3000, 3001 i 3002 al monitor

|, SAP Business One, SII, SQL Server|SII: Documents amb errors 3000, 3001 i 3002 al monitor

Documents que contenen l’error 3000 (Factura duplicada) 3001 (El registro ya esta dado de alta) 3002 (No existe el registro) al monitor de documents del SII.

Son errors que normalment podem marcar con enviats.

with DADES as 
(
select 
ECM2.AbsEntry,
OINV.DocDate,OINV.DocNum,OINV.CardCode,OINV.CardName,OCRD.LicTradNum,
ECM2.ActStatus,ECM2.ActMessage,ECM2.ObjectID,ECM2.SrcObjType,ECM2.SrcObjAbs,
ECM3.LogType,ECM3.LogMessage 
from ECM2 
join ECM3 on ECM3.AbsEntry=ECM2.AbsEntry and ECM3.LogType='R'
join OINV on OINV.DocEntry=ECM2.SrcObjAbs
join OCRD on OCRD.CardCode=OINV.CardCode
where ECM2.SrcObjType=13 and ActStatus<>'O' and (LogMessage like '3002:%' or LogMessage like '3001:%' or LogMessage like '3000:%')

union all

select 
ECM2.AbsEntry,
ORIN.DocDate,ORIN.DocNum,ORIN.CardCode,ORIN.CardName,OCRD.LicTradNum,
ECM2.ActStatus,ECM2.ActMessage,ECM2.ObjectID,ECM2.SrcObjType,ECM2.SrcObjAbs,
ECM3.LogType,ECM3.LogMessage 
from ECM2 
join ECM3 on ECM3.AbsEntry=ECM2.AbsEntry and ECM3.LogType='R'
join ORIN on ORIN.DocEntry=ECM2.SrcObjAbs
join OCRD on OCRD.CardCode=ORIN.CardCode
where ECM2.SrcObjType=14 and ActStatus<>'O' and (LogMessage like '3002:%' or LogMessage like '3001:%' or LogMessage like '3000:%')

union all

select 
ECM2.AbsEntry,
OPCH.DocDate,OPCH.DocNum,OPCH.CardCode,OPCH.CardName,OCRD.LicTradNum,
ECM2.ActStatus,ECM2.ActMessage,ECM2.ObjectID,ECM2.SrcObjType,ECM2.SrcObjAbs,
ECM3.LogType,ECM3.LogMessage 
from ECM2 
join ECM3 on ECM3.AbsEntry=ECM2.AbsEntry and ECM3.LogType='R'
join OPCH on OPCH.DocEntry=ECM2.SrcObjAbs
join OCRD on OCRD.CardCode=OPCH.CardCode
where ECM2.SrcObjType=18 and ActStatus<>'O' and (LogMessage like '3002:%' or LogMessage like '3001:%' or LogMessage like '3000:%')

union all

select 
ECM2.AbsEntry,
ORPC.DocDate,ORPC.DocNum,ORPC.CardCode,ORPC.CardName,OCRD.LicTradNum,
ECM2.ActStatus,ECM2.ActMessage,ECM2.ObjectID,ECM2.SrcObjType,ECM2.SrcObjAbs,
ECM3.LogType,ECM3.LogMessage 
from ECM2 
join ECM3 on ECM3.AbsEntry=ECM2.AbsEntry and ECM3.LogType='R'
join ORPC on ORPC.DocEntry=ECM2.SrcObjAbs
join OCRD on OCRD.CardCode=ORPC.CardCode
where ECM2.SrcObjType=19 and ActStatus<>'O' and (LogMessage like '3002:%' or LogMessage like '3001:%' or LogMessage like '3000:%')

)
select SrcObjType,DocNum
from DADES 
group by SrcObjType,DocNum

i el procés per marcar-les com enviades manual:

update T0 set T0.ActStatus='O', T0.ActMessage='Manual'
from ECM2 T0
join ECM3 T1 on T1.AbsEntry=T0.AbsEntry and T1.LogType='R'
join OINV T2 on T2.DocEntry=T0.SrcObjAbs
join OCRD T3 on T3.CardCode=T2.CardCode
where T0.SrcObjType=13 and ActStatus<>'O' and (LogMessage like '3000:%' or LogMessage like '3001:%' or LogMessage like '3002:%')

update T0 set T0.ActStatus='O', T0.ActMessage='Manual'
from ECM2 T0
join ECM3 T1 on T1.AbsEntry=T0.AbsEntry and T1.LogType='R'
join ORIN T2 on T2.DocEntry=T0.SrcObjAbs
join OCRD T3 on T3.CardCode=T2.CardCode
where T0.SrcObjType=14 and ActStatus<>'O' and (LogMessage like '3000:%' or LogMessage like '3001:%' or LogMessage like '3002:%')

update T0 set T0.ActStatus='O', T0.ActMessage='Manual'
from ECM2 T0
join ECM3 T1 on T1.AbsEntry=T0.AbsEntry and T1.LogType='R'
join OPCH T2 on T2.DocEntry=T0.SrcObjAbs
join OCRD T3 on T3.CardCode=T2.CardCode
where T0.SrcObjType=18 and ActStatus<>'O' and (LogMessage like '3000:%' or LogMessage like '3001:%' or LogMessage like '3002:%')

update T0 set T0.ActStatus='O', T0.ActMessage='Manual'
from ECM2 T0
join ECM3 T1 on T1.AbsEntry=T0.AbsEntry and T1.LogType='R'
join ORPC T2 on T2.DocEntry=T0.SrcObjAbs
join OCRD T3 on T3.CardCode=T2.CardCode
where T0.SrcObjType=19 and ActStatus<>'O' and (LogMessage like '3000:%' or LogMessage like '3001:%' or LogMessage like '3002:%')

 

image_pdfimage_print
Per |2018-08-11T12:41:48+00:004/1/2018 12:51|Fragments, SAP Business One, SII, SQL Server|
Aquest lloc web utilitza galetes per millorar el rendiment i la experiencia de navegació. D'acord