mahmood66
asked on
How to handle "No Checkout Authority could be found for PO" Error Message in SQL Server?
Dear, I have written a trigger, when user voilates trigger gives proper Error Message, but user need to close that PO and reopen it to make it correct. if user does not re-open the PO. he gets the error which is in attached file.
trigger code is given eblow.
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER TRIGGER [POSOProcessing]
ON [dbo].[InvNum]
AFTER UPDATE
AS
SET NOCOUNT ON;
Begin
If exists(select * from _btblInvoiceLines Where iInvoiceID in ( Select AutoIndex From Inserted) and fUnitpriceincl >1000)
Begin
RAISERROR ('Enter Price for KG',16,1)
End
End
trigger code is given eblow.
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER TRIGGER [POSOProcessing]
ON [dbo].[InvNum]
AFTER UPDATE
AS
SET NOCOUNT ON;
Begin
If exists(select * from _btblInvoiceLines Where iInvoiceID in ( Select AutoIndex From Inserted) and fUnitpriceincl >1000)
Begin
RAISERROR ('Enter Price for KG',16,1)
End
End
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER TRIGGER [POSOProcessing]
ON [dbo].[InvNum]
AFTER UPDATE
AS
SET NOCOUNT ON;
Begin
If exists(select * from _btblInvoiceLines Where iInvoiceID in ( Select AutoIndex From Inserted) and fUnitpriceincl >1000)
Begin
RAISERROR ('Enter Price for KG',16,1)
End
End
Check-out-Authority.bmp
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
with the help of experts idea, i have done.
ASKER
"Even if user gets error message all updated on a table will be already done" ( your are right but when my statement RaisError executes it rollbacks the transaction so my database is not save the wrong data).