cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Transaction Notification

Former Member
0 Kudos

Hi Experts,

I had never used Transaction Notification (SP) can you tell how to use it or any note for the same.

Thanks

Kamlesh

Accepted Solutions (1)

Accepted Solutions (1)

former_member1269712
Active Contributor
0 Kudos
Former Member
0 Kudos

I HAD USED FOLLOWING PROCEDURE ITS WORKING BUT THE CURSOR SHOWS BUSY ICON IT NOT CONVERTING TO NORMAL CURSOR KINDLY TELL WHAT MAY BE THE ISSUE

IF @transaction_type IN (N'A', N'U') AND

(@Object_type = N'20')

begin

if exists (SELECT T0.BaseEntry, SUM(T0.Quantity)

FROM [dbo].[PDN1] T0 INNER

JOIN [dbo].[POR1] T1 ON T1.DOCENTRY =

T0.BASEENTRY

WHERE T0.BaseType = 22 AND T0.ItemCode =

T1.ItemCode AND T0.BaseLine = T1.LineNum

and T0.DOCENTRY = @list_of_cols_val_tab_del

GROUP BY T0.BaseEntry

HAVING (SUM(T0.Quantity) > SUM(T1.Quantity)) or sum(t0.quantity) > sum(t0.BaseOpnQty))

begin

select @Error = 10, @error_message = 'GRPO quantity is greater than PO quantity'

end

end

THANKS

KAMLESH

former_member206488
Active Contributor
0 Kudos

HI Kamlesh,

Use below code in transaction notification:

IF @Object_type = N'20' and @transaction_type = N'A'

BEGIN

if exists(SELECT DocEntry

From PDN1

Where PDN1.DocEntry = @list_of_cols_val_tab_del

and (Quantity > BaseOpnQty))

begin

Set @error = 1

Set @error_message = N'GRPO Quantity is more then Quantity in PO '

end

End

Thanks,

Neeetu

Former Member
0 Kudos

Hi KAMLESH,

Try this:

IF @transaction_type IN (N'A', N'U') AND

(@Object_type = N'20')

begin

if exists (SELECT T0.DocEntry

FROM dbo.OPDN T0

INNER JOIN dbo.PDN1 T1 ON T1.DOCENTRY = T0.DocENTRY

INNER JOIN dbo.POR1 T2 ON T2.DOCENTRY = T1.BASEENTRY

WHERE T1.BaseType = 22 AND T1.ItemCode =

T2.ItemCode AND T1.BaseLine = T2.LineNum

and T0.DOCENTRY = @list_of_cols_val_tab_del

GROUP BY T1.BaseEntry

HAVING (SUM(T1.Quantity) >SUM(T2.OpenQty))

begin

select @Error = 10, @error_message = 'GRPO quantity is greater than PO open quantity'

end

end

Thanks,

Gordon

Answers (1)

Answers (1)

Former Member
0 Kudos

that is the example of the Sp trasation notification

create table #temp

(

linenum int,

Prjcode varchar(50),

Dim1 varchar(50),

Dim2 varchar(50),

Dim3 varchar(50),

Dim4 varchar(50),

Dim5 varchar(50)

)

-


-


AR- Invoice----


IF (@object_type = '13' AND @transaction_type= 'A')

begin

Set @ObjCode=(Select Code from [@WOBJT] where Code ='13')

Insert into #temp

Select LineNum,project,OcrCode,OcrCode2,OcrCode3,OcrCode4,OcrCode5 from Inv1 where docentry =@list_of_cols_val_tab_del

--

DECLARE C1 CURSOR FOR SELECT DISTINCT Prjcode,Dim1,Dim2,Dim3,Dim4,Dim5,linenum FROM #temp

OPEN C1

FETCH NEXT FROM C1 INTO @tempPCode,@tempDim1,@tempDim2,@tempDim3,@tempDim4,@tempDim5,@linenum

WHILE @@FETCH_STATUS = 0

BEGIN

if (@ProCode='Y' and @ObjCode='13' and ISNULL(@tempPCode,'') = '' )

Begin

set @PCount = @PCount+1

End

else if (@ProCode='Y' and @ObjCode='13' and ISNULL(@tempPCode,'') <> '' and @linenum=0 )

Begin

Update jdt1 set Project=@tempPCode, Ocrcode2=@tempDim2,ProfitCode=@tempDim1,ocrcode3=@tempDim3,ocrcode4=@tempDim4,ocrcode5=@tempDim5 where transtype='13' and createdBy=@list_of_cols_val_tab_del

end

if (@Dim1='Y' and @ObjCode='13' and ISNULL(@tempDim1,'') = '' )

Begin

set @Dim1count = @Dim1count+1

End

if (@Dim2='Y' and @ObjCode='13' and ISNULL(@tempDim2,'') = '' )

Begin

set @Dim2count = @Dim2count+1

End

if (@Dim3='Y' and @ObjCode='13' and ISNULL(@tempDim3,'') = '' )

Begin

set @Dim3count = @Dim3count+1

End

if (@Dim3='Y' and @ObjCode='13' and ISNULL(@tempDim3,'') <> '')

Begin

UPDATE jdt1 SET ocrcode3=@tempDim3 WHERE transtype='13' and createdBy=@list_of_cols_val_tab_del

end

if (@Dim4='Y' and @ObjCode='13' and ISNULL(@tempDim4,'') = '' )

Begin

set @Dim4count = @Dim4count+1

End

if (@Dim5='Y' and @ObjCode='13' and ISNULL(@tempDim5,'') = '' )

Begin

set @Dim5count = @Dim5count+1

End

FETCH NEXT FROM C1 INTO @tempPCode,@tempDim1,@tempDim2,@tempDim3,@tempDim4,@tempDim5,@linenum

END

CLOSE C1

DEALLOCATE C1

if (@PCount > 0)

begin

set @error = 3

set @error_message = 'Please select Project Code '

end

if (@Dim1count > 0)

begin

set @error = 5

set @error_message = 'Please select Dimensions Code '

end

if (@Dim2count > 0)

begin

set @error = 6

set @error_message = 'Please select Dimensions Code '

end

if (@Dim3count > 0)

begin

set @error = 7

set @error_message = 'Please select Dimensions Code '

end

if (@Dim4count > 0)

begin

set @error = 8

set @error_message = 'Please select Dimensions Code '

end

if (@Dim4count > 0)

begin

set @error = 9

set @error_message = 'Please select Dimensions Code'

end

end