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

Goods Receipts PO Without Purchase Order

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2016 at 12:55 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 01, 2016 at 06:36 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 30, 2016 at 07:15 AM

    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

    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.