cancel
Showing results for 
Search instead for 
Did you mean: 

SAP B1 Check Dates Transaction Notification

former_member641972
Discoverer
0 Kudos
437

I need help implementing a transaction notification for Outgoing Payments (OVPM) under the Payment Methods (VPM1) menu. I need an error message for when the user tries to set a Due Date prior to the current date. Thanks.

IF object_type = '46' AND transaction_type in ('A','U') THEN

SELECT T1."DueDate" INTO Fecha1 FROM VPM1 T1 INNER JOIN OVPM T0 ON T1."DocNum" = T0."DocEntry"

WHERE T0."DocEntry" = list_of_cols_val_tab_del;

IF DAYS_BETWEEN(CURRENT_DATE,Date1) < 0 THEN

error := 90008;

error_message := N'You are trying to set a prior date';

END IF;

END IF;

Accepted Solutions (0)

Answers (1)

Answers (1)

MD1
Active Contributor

PLEASE TRY THIS

IF :Object_type ='46' and ( :transaction_type ='A' OR :transaction_type ='U') THEN
Declare temp_var_0 integer;
SELECT
(SELECT Count(*)
FROM OVPM T0
INNER JOIN VPM1 T1 ON T0."DocEntry" = T1."DocNum"
WHERE DAYS_BETWEEN(T1."DueDate", CURRENT_DATE)>1 and T0."DocEntry" = :list_of_cols_val_tab_del ) INTO temp_var_0 FROM DUMMY;
IF :temp_var_0 > 0 THEN
SELECT 1, 'You are trying to set a prior date' INTO Error, error_message FROM DUMMY;
END IF;
END IF;