Transaction Notification examples -
When creating TNs you must note that documents can be saved as drafts and that is why we create a Tn for Drafts and the document.
Examples of TNs
1. When a purchase quotation must have a base document - see below TN - this TN can be followed up with the respective documents i.e NO purchase order without Purchase quotation. No GRPO without PO . NO AP Invoice without GRPO down to the credit note. It also applies to the Sales Process its only a matter of changing the Tables and object types.
PURCHASE QUOTATION MUST HAVE A BASE DOCUMENT --
---DRAFT
IF (:transaction_type = ('A') OR :transaction_type = ('U')) AND :object_type = '112' THEN
cnt := 0;
select count(*) into cnt
FROM "ODRF" T0 INNER JOIN "DRF1" T1
on T1."DocEntry"=T0."DocEntry" WHERE T0."ObjType"=540000006 and T1."BaseType" NOT IN ('1470000113')
AND T0."DocEntry" = :list_of_cols_val_tab_del;
IF :cnt > 0 THEN
error := 1;
error_message := N'..BK-Cannot Add Document Without Purchase Requisition';
END IF;
END IF;
---DOCUMENT
IF (:transaction_type = ('A') OR :transaction_type = ('U')) AND :object_type = '540000006 ' THEN
cnt := 0;
select count(*) into cnt
FROM "OPQT" T0 INNER JOIN "PQT1" T1
on T1."DocEntry"=T0."DocEntry" WHERE T1."BaseType" NOT IN ('1470000113')
AND T0."DocEntry" = :list_of_cols_val_tab_del;
IF :cnt > 0 THEN
error := 2;
error_message := N'..BK-Cannot Add Document Without Purchase Requisition';
END IF;
END IF;
2. When creating items users at times forget to put the item name by unknowingly pressing enter when they code has already been created. to block creating item codes without their description we use the below TN
IF (:transaction_type = ('A') OR :transaction_type = ('U')) AND :object_type = '4' THEN
cnt := 0;
select count (*) into cnt
from OITM T0
WHERE IFNULL(T0."ItemName",'') = ''
AND T0."ItemCode" = :list_of_cols_val_tab_del;
IF :cnt > 0 THEN error := 01;
error_message := N'BK-Please Fill the Item Name or description';
END IF;
END IF;
3. Blocking BPs being created without a name
IF (:transaction_type = ('A') OR :transaction_type = ('U')) AND :object_type = '2' THEN
cnt := 0;
select count (*) into cnt
from OCRD T0
WHERE IFNULL(T0."CardName",'') = ''
AND T0."CardCode" = :list_of_cols_val_tab_del;
IF :cnt > 0 THEN error := 02;
error_message := N'BK-Please Fill the BP Name';
END IF;
END IF;
4.Landed cost must always be done by the local currency of the company. In some cases you find users have done landed cost with the document currency. to block this we use the below TN. KES is the Currency you can change it to your currency.
cnt := 0;
select count(*) into cnt
FROM "OIPF" T0
WHERE T0."DocCur" <> 'KES'
AND T0."DocEntry" = :list_of_cols_val_tab_del;
IF :cnt > 0 THEN
error := 30;
error_message := N'..BK-Kindly correct currency - KES';
END IF;
END IF;
BEGIN
IF EXISTS
(
SELECT T0.DocNum
FROM OPCH T0
INNER JOIN PCH1 T1 on T1.DocEntry=T0.DocEntry
WHERE T1.VatGroup <> 'I8' AND T1.ItemCode = 'F000001'
AND T0.DocEntry = @list_of_cols_val_tab_del
)
BEGIN
SET @error = 12
SET @error_message = 'Please choose the correct tax code'
END
END
Comments
Post a Comment