Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Alert based on user defined query


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



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:




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)) )
			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.'

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,


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question