on 04-29-2016 1:50 PM
Hello Experts,
Can you plz give me Solution for this I have to create a sp transactionNotification while when entering Goods Receipts It can't be add without adding Purchase Order.
Hi,
Please try this:
IF @transaction_type = 'A' AND @object_type = '20'
BEGIN
IF exists (Select ItemCode from dbo.PDN1 T0
Where T0.Baseentry is null
AND T0.DocEntry=@list_of_cols_val_tab_del)
Begin
SELECT @error = 1, @error_message = 'Not allowed to create GRPO without Purchase Order!'
End
END
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Natasha,
Below SP will block the addition of GRPO without PO.
----Block GRPO without PO--------------------------
Declare @OPDNLineNum as nvarchar(50)
IF (@object_type = '20' AND @transaction_type IN ('A'))
BEGIN
SELECT TOP 1
@OPDNLineNum = a.LineNum + 1
FROM PDN1 a
INNER JOIN OPDN b ON a.DocEntry = b.DocEntry
WHERE (a.BaseEntry IS NULL or a.BaseEntry = 0) AND b.DocEntry = @list_of_cols_val_tab_del
IF NOT @OPDNLineNum IS NULL
BEGIN
SELECT @error = -31,
@error_message = 'Please create Purchase Order before Creating GRPO.'
END
END
-----End Block GRPO without PO-------------
You can also restrict few of the user also through above SP just by adding their Usersign.
Let me know the feedback please.
Thanks,
Harshal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Natasta,
You can use Stored Procedure TransactionNotification for this
you can use this command
USE [SP_Notification]
GO
/****** Object: StoredProcedure [dbo].[SBO_SP_TransactionNotification] Script Date: 04/29/2016 14:50:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[SBO_SP_TransactionNotification]
@object_type nvarchar(20), -- 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),
@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 @transaction_type = 'A' AND @object_type = '20'
BEGIN
IF exists (Select ItemCode from dbo.PDN1 T0
Where T0.BaseType=-1
AND T0.DocEntry=@list_of_cols_val_tab_del)
Begin
SELECT @error = 20, @error_message = 'GRPO without Purchase Order!'
End
END
--------------------------------------------------------------------------------------------------------------------------------
-- Select the return values
select @error, @error_message
end
Thanks
Bhavesh Samant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.