Skip to Content
0
Feb 16, 2009 at 08:13 AM

pl correct SP code for production order

38 Views

hi all,

To block production order from being closed

when completed qty < planned qty/all child items are not issued to production using Stored procedure ?

Kindly correct below SP Code.

set ANSI_NULLS ON

set QUOTED_IDENTIFIER ON

go

ALTER proc [dbo].[SBO_SP_TransactionNotification]

@object_type nvarchar(25), -- SBO Object Type

@transaction_type nchar(1), -- [A]dd, <u>pdate, [D]elete, [C]ancel, C[L]ose

@num_of_cols_in_key int,

@list_of_key_cols_tab_del nvarchar(255)= Status,

@list_of_cols_val_tab_del nvarchar(255)

AS

begin

-- Return values

declare @error int -- Result (0 for no error)

declare @error_message nvarchar (200) -- Error string to be displayed

select @error = 0

select @error_message = N'Ok'

IF (@object_type = '202' AND @transaction_type= 'U' AND @list_of_key_cols_tab_del = u2018Lu2019)

BEGIN

IF EXISTS (SELECT DocNum FROM [dbo].[OWOR] WHERE (Compltqty < Plannedqty )

BEGIN

SELECT @error =1, @error_message = 'Production Order canu2019t be Closed,It is Incomplete / Send remaining Qty to Rejectedu2019

END

END

select @error, @error_message

END

Thanks

Jeyakanthan