Skip to Content
0

SP TN Block Backdated Posting

Jan 13, 2017 at 07:55 AM

92

avatar image

Good Day!

Hi Experts, Correct my code please. I cant get the notification on my SPTN Blocking Backdated posting in A/R and some of the transaction. Please see my Code Below:

if @transaction_type = 'A' and @object_type = '13'
begin
if exists(select T0.DocDate, T0.DocEntry from
dbo.OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OUSR T3 ON T0.UserSign = T3.USERID
where T0.docentry = @list_of_cols_val_tab_del and datediff(dd, T0.[DocDate],current_timestamp)<1 and t3.USER_CODE = 'Manager')
begin
SET @error = 13
SET @error_message = N'You are not allowed to post this transaction.'
end
END

SQL
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Nagarajan K Jan 17, 2017 at 10:54 PM
1

Hi,

Try this,

if @transaction_type = 'A' and @object_type = '13'
begin
if exists(select T0.DocDate, T0.DocEntry from
dbo.OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OUSR T3 ON T0.UserSign = T3.USERID
where T0.docentry = @list_of_cols_val_tab_del and datediff(dd, T0.[DocDate],Getdate() )<1 and t3.USER_CODE = 'Manager')
begin
SET @error = 13
SET @error_message = N'You are not allowed to post this transaction.'
end
END

Have you tried with standard function under Document settings-->Block documents with earlier Posting Date

Regards,

Nagarajan

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks for the reply Nagarajan,

But my requirements is to block backdating post only,not to block earlier posting date.

thanks

0
Pradnya S Jan 13, 2017 at 11:23 AM
0

Hi,

Please try to get the result of datediff function.

Also instead of current_timestamp try using getdate() function with the condition <> 0

Regards

Pradnya

Share
10 |10000 characters needed characters left characters exceeded
Taseeb Saeed Jan 17, 2017 at 06:31 PM
0

Dear Romel Catalogo,

Please Select @error and @erro_message after setting them like

SET @error = 13
SET @error_message = N'You are not allowed to post this transaction.'

SELECT @error,@error_message

thanks,

Egr. Taseeb Saeed

Share
10 |10000 characters needed characters left characters exceeded
Nagarajan K Jan 19, 2017 at 12:59 AM
0

Have you tried,

if @transaction_type = 'A' and @object_type = '13'
begin
if exists(select T0.DocDate, T0.DocEntry from
dbo.OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OUSR T3 ON T0.UserSign = T3.USERID
where T0.docentry = @list_of_cols_val_tab_del and datediff(dd, T0.[DocDate],Getdate() )<1 and t3.USER_CODE = 'Manager')
begin
SET @error = 13
SET @error_message = N'You are not allowed to post this transaction.'
end
END

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Thanks Nagarajan.

What if they change the Date and Time in the server? because all our users using remote desktop to use SAP B1.

Best Regards.

Thanks

0

Dear Romel,

You can restrict users by applying policy after this they would not be able to change the system date to whom they are accessing through remote.

Thanks

Engr. Taseeb Saeed

1