Approval template at the line level on marketing documents
Today I will write a little about approval template, I went through a situation recently with this resource and I would like to share my experience.
Recently on the SAP B1 SDK space, appeared a thread asking help to do a query for approval template on the line level of the document. After read a little about this subject, I saw in many other threads in the SAP B1 spaces, comments talking that is not possible use information of the line level to build approval templates.
At the company that I work I know that are done approval templates on line level, then, I went check this resource and I got those considerations:
Is it possible to use approval templates at the line level?
Yes, it is.
Is it possible to do a query for approval template using data from header and line together?
Yes. it is.
A real sample: Approval template for sales order.
e.g. Line level
At this query, I don’t want that SAP allow sales order with any line with discount greater than 20 %
SELECT CASE WHEN $[$38.15.NUMBER] > 20 THEN 'TRUE' ELSE 'FALSE' END
e.g. Header level
At this query, I don’t want that SAP allow sales order with header discount greater than 20%.
SELECT CASE WHEN $[$24.0.NUMBER] > 20 THEN 'TRUE' ELSE 'FALSE' END
e.g. Header and line level
At this query, I don’t want that SAP allow sales order with any line discount greater than 20% for the customer C00001
SELECT CASE WHEN $[$38.15.NUMBER] > 20 AND $[$4.0.0] = 'C00001' THEN 'TRUE' ELSE 'FALSE' END
Is it possible group values from the lines in query, from approval templates?
No. The query will be executed line by line, and if any of them returns ‘TRUE’, the approval procedure will be started. Because of this execution, line by line is not possible use resources like SUM(valor), for example.
Obs.: After some tests, I saw that the sintax $[TABLE.FIELD] doesn’t work correctly on approval template, so, in the scenarios that I mentioned, our queries should use always the sintax $[$ITEM.COL].
The information shared here, were tested on SAP B1 9.0 PL 11 and 9.1 PL 12.
That’s all folks, hope it helps.
Leave your feedback about this subject and share your experience about it.