cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Transaction Notification

Former Member
0 Kudos

Hi All,

I have created two udf's: one at header level and one at row level.

In  case if the values in the two udf's is 'Main', then the addition of inventory transfer is to be blocked.

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

BEGIN

if exists (SELECT T1.DocEntry FROM OWTR T0 inner join WTR1 T1 on T0.docentry = T1.Docentry

WHERE T0.Filler =@list_of_cols_val_tab_del and T0.U_WhsType ='Main'

and T1.U_WhsTyp = 'Main'   )

begin

SET @error = 7

SET @error_message = N'Main Warehouse to Main Warehouse Transfer of Stock is not Permitted!! '

end

END

This does not work but I would like it to work on the logic provided.

Any suggestions?

Thanks,

Joseph

Accepted Solutions (0)

Answers (6)

Answers (6)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Try this:

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

BEGIN

if exists (SELECT T0.DocEntry FROM OWTR T0 inner join WTR1 T1 on T0.docentry = T1.Docentry

WHERE T0.DocEntry =@list_of_cols_val_tab_del and T0.U_WhsType = 'Main'

and T1.U_WhsTyp = 'Main'  )

begin

SET @error = 7

SET @error_message = N'Main Warehouse to Main Warehouse Transfer of Stock is not Permitted!! '

end

END


Thanks & Regards,

Nagarajan

Former Member
0 Kudos

HI Nagarajan,

Surprisingly, its working on a test db but not working in the other one!

Not sure what the issue is..

Thanks,

Joseph

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi Joseph,

How are you?

I don't have same version to test and find the difference.

Thanks & Regards,

Nagarajan

Former Member
0 Kudos

Hi Guys,

It still does not work in my environment..

Thanks,

Joseph

Former Member
0 Kudos

Hi Sudhir & Gordon,

Thank you, but these are not working!

I'm checking this on Version 9 PL 05.

Thanks,

Joseph

Former Member
0 Kudos

Hi Joseph,

I tried qry given by Mr.Sudhir on version 9 and PL 6.0.I don't think so there is any major difference between PL 5 and PL 6 regarding this.Its working fine on PL 6.

Regards

Manoj

Former Member
0 Kudos

Hi Joseph,

Try:

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

BEGIN

if exists (SELECT T1.DocEntry FROM OWTR T0 inner join WTR1 T1 on T0.docentry = T1.Docentry and and T1.U_WhsTyp = 'Main'

WHERE T0.DocEntry =@list_of_cols_val_tab_del and T0.U_WhsType ='Main' )

Begin

SET @error = 67

SET @error_message = N'Main Warehouse to Main Warehouse Transfer of Stock is not Permitted!! '

End

END


Thanks,

Gordon

Former Member
0 Kudos

Hi,

Try this, its working fine

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

BEGIN

if exists (SELECT T1.DocEntry FROM OWTR T0 inner join WTR1 T1 on T0.docentry = T1.Docentry

WHERE T0.DocEntry =@list_of_cols_val_tab_del and T0.U_WhsType ='Main'

and T1.U_WhsTyp = 'Main'   )

begin

SET @error = 7

SET @error_message = N'Main Warehouse to Main Warehouse Transfer of Stock is not Permitted!! '

end

END

Former Member
0 Kudos

Hi Joseph,

@list_of_cols_val_tab_del is the key of the object for SBO (so in this case the DocEntry column).... So OWTR.Filler = 1234 (whatever docentry num) will never match a WhsCode

So, replace T0.Filler by T0.DocEntry and the value by CAST (@list_of_cols_val_tab_del AS integer) and it should work (else it means there is something which I haven't seen...)

Regards,

Eric

Former Member
0 Kudos

Hi Eric,

Thank you for your input.

I have checked this but somehow it does not work!

Any suggestions?

Thanks,

Joseph