Kehinde Eseyin's Weblog

This is Kehinde Eseyin's SAP Business One Weblog

Friday, June 02, 2006

Approval Procedures: Line Level and Header Level - Part 1

I have read a number of postings on the SAP Business One Discussion Forum saying that approval procedures can't be defined on line level i.e. for line tables. It's not true! What is true is, the $[Tablename.Fieldname] syntax doesn't work for line tables. I would use a similar challenge I once had and which is similar to a question posted on SAP Business One Discussion Forum to explain how you can set up approval procedures at the line level and the header level.

Statement of the challenge: (as posted on the forum)
I need to set up approval for two scenarios.
1. When creating a PO and I attach it to a project, I want approval to be triggered for the approval of the project head and then the Managing Director.
2. When creating a PO and no project is chosen, the approval should be triggered for the approval of the Head of Department and then the Managing Director.
Note: Two approval templates are needed: A and B
Two approving authorities per template.
It's like an If-then-else thing:- if project is chosen, then project Head+MD (A); otherwise
HOD+MD (B)
Ideally, the query should start with "SELECT DISTINCT 'TRUE'.....
Projects can be attached in the line item (activate 'project' using form settings) or header (accounting tab of the PO document).


Understanding the challenges
The crux of the question is not just how to set-up approval for a purchase order, but to direct/redirect the approval to separate approving authorities if project is picked or not picked at
(1) Line level
(2) Header level.
Suffice to say that Project can be picked on both line level and header level as shown in Figure 1 and Figure 2.

Figure 1
FIGURE 1

Figure 2
FIGURE 2

The first part of this paper will address the Line level set up while part 2 will address the Header Level set up and conclusion - business rule recommendation.

Procedure
- Open the purchase order.
- Click on View (on the menu bar) > System Information to get the Field's item number, Field's column number or press Cltr+Shift+D

Field's item number =38
Field's column number = 31

Using the syntax $[$Field's item number. Field's column number. NUMBER/CURRENCY/DATE/0]

The query syntax for when project is picked is as follows

if (SELECT $[$38.31.0]) > ' '
select 'true'


Save this query as LPROJ=YES

The query syntax for when project is not picked is as follows:

if (SELECT $[$38.31.0]) !> ' '
select 'true'


Save the query as LPROJ=NO

Create approval stages for each of the approving authorities: Project Head - SPH, Head of Department - SHOD and Managing Director - SMD.
A sample approval stage for Project Head - SPH is shown in Figure 3 below. (This should guide you through that of the Head of Department and Managing Director)

Figure 3
FIGURE 3

Create two approval templates namely
LPROJ_Y and LPROJ_N

Administration > Approval Procedures > Approval Templates

LPROJ_Y
Name: LPROJ_Y
Description: Line Project = Yes
Originator: Purchasing Officer - PO
Active Box: Checked
Documents: Purchase Order - Checked
Approval Stage: 1. SPH and 2. SMD
Terms: Check the radio button When the Following Applies and attach the LPROJ=YES named query to the template.

Sample approval template - LPROJ_Y is shown in Figure 4

Figure 4
FIGURE 4

LPROJ_N
Name: LPROJ_N
Description: Line Project = No
Originator: Purchasing Officer - PO
Active Box: Checked
Documents: Purchase Order - Checked
Approval Stage: 1. HOD and 2. MD
Terms: Check the radio button When the Following Applies and attach the LPROJ= NO named query to the template.

Test the Set up
Log on to the system as the Purchasing Officer - PO.

Action 1: Attempt to create a Purchase Order and choose project on the line level.
Result 1: Request for approval (LPROJ_Y) is triggered.
See Figure 5

Figure 5
FIGURE 5

Action 2: Attempt to create a Purchase Order and don't choose project on the line level
Result 2: Request for approval (LPROJ_N) is triggered.
See Figure 6

Figure 6
FIGURE 6

Are you now convinced? It does work for line level.

I'd like to appreciate Riaan Bester of Silverhedge Solutions, South Africa for his contribution.

Note:
1. Ensure that Activate Approval Procedure is activated -
Administration > System Initialization > General Settings > BP Tab
2. Users are defined in the system appropriately.
3. Ignore the error messages that you get in the Query Generator or Wizard (if you save your query via the tool)
4. You must be a member to access the forum link
5. Paths and field names may differ depending on the version. The version used here is 2005.

0 Comments:

Post a Comment

<< Home