Skip to Content
author's profile photo Former Member
Former Member

Stored procedure at Purchase order..

hi.

i need a stored procedure at purchase order..

what i need is purchase quotation , posting date should be equal to purchase order posting date other wise..

error will show...

the below one i tried but it's not working..

--IF (@object_type = '22' )and (@transaction_type IN ('A','U'))

--BEGIN

--If exists(SELECT T3.[Docentry] FROM POR1 T0 left join OPQT T1 on T0.[BaseDocNum] = T1.[DocNum]

-- INNER JOIN PQT1 T2 ON T1.DocEntry = T2.DocEntry INNER JOIN OPOR T3 ON T0.DocEntry = T3.DocEntry WHERE DATEDIFF(DD,T3.DocDate,T1.DocDate ) <> 0 and T3.DocEntry =

--@list_of_cols_val_tab_del )

-- Begin

-- set @error =105

-- set @error_message = 'Please Check the Date'

-- End

-- end

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 06, 2014 at 02:12 PM

    Try:

    IF (@object_type = '22' )and (@transaction_type IN ('A','U'))

    BEGIN

    If exists(SELECT T3.[Docentry] FROM POR1 T0 left join OPQT T1 on T0.[BaseEntry] = T1.[DocEntry]

    INNER JOIN PQT1 T2 ON T1.DocEntry = T2.DocEntry

    INNER JOIN OPOR T3 ON T0.DocEntry = T3.DocEntry

    WHERE T3.DocEntry = @list_of_cols_val_tab_del and DateDiff(dd,T3.DocDate,T1.DocDate) != 0)

    Begin

    set @error =22

    set @error_message = 'PO date must be the same as Quote date'

    End

    END


    Thanks,

    Gordon

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 05, 2014 at 11:43 AM

    Hi,

    Why your query is not working? Its working for me.

    You need to enable "allow future posting date" under general settings.Other you will get an error message.

    Thanks & Regards,

    Nagarajan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 05, 2014 at 11:01 AM

    Try this :

    IF (@object_type = '22' )and (@transaction_type IN ('A','U'))

    BEGIN

    If exists(SELECT T3.[Docentry] FROM POR1 T0 left join OPQT T1 on T0.[BaseDocNum] = T1.[DocEntry]

    INNER JOIN PQT1 T2 ON T1.DocEntry = T2.DocEntry INNER JOIN OPOR T3 ON T0.DocEntry = T3.DocEntry WHERE T3.DocDate<>T1.DocDate and T3.DocEntry =

    @list_of_cols_val_tab_del )

    Begin

    set @error =105

    set @error_message = 'Please Check the Date'

    End

    shachar


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.