cancel
Showing results for 
Search instead for 
Did you mean: 

Draft

Former Member
0 Kudos

Hi

I require that a particular user should not be able to save Sales Document in Draft Mode. He/She should be able to save other documents in Draft mode . i tried giving no authorisation then the problem is user is not able to save other documents like Purchase documents in Draft mode etc. Is it possible even if through S.P.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Closed.

Former Member
0 Kudos

Hi,

This authorisation applies to all document types. If you just want to block user in Sales Order draft, only SP might be used to achieve it. However, it is never a good idea to use SP for this kind of purpose. You may end up with too many SP that your system performance might be in trouble.

Thanks,

Gordon

Former Member
0 Kudos

Hi Gordon

Can u pls help me with S.P , i don't have much S.P . Pls Help

Thanks

former_member204969
Active Contributor
0 Kudos

Insert this in your SBO_SP_TransactionNotification stored procedure after the line

-- ADD YOUR CODE HERE

IF @object_type='112' and @transaction_type='A'		-- Draft
BEGIN
If exists (Select 1 from ODRF d inner join OUSR u ON d.UserSign = u.INTERNAL_K
	where d.DocEntry=@list_of_cols_val_tab_del
	  and d.ObjType in ('13','15','17'	)  -- invoice, delivery,order
	  and u.USER_CODE='oktat2')
select @error = 1,
  @error_message = 'You cannot save a draft sales document !'
END

(Replace u2018oktat2u2019 with the particular usercode.)

Former Member
0 Kudos

Try this:

IF @transaction_type = 'A' AND @object_type = '112'

Begin

If EXIST (Select T0.DocEntry From ODRF T0

Where T0.DocEntry = list_of_cols_val_tab_del AND T0.ObjType in ('15','16','17','23') AND T0.UserSign = YOU_Select_USER)

begin

set @error = 1

set @error_message = 'You are not allowed to save draft sales document'

end

End

YOU_Select_USER is the user id need to be replaced.

former_member211460
Participant
0 Kudos

Hi Gordon

I have followed your comments and I have a question

I have aTNthat works wellto validategoods issuesbutwantto validatefrom the creationof the draft documentas thesegoods issuesarein a processofauthorization

, then it does not work

I,m sending you the TN

IF (@object_type = 112)  and @transaction_type in ('A','U')

BEGIN

     DECLARE @Linea as int

     SELECT TOP 1 @Linea = T1.LineNum+1

     FROM ODRF T0 INNER JOIN IGE1 T1 ON T1.DocEntry = T0.DocEntry INNER JOIN OACT ON T1.AcctCode = OACT.AcctCode

     WHERE T0.DocEntry = @list_of_cols_val_tab_del AND @object_type in ('60') AND ISNULL(T1.OcrCode,'')=''

     and (T1.[AcctCode] BETWEEN N'_SYS00000000267' AND N'_SYS00000000354')

          

          

     IF @Linea >= 1 

     BEGIN

          SET @error = 101

          SET @error_message = 'Error en Linea Centro de Costos obligatorio'

     END

END