You are on page 1of 3

How to set up an approval procedure

for all Purchase Orders except those


created directly from a Sales Order?
Skip to end of metadata
Page restrictions apply
Attachments:7
Added by Guest, last edited by Guest on Jun 29, 2009 (view
change)
show comment
Go to start of metadata
How to set up an approval procedure for all Purchase Orders except
those created directly from a Sales Order?Documentation: Approval
Procedures in Release 2004 A; SAP Business One ...To GoNote 1326173
In this article the classic window colour refers to the approver window while the
green windows are from the originator of the document.
In many companies most of the purchase orders are created by warehouse
employees and these need to be approved by a manager. In this case the
approval can be set as Always for purchase orders (Administration -> Approval
Procedure -> Approval Templates). In the setup window, the Terms can be set as
Always.
Using these settings, an approval procedure will be initiated for every purchase
order entered into the system. In some cases, it happens that sales personnel
receive sales orders for products which are either unavailable or have insufficient
quantities in stock, or it is a drop ship transaction. In such cases, a purchase
order can be created based on a sales order by checking the box Purchase Order
on the Sales Order Logistic tab (or through DTW import). See article How to
create links between base & target documents when using DTW?
In our scenario, the company is adamant to keep stock levels in their
warehouses to a minimum and thence wishes to impose an approval procedure
on all purchase orders that are not generated directly from sales orders.To
accommodate this business requirement, the approval template shown above
has to be customised. There are 2 key factors that need to be noted:1.

The

Document Key (DocEntry) of a sales order becomes the base key (BaseEntry) of

the purchase order on row level.2.

It is current system behaviour that a

condition for triggering an approval procedure cannot be based on data at line


level.
Therefore, it is necessary to create a user defined field (UDF) on header level of
the purchase order which will indicate whether there is a base key present in a
row. It is then also possible to set up the approval procedure such that it will only
be triggered when there is no base key in the document. The pivotal point in this
customisation is the fact that the Document Key (DocEntry) of a sales order, here
Sales Order 49, becomes the base key (BaseEntry) of the purchase order.
Note:According to the definition under Administration -> System Initialisation ->
Document Numbering, your Document Key might differ from your document
number.
The purchase order(s) created from this sales order has a base key defined as
shown below:
Purchase orders not based on sales orders have no base Key.
A UDF on header level can be defined for a Formatted Search (FMS) which
populates this field with a specific value (for example the Business Partner Code
or letter 'N' for 'No') when the purchase order is not based on a sales order.
Please refer to note 652337 for how to create a UDF on header level. The
following query can be used for the FMS.

SELECT
distinct 'N'
FROM
POR1 T0 /* Sales Order lines table where the base key is
stored*/
WHERE
$[$ 38.45.Number] is null or /* The index for the base
Entry has to be used as it is referring to the open form*/
$[$ 38.45.Number] = ''
For more information on how to set a formatted search please refer to the
document: How to Define and Use FMS in Release 2005 A.
The approval can therefore be based on the condition that if the UDF value is
equal to a defined value, here 'N', the approval procedure should be triggered.
The condition can be set using a query such as:

SELECT

distinct'True'
FROM
OPOR T0
WHERE
$[OPOR.U_BaseREF] = 'N'/* The UDF name has to match
the one created in your database.*/
For how to create UDF refer to note 1171966.
The approval process can thus be customised to include only purchase orders not
created from a sales order.
Once a standalone document is created, the FMS pulls the value 'N' into the UDF.
When attempting to add the document, the defined approval will check the value
of the UDF and trigger the approval procedure.
If a purchase order is created based on a sales order, it adds directly to the table
and bypasses the purchase order form. Hence the FMS will not activate and will
not populate the UDF. Consequently the approval procedure will not trigger. In
this example the FMS will only activate for documents where there is no base
key.

You might also like