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

Stored Procedure where Item Cost per Warehouse is Zero

Hi There,

I looking for a solution to check on Purchasing documents if the item's warehouse has a cost price or not, if it doesn't the document should not be added. I have tried to write a stored procedure modifying the standard Business One 'Transaction Notification' stored proc but with no success. Is there any possibility that someone could help me write this stored procedure or provide me with an alternative solution. Business One provides built in functionality for sales documents but not for purchase documents.

Any help would be greatly appreciated.

Regards,

Wynand Cilliers

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 01:09 PM

    Wynard,

    Couple of things:

    Could you paste the SQL code you have already created for the Stored Proc.

    Generally, the Cost of the Item which gets updated to OITW. AvgPrice only when you do Goods Receipts. Unless when you are using Standard Cost where you define the Cost first.

    Please confirm you scenario and SQL.

    In the meanwhile, I have tested the following code which you can add to the SBO Transaction Notification and it works

    IF @object_type = '22'

    BEGIN

    DECLARE @status as varchar

    SELECT @status = 'T' FROM [DBO].[OPOR] T0 INNER JOIN [DBO].[POR1] T1 ON T0.DOCENTRY = T1.DOCENTRY

    INNER JOIN [DBO].[OITW] T2 ON T2.ITEMCODE = T1.ITEMCODE

    WHERE T2.WHSCODE = T1.WHSCODE AND T2.AVGPRICE = 0 AND T0.DOCENTRY = @list_of_cols_val_tab_del

    IF @status = 'T'

    BEGIN

    /*SET @error = 1

    SET @error_message = 'No Item Cost defined' */

    SELECT @Error = 1, @error_message = 'No Item Cost defined'

    END

    END

    (alternately, Eric on the Forum suggested to try SELECT @Error = 1, @error_message = 'No Item Cost defined' so that the error message would show on the Status Bar and that why I have used it this way)

    Suda

    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.