cancel
Showing results for 
Search instead for 
Did you mean: 

help in SBO_SP_TransactionNotification

Former Member
0 Kudos

hai ,

I alter the procedure like

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

BEGIN

if exists (select count(*) from opor where cardcode=(select o.cardcode from opor o where o.docentry =@list_of_cols_val_tab_del ))

BEGIN

SET @error = 10

SET @error_message = N'cardcode is repeated'

END

END

If the vendor already do an purchase order then the vendor don't allow to make purchase order.So I add the above code in the SBO_SP_TransactionNotification procedure.

But the purchase order does not allow me to save for the vendor who doesn't make the purchase order or who already make purchase order.It give the error what i give in the procedure.

can anyone help me.It is urgent.

Regards,

Ramya.s

Edited by: Ramya sukumar on Jul 11, 2008 12:44 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Ramya,

the reason is, trhat count(*) returns always value - if the order doesnt exisxts, returns 0. Try to change the condition as

if 0 != (select count(*) from opor where cardcode=(select o.cardcode from opor o where o.docentry =@list_of_cols_val_tab_del ))

Former Member
0 Kudos

Hai Petr Verner,

I do as you say like.But i got the same error.there is any other solution.

Regards,

Ramya.s

Former Member
0 Kudos

try it as

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

BEGIN

if 0 != (select count(docentry) from opor where cardcode=(select o.cardcode from opor o where o.docentry =@list_of_cols_val_tab_del ) and docstatus = 'O')

BEGIN

SET @error = 10

SET @error_message = N'cardcode is repeated'

END

END

I added condition for only opened orders. If it doesnt help, run under management studio query

(select count(docentry) from opor where cardcode=(select o.cardcode from opor o where o.docentry =@list_of_cols_val_tab_del ) and docstatus = 'O')

and replace the @list_of_cols_val_tab_del with proper value and check, what you will have for result.

Former Member
0 Kudos

Hi,

This is a better way to use the "if exists" statement :

if exists (select '1' from opor where cardcode=(select o.cardcode from opor o where o.docentry =@list_of_cols_val_tab_del ))

In fact, you don't need to count the number of row. As soon as there's one, you just return 'True'.

Best Regards,

Adrien PIOT