cancel
Showing results for 
Search instead for 
Did you mean: 

Alert based on user defined query

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member201110
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Owen

Thank you and let me test the issue and get back to you

Appreciate your help

Bishal

Answers (0)