Hi All,
We have triggers on OSPP to save specific data to a table for later use.
I get the following error in SAP when adding more than one special price item.
Invalid Cursor State 'Special Prices' (OSPP)
The one trigger :
CREATE TRIGGER [dbo].[tr_OSPP_Insert] ON [dbo].[OSPP] FOR INSERT AS BEGIN Declare @ItemCode varchar(255) Declare @CardCode varchar(255) Declare @Price decimal(18,2) Declare @ListNum bigint Declare @ID bigint Declare @Remote char(1) DECLARE db_cursor CURSOR FOR SELECT ItemCode, CardCode, Price, ListNum FROM INSERTED OPEN db_cursor FETCH NEXT FROM db_cursor INTO @ItemCode, @CardCode, @Price, @ListNum WHILE @@FETCH_STATUS = 0 BEGIN SELECT @Remote = isnull(U_Remote, 'N') FROM OITM WHERE ItemCode = @ItemCode IF ltrim(rtrim(upper(@Remote))) = 'Y' BEGIN SELECT @ID = U_ID FROM [dbo].[@BDS_MAINTENANCE] UPDATE [dbo].[@BDS_MAINTENANCE] set U_ID = U_ID + 1 INSERT INTO [dbo].[@BDS_REMOTESPECIALPRICELIST] ( Code, [Name], U_ID, U_ItemCode, U_CardCode, U_Price, U_ListNum, U_TransactionType, U_Uploaded ) VALUES ( @ID, '_' + cast(@ID as VARCHAR(50)), @ID, @ItemCode, @CardCode, @Price, @ListNum, 1, 0 ) FETCH NEXT FROM db_cursor INTO @ItemCode, @CardCode, @Price, @ListNum END CLOSE db_cursor DEALLOCATE db_cursor END END
We also tried :
CREATE TRIGGER [dbo].[tr_OSPP_Insert] ON [dbo].[OSPP] FOR INSERT AS BEGIN SELECT * INTO [@TEMPTABLE222] FROM INSERTED END
But still get the same error.
We can't use the transaction notification sp as we need to have triggers on all price tables, and the object types in TN is not specific enough.
Do you guys have any idea what is wrong?
Thanks in advance!
Regards
Renier