abaninas
31st December 2012, 09:33
Dear All,

I'm trying to raise an error when saving on baan iV table as below:
alter TRIGGER [dbo].[Trigger_REC]
ON [baanivdb].[dbo].[ttdilc402206]
after update
--INSTEAD OF INSERT

AS
RAISERROR (N'This is message %s %d.', -- Message text.
1, -- Severity,
1, -- State,
N'number', -- First argument.
5); -- Second argument.

ROLLBACK

go

The problem when try to save, the session hangs and I got the below fatal error:
Error 4609 (bdb_errno 4609)
a not terminated transaction is aborted

I want to raise the error without the session being hangs

Please advice

benito
2nd January 2013, 19:52
i have only done insert triggers, example below. have you tried taking out the rollback? maybe the best forum for this issue is the microsoft forum, assuming your session works without the trigger.


ALTER TRIGGER States_Insert ON dbo.BaanStates1
FOR Insert AS

if (select count(*) from inserted i, AdventureWorks2000.dbo.BaanStates2 em
where em.shortName = i.shortName) = 0
begin
insert into AdventureWorks2000.dbo.BaanStates2
select *
from inserted i
end

GO

vahdani
2nd January 2013, 23:04
Hi abaninas,

Baan is database independent and has its own error handling. Only so can it work with diverse database products (SQL Server, Oracle,...). Errors raised in database (trigger or otherwise) cause always fatal error with an error number and no text. Any abort of database action and issuing of error messages should therfore be programmed in baan scripts:

In Baan-IV: in main.table.io section of a Session script using the function abort.io("messagecode")

In ERPLN: before.save.object method of a DAL using the function dal.set.error.messsage("message.code") followed by return(DALHOOKERROR)

So if you do not have access to source code or have no baan development license then you can not achieve what you want.

abaninas
3rd January 2013, 09:10
Many thanks