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

Warning message if numatcard in delivery receipt is used again

Hi guys,

Good day!

Here's the thing: if the numatcard in delivery receipt is used again, a warning message should pop up, informing the user that there's such numatcard already exists.

I have this query.

set ANSI_NULLS ON

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'

declare @CardCode nvarchar (42)

declare @count int

declare @itemcode nvarchar (32)

declare @NumAtCard nvarchar(100)

if @object_type = '17' and @transaction_type in ('A', 'U', 'C', 'D', 'L')

begin

-- SELECT @numatcard = numatcard from ordr

SELECT Top 1 @NumAtCard = NumAtCard, @CardCode = CardCode

FROM ORDR WHERE DocEntry = @list_of_cols_val_tab_del

If Exists (SELECT TOp 1 NumAtCard FROM ORDR Where NumAtCard = @NumAtCard And CardCode = @CardCode Group By NumAtCard, CardCode Having COunt(NumAtCard) > 1) Begin

SELECT @error = 1, @error_message = 'Duplicate Customer PO NO "'+ @NumAtCard +'" already exists.'

END

-- Select the return values

select @error, @error_message

end

This actually worked but the problem is it blocks the transaction (DR). A warning message is what is needed.

Please help.

Thank you,

Jaki

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Feb 11, 2010 at 08:14 AM

    Hello,

    The sp_transacion_notification is a usefull thing when you would like to bock a transaction, or you would like to store a transaction controlled data. But it cannot be used for popup messages. it can commit and rollback an actual transaction.

    To learn about sp_transaction_notification read the following blogs:

    /people/janos.nagy/blog/2009/12/12/how-to-execute-custom-code-via-sptransactionnotification

    /people/lisa.mulchinock/blog/2009/05/22/the-sptransactionnotification-stored-procedure

    You should develop an addon, which et_form_data_Add event checking the requested document (using the same SQL via recordset).

    By the way, this is standard functionality in B12007. (in Sales Order if you record the same Reference (eg numatcard) you can receive a popup, that this number already exists.

    Regards,

    J.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Janos,

      Thanks so much for the reply.

      That's what I thought also. Such requirement is a standard in SAP but when I tried it, it didn't give me any message about numatcard already existing.

      It doesn't really have to be pop up message. When I hit add, it can just inform me that such numatcard already exists but it should not block the transaction. I have tried sp_transaction notification that blocks transactions or make certain fields mandatory so i guess what I'm asking is also possible.

      I hope to have some ideas from other experts also.

      Thank you,

      Jaki

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.