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

Alert based on user defined query

Hi

I have defined user defined field U_Jobnumber.I need to stop /inform user if user is trying to enter the same u_Jonbnumber again .This is being done at sales order (header level)

Can you please help me to provide solution

(Points will be awarded based on solution or advice )

Thank you

Bishal

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Sep 23, 2008 at 09:21 PM

    Hi Bishal,

    Rather than using an alert, you could put validation code in the SBO_SP_TransactionNotification stored procedure to check for the same job number before the document is added. This is a permitted solution as SAP allow users to add their own sql code to this proc (provided it's not inserting or updating data in SBO system tables).

    To set up this solution (on a test system):

    1) Open SQL Studio Management

    2) In the Object Explorer expand the company database, expand Programmability and Stored Procedures

    3) Right-click the SBO_SP_TransactionNotification stored procedure and choose Modify. This will create an update script in the main window.

    4) Look for the following section in the script:

    --------------------------------------------------------------------------------------------------------------------------------
    
    --	ADD	YOUR	CODE	HERE
    
    --------------------------------------------------------------------------------------------------------------------------------
    

    5) Underneath the above section, paste the following code:

    if @OBJECT_TYPE = '17' and @TRANSACTION_TYPE in ('U', 'A')
    	if exists(select DocEntry from ORDR where DocEntry <> cast(@LIST_OF_COLS_VAL_TAB_DEL as int) 
    				and U_Jobnumber is not null and U_Jobnumber <> '' 
    				and U_Jobnumber = (select U_Jobnumber from ORDR where DocEntry = cast(@LIST_OF_COLS_VAL_TAB_DEL as int)) )
    		begin
    			set @ERROR = '9999' -- Set your own error code here
    			set @ERROR_MESSAGE = 'The Job Number entered has already been used on a previous sales order.'
    		end
    

    6) Click on Execute and you should get a message stating that the update was successful

    7) Test adding a new sales order

    The above script will raise an error when the user clicks on Add if a job number has been specified on the sales order and that number has already been used. It will not check if a job number has not been specified

    Kind Regards,

    Owen

    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.