cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger not working while changeing the values of UDF

Former Member
0 Kudos

Dear Freind,

I have created one Trigger for ORDR for Sales order. It is working fine. For that i have created two UDF to Title level. When i fill all fields it shows the correct result in DocTotal. But problem is that, while updateing specific record it also update but only refresh the DocTotal.

Means suppose i change the value of UDF fields that time it is not working it gives following error.

"There is difference between the document total and component total"

ALTER TRIGGER AmountForPC1

ON dbo.ORDR

AFTER INSERT,

UPDATE

AS

SET NOCOUNT ON

UPDATE x

SET x.DocTotal = COALESCE(i.DocTotalSy, 0) + COALESCE(i.U_Ref, 0) + COALESCE(i.U_Sub, 0)

FROM dbo.ORDR AS x

INNER JOIN inserted AS i ON i.DocEntry = x.DocEntry

Thanks

Swapnil

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello swapnil,

using an update/insert statement is not supported by SAP and when you update an SBO table you can loose your support!!

Maybe you can look if you can use an Formatted Search, you can trigger this automatically in SBO.

Create a query, click on a field ctrl, shift, F2 and you can add the formatted search in the field.

This is the way support by SAP.

[Documentation Formatted Search|https://websmp101.sap-ag.de/~sapidb/011000358700002914402005E#bkm_show1_10_00qq]

HTH

Regards Teun

Former Member
0 Kudos

Dear Friend,

I tried also formatted search. The formatted search queary as follows. But it is also not working properrly that's y i used Trigger.

Thias queary reflect with discount. Means when that UDF will refresh that time discount automatically in minus. Means it shows minus discount.

Can u plz tell me how to solve this one ?

DECLARE @Qty Numeric

DECLARE @Price Numeric

DECLARE @Packing Numeric

DECLARE @Total Numeric

Set @Qty=$[$38.11.0]

Set @Price=$[$38.14.Number]

Set @Packing=$[$38.U_PC.0]

Set @Total=(@Qty*@Price)+@Packing

Select @Total

Thanks and Regards

Swapnil