Description
Symptom
Approval conditions fail to retrigger the approval procedure when editing an approved document due to incorrect query syntax implementation.
Resolution
By design the query automatically reads properties from the currently active window (OINV, ORDR, and so on in case of first approval; ODRF in case of approved documents).
For this reason, if the approval should apply also to approved documents, please follow these requirements:
- Do not include a FROM table clause
- Use column syntax instead of table references: For instance, for OINV."CardCode" use: $[$4.0.0], for ODRF."DocTotal" use: $[$29.0.number]
In addition, use IN-clause syntax instead of table JOIN for referencing related data.
Example of correct syntax:
SELECT DISTINCT 'True'
WHERE $[$4.0.0] IN (
SELECT T1."CardCode"
FROM OCRD T1
INNER JOIN OCRG T2 ON T2."GroupCode" = T1."GroupCode"
WHERE T2."GroupName" <> 'SAP'
) AND $[$29.0.number] > 1
This example triggers approval when:
- Business partner group is NOT 'SAP'
- Document total is greater than 1
- Approval is retriggered when approved documents are modified
See Also
- Refer to: KBA 3367419 - Approval procedure not triggered after update of existing sales order
- Refer to: 10_Impl_13_CustomTools_ApprovalProcesses.pptx slides 26 to 32