cancel
Showing results for 
Search instead for 
Did you mean: 

Stop to remove Add-on document

Former Member
0 Kudos

Hi all SAP experts

Following TRANSACTION _ NOTIFACATION QUERY I AM CREATE TO STOP Deleting the RECEPT FROM LOG CUTTING SCREEN. But this query not works properly. This procedure stop deleting every time. But I have some condition

RECEPT FROM LOG CUTTING SCREEN GENERATE TWO NUMBER ONE IS Receipt From Prod No AND ANOTHER Good Receipt No .

I WANT WHEN Receipt From Prod No OR Good Receipt No . Anyone OF Them IS NOT NULL THEN THE DOCUMENT DOSE NOT REMOVE. IF Bout NUMBER IS NULL THEN DOCUMENT Permitted to delete . Please suggest me any Solution for this procedure

==============================

if @transaction_type='D'

and

@object_type='SSPL_UDO_DD_LOGCUT'

begin

if exists (SELECT T0.[DocEntry] FROM [dbo].[@SSPL_DD_LOGCUT] T0 WHERE T0.DocEntry=@list_of_cols_val_tab_del and T0.[U_RCPTNO] IS NOT NULL OR T0.[U_RCPTNO1] IS NOT NULL)

begin

set @error=10

set @error_message='this document can not deleted'

end

end

=========================

AND

=================================

if @transaction_type='D'

and

@object_type='SSPL_UDO_DD_LOGCUT'

begin

if not exists (SELECT T0.[DocEntry] FROM [dbo].[@SSPL_DD_LOGCUT] T0 WHERE T0.DocEntry=@num_of_cols_in_key and T0.[U_RCPTNO] IS NULL AND T0.[U_RCPTNO1] IS NULL)

begin

set @error=10

set @error_message='this document can not delete'

end

end

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member204969
Active Contributor
0 Kudos

Try to use brackets to assign the appropriate sequence of the logical operators:

if @transaction_type='D'
and 
@object_type='SSPL_UDO_DD_LOGCUT'
begin
if exists
(SELECT T0.DocEntry FROM dbo.@SSPL_DD_LOGCUT T0
   WHERE T0.DocEntry=@list_of_cols_val_tab_del
   and (T0.U_RCPTNO IS NOT NULL OR T0.U_RCPTNO1 IS NOT NULL) ) 
begin 
set @error=10
set @error_message='this document can not deleted'
end
end

Former Member
0 Kudos

THANKS TO REPLY ME .I AM USEING YOUR QUERY IT DOS NOT WORK . WHEN USEING BRACKET THE DOCUMENT PARMETTED TO DELETE.

PLEACE GIVEME OTHER A SOLUTION