cancel
Showing results for 
Search instead for 
Did you mean: 

Reflecting to every marketing document

Former Member
0 Kudos

Hi Experts,

This is my SP Query .This query is made for only for  Production order .This query is executing perfectly.

While adding marketing documents more than 19 documents . And SP Query is Reflecting here. How i can overcome this problem

I want this query only in production order not in other documents.

If @object_type='202' and @transaction_type='a'            

declare @doc int

set @doc=(select count(DocNum) from OWOR where Status like '%[pr]' )

BEGIN

if  exists( select T1.[DocNum]  FROM  OWOR T1  where T1.[DocEntry]=@list_of_cols_val_tab_del and @doc>=19)

         BEGIN

            SET @error=-1

            SET  @error_message=N'Open work order Exceeds 19 Orders'

         END

END

Please Help me

Regards

Ram

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

I didn't understand exactly what you need but I think you cab use this:

@object_type='202' and @transaction_type='a'            



@doc int



@doc=(select count(DocNum) from OWOR where Status like '%[pr]' )





if   @doc>=19



BEGIN



SET @error=-1



SET  @error_message=N'Open work order Exceeds 19 Orders'



END

shachar

Former Member
0 Kudos

Hi sir,

Actually my requirement in production order open documents must not exceed 19 . If i add 20 th document i want one error message and document should not to be add.

In my system while executing above query in SP_Transaction Notification .The SP Query executing succesfully.

While adding 20 th document in production order .The document is not adding but it ok. But,

While adding 20 th document in sales order ,Delivery, purchse order .The error message is coming.

What can i do to overcome this problem.

The SP query is what i posted above one is.

Thanks & Regards

Ram

Former Member
0 Kudos

Hi,

Attach your full SP query here.

Former Member
0 Kudos

Hi

Now I understand the problem.

You need to put"BEGIN" after the condition and END at the end

use this query it should work

If @object_type='202' and @transaction_type='a'  

BEGIN         

declare @doc int

set @doc=(select count(DocNum) from OWOR where Status like '%[pr]' )

BEGIN

if  exists( select T1.[DocNum]  FROM  OWOR T1  where T1.[DocEntry]=@list_of_cols_val_tab_del and @doc>=19)

         BEGIN

            SET @error=-1

            SET  @error_message=N'Open work order Exceeds 19 Orders'

         END

END

END

shachar

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

dose it work now?

shachar

Former Member
0 Kudos

Hi Shachar,

Thank u for helping me on query. It is working Fine now. Thanks a lot Shachar.

Regards

Ram