Skip to Content

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

SP for Sales Opportunity fields

Dear Experts,

I want to set some fields in Sales Opportunity as mandatory and I think can be possible through SP transaction notification but am not able to write procedure.

I want the followings fields to be set as mandatory and the document does not get saved untill and unless these fields are not put. The fields are from Sales Opportunity as under :

1) Opportunity Name

2) Contact Person

3) Territory

4) Sales Employee

I know the object for Sales Opportunity seems to be 97. Would be thankful if you can help me in writing the SP.

Thanks in advance.

Regards,

Kamlesh

Former Member
Former Member replied

Hi

Use the following SP:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go




ALTER proc [dbo].[SBO_SP_TransactionNotification] 

@object_type nvarchar(25), 		-- 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' or @transaction_type = 'U') AND @object_type = '97' 
BEGIN
    
if exists (Select T0.cardcode from OOPR T0 where ((T0.Name is null) or (T0.cprcode is null) or (T0.territory is null) or (T0.slpcode =-1)) and (T0.opprid = @list_of_cols_val_tab_del))
begin
	SET @error = 10
	SET @error_message = N'Some of the Fields are Null'
end
END


-- Select the return values
select @error, @error_message
end

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