Skip to Content
avatar image
Former Member

Reflecting to every marketing document

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 27, 2015 at 01:18 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • avatar image
    Former Member
    Nov 01, 2015 at 08:56 AM

    Hi

    dose it work now?

    shachar

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Shachar,

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

      Regards

      Ram