Você está na página 1de 58

ACL Services Ltd.

Embrace Repeatable
Scripts
Tips & Tricks for Creating ACL
Anke Giegandt, ACDA
Scripts
Auditor

ACL Services Ltd.

BOSCH AND SIEMENS HOME APPLIANCES GROUP

ACL | Connections 2013

AGENDA

ACL Services Ltd.

Data analysis for internal audit at Bosch and


Siemens Home Appliances Group
Methods for creating ACL scripts
Best practices for script design
Populate a drop down menu with data from a
table
Create dynamic dialog boxes
ACL language and ACL version test
Summary

ACL | Connections 2013

Data Analysis for Internal Audit at


Bosch and Siemens Home
Appliances Group

ACL Services Ltd.

ACL | Connections 2013

The BSH shareholders 2011

ACL Services Ltd.

ACL | Connections 2013

The BSH product portfolio covers


the entire spectrum for daily life
Cooking
Washing & Drying
Dishwashing
Refrigeration &
Freezing
Consumer products

ACL Services Ltd.

ACL | Connections 2013

ACL Services Ltd.

BSH success worldwide


13 brands, 42 factories, about 45,000 employees
around 9.7 bill. Euro sales in 2011

about 70 companies in 49 countries


Global sales and customer service network

ACL | Connections 2013

ACL Services Ltd.

History of data analysis at BSH


Internal Audit
Start: mid 2007
Data analyses mainly based on
data from:

SAP
Legacy systems
Archived SAP data
GDPdU (German format for data
storage for financial authorities)
SQL-databases

Amount of data for one audit:


500 MB 700 GB

Scripts used:

Purchased scripts
Manual analyses
Scripts developed by consultants
Scripts we developed ourselves

Support of:

Standard audits
Special investigations
Cycle audits (once per year)
External audit
Continuous auditing (started 2013)

ACL | Connections 2013

ACL Services Ltd.

Standard-analyses: available
analysis topics
Accounts Payable
Invoices without purchase order
Duplicate payments

Accounts Receivable
Open items
Changes of customer master data

Asset Management
Assets with wrong useful life
Assets which never have been
depreciated

Controlling Factory
Dummy prices
Product calculation date

FI-General
Baseline date changes
GL-account overview

Material Management
Scrap postings
Defective goods postings

Purchasing
Invoice date before PO date
Split purchase orders

Sales and Sales Admin


CPD deliveries
Free goods

Analysis of SAP Access Rights

ACL | Connections 2013

ACL Services Ltd. 10

Data Analysis at BSH Internal Audit


data flow
Worldwide

weBSH.net

Data Sources

Data Access

Data Analysis
Results

Finance

Factories

Masterdata

Sales

Customer
Service

Slowakia

North
America

dab: exporter

(Access-handling with SAP user and password,

with dab:PrivacyProtection for pseudonymisation)

Greece

China

Rest of
Asia

Other BSHinternal
Datasources

ACL | Connections 2013

ACL Services Ltd. 11

Remarks
This presentation shows screenshots and examples based on SAP
data, our main data source for data analyses
In SAP tables and fields are standardized therefore scripting leads to
even more synergy effects
When you start writing scripts
Have a good idea what the script should do
Use the script as often as possible
CHANGE MANAGEMENT: establish a process
Get feedback about the results
Improve the script according to the feedback

Get rid of errors and too many false positives, improve usability

Resource
Planning!

ACL | Connections 2013

Methods for Creating ACL


Scripts

ACL Services Ltd. 12

ACL | Connections 2013

ACL Services Ltd. 13

What is an ACL script?


A series of ACL commands stored as one unit in an ACL project
Any ACL command can be used in a script
A given script can be executed repeatedly on different data (e.g., every
month on a file with the same data structure, but with different data
content each month)

ACL | Connections 2013

ACL Services Ltd. 14

Methods for creating ACL scripts


Why use ACL scripts?
Improves the efficiency of the data analysis team: more can be done with the same
resources
Quality assurance: using the same script for auditing different legal entities assures
the same quality of the audit
Complex analyses can sometimes only be performed by using scripts
Less experienced users can start ACL scripts and use the results without knowing
how to write scripts

Methods for creating ACL scripts

Create a script from table history


Usage of the script recorder
Use the commands stored in the log
Create a script manually

ACL | Connections 2013

Create a script from table history


Open the table you want to get the history from
Go to Tools Create Script from Table History
1.

ACL Services Ltd. 15

ACL | Connections 2013

Create a script from table history


2.

3.

4.

ACL Services Ltd. 16

ACL | Connections 2013

ACL Services Ltd. 17

Usage of the script recorder


Go to Tools Set Script Recorder On

Open the table you need for your analysis


All commands performed from now on will be written to the new script

ACL | Connections 2013

ACL Services Ltd. 18

Usage of the script recorder


Manual data extraction to a
new table with one condition
(Table LFA1=Vendor Master Data).

New results table.

ACL | Connections 2013

Usage of the script recorder


When the manual analysis is finished, go again to
Tools Set Script Recorder On

Then you are prompted for a script name:

And, here is the resulting script:

ACL Services Ltd. 19

ACL | Connections 2013

ACL Services Ltd. 20

Use the commands stored in the


log
If you want to copy commands from the log, check the required items,
right-click the selection and select Copy
The selected commands can now be copied into a script

ACL | Connections 2013

ACL Services Ltd. 21

Use the commands stored in the


log
To create a script exporting the commands directly from the log, check
the required items, right-click the selection and select
Save Selected Items
Script

Enter the script name and click OK

ACL | Connections 2013

ACL Services Ltd. 22

Create a script manually


To create a script manually, right-click the project name in the project
navigator and select New > Script

ACL | Connections 2013

ACL Services Ltd. 23

Create a script manually


There are now three different ways to populate the new script with your
commands:
Type commands in manually
Copy and paste commands from the log (see previous slides)
Capture syntax command

ACL | Connections 2013

ACL Services Ltd. 24

Capture syntax command


Click the start button

Select the commands as required. They are directly written to the script,
but not yet executed. These commands will only be executed when the
script is started. When the script is finished, select the End Syntax
Capture Button.

ACL | Connections 2013

Best Practices for Script


Design

ACL Services Ltd. 25

ACL | Connections 2013

ACL Services Ltd. 26

Best practices for script design overview


First try to answer the following questions:
Begin with the end in mind: how should the result of the script look like?
Who will use the results of the script?

What will the script do?

Which data are required?


What other information is to be collected?
Which input parameters are required?

Who will use the script?

Error trapping
Languages (dialog, comments, text tables)

Define naming conventions


Use comments within the script code for documentation
Modular programming: one main script should call subscripts

Once the script is finished: in-depth testing of the script with different
input parameters, test data and productive data ensures high quality

ACL | Connections 2013

ACL Services Ltd. 27

Best practices for script design details


Naming conventions

ACL commands: always in UPPERCASE: CLASSIFY ON company_code TO t_temptable


Variables: c_variable_name
Calculated fields: c_field_name
Calculated fields which are used as key fields: c_kfield_name
Indices: i_index_name
Temporary tables: t_table_name
Try to avoid blanks in names

Introduce a run ID which will be defined by the user in the dialog


E.g., a 4-digit ID which can represent the audit number, company code, .
Can be added at the end of variables, temporary tables, indices, results tables, name of the
results folder
Easy differentiation of different script runs with different parameters

Text tables: let the user prioritize the languages required in the dialog.

ACL | Connections 2013

Best practices for script design details


Create a script template which can be re-used (I)
Script header:

Area of Analysis: Accounts Receivable


Name of the script: AR_Cust_Duplicates
Version: 0.43
Author: agiegandt
Created on: 03.10.2012
Last changes: 23.02.2013
Changed by: agiegandt
Uses subscripts: AR_Cust_Dups_Sub01
Uses tables: KNA1, KNB1, KNBK

ACL Services Ltd. 28

ACL | Connections 2013

Best practices for script design details


Create a script template which can be re-used (II)
Basic settings:

SET SAFETY OFF


SET EXACT OFF
DELETE ALL OK (or conditional deletion)
CLOSE
CLOSE SECONDARY
SET DATE "YYYYMMDD
Dialog to get the Run_ID
SET SESSION ++ Name_of_Analytics_%Run_ID% ++
SET FOLDER / Name_of_Analytics _%Run_ID%

ACL Services Ltd. 29

ACL | Connections 2013

Best practices for script design details


Create a script template which can be re-used (III)
Cleanup section: delete at the end of the script

Variables
Temporary tables
Indices
Relations
Calculated fields in original tables

SET SAFETY ON
CLOSE
CLOSE SECONDARY
SET FOLDER /

Final settings:

ACL Services Ltd. 30

ACL | Connections 2013

Populate a Dropdown Menu


from a Table

ACL Services Ltd. 31

ACL | Connections 2013

ACL Services Ltd. 32

Populate a dropdown menu from


a table
Scenario:
Assume you want to write a script with a dialog box. In this dialog box, the user
should be able to put in some parameters for the script run
One of the selection parameters should be the Company Code for which the
analysis will be executed

Desired dialog:

Traditional approach: a dialog is created and the possible parameters


are put in hard-coded

ACL | Connections 2013

Populate a dropdown menu from


a table
Dialog creation:

Resulting script code:

Dropdown values are semi-colon delimited in the dialog command

ACL Services Ltd. 33

ACL | Connections 2013

ACL Services Ltd. 34

Populate a dropdown menu from


a table
To get a more flexible dialog (not hard-coded), it is necessary to know
which Company Codes are in the data ahead of time and to display only
those Company Codes in the dropdown menu for selection by the user
This requires a unique list of all possible valuesa unique list can be
created by using the CLASSIFY command

ACL | Connections 2013

Populate a dropdown menu from


a table
This table has to be converted into a variable which is semi-colon
delimited
This can be done using the GROUP command or using a subscript
Solution with GROUP command:

Variables v_compcodes_tmp and v_compcodes:

ACL Services Ltd. 35

ACL | Connections 2013

ACL Services Ltd. 36

Populate a dropdown menu from


a table
Now this variable containing all possible Company Codes can be used
in the DIALOG command:

Resulting dialog when the script is executed:

ACL | Connections 2013

Create Dynamic Dialog


Boxes

ACL Services Ltd. 37

ACL | Connections 2013

ACL Services Ltd. 38

Create dynamic dialog boxes


Scenario:
Assume you have to write a script with the following requirements:

Technical parameters for each script run have to be maintained outside of ACL Analytics
New analysis topics can be added without additional programming

Approach:

The code must be as flexible as possible


Parameter definition will be done in a spreadsheet

But how can I show an analysis to be selected by the user in a dialog box, which is
not known at the time the script is actually written?
Dynamic Dialog Boxes are required

ACL | Connections 2013

ACL Services Ltd. 39

Create dynamic dialog boxes


Analysis topic: User Authorizations in SAP
In the spreadsheet, two workbooks are defined: Authorizations Overview and
Authorizations Details
Workbook Authorizations Overview:

ACL | Connections 2013

ACL Services Ltd. 40

Create dynamic dialog boxes


Workbook Authorizations Details :

The dialog box created by the ACL script allows you to select one or more analyses
from the Workbook Authorizations Overview
The technical details required for the analysis are taken from the Workbook
Authorizations Details

ACL | Connections 2013

ACL Services Ltd. 41

Import from spreadsheet

Overview
Details

ACL | Connections 2013

ACL Services Ltd. 42

Create dynamic dialog boxes


the result
Fixed part

Flexible part

What we need:
A DIALOG command split into a fixed part and a variable part
But: the variable part is not known at start of the script

We need a script that creates a script with the correct dialog box at runtime

ACL | Connections 2013

ACL Services Ltd. 43

Analysis of the DIALOG command


Example DIALOG:

Corresponding DIALOG command:

x-position

y-position

ACL | Connections 2013

Create dynamic dialog boxes


solution
Variable v_dialog = v_dialog_fix + v_dialog_var

Script with DIALOG command:

ACL Services Ltd. 44

ACL | Connections 2013

Create dynamic dialog boxes


solution
The following data have to be calculated:

Total number of checkboxes required


Number of rows and number of columns for the checkboxes
Maximum width of each checkbox
Distance between rows
Distance from top of the dialog box
Distance from left of the dialog box
Height and width of the complete dialog box
Location of the OK and Cancel buttons

ACL Services Ltd. 45

ACL | Connections 2013

ACL Language and ACL


Version Test

ACL Services Ltd. 46

ACL | Connections 2013

ACL Services Ltd. 47

ACL language test


Why:
Different ACL language versions create different column names in the command
CROSSTAB
German: Anzahl
English: COUNT

If you want to use the column names in a script, you need to know ahead of time
which ACL language version is used

ACL | Connections 2013

ACL language test - CROSSTAB


Example English:

Example German:

ACL Services Ltd. 48

ACL | Connections 2013

ACL language test - script


SET SAFETY OFF
OPEN AnyTable
EXTRACT "TEST" AS "KEY" 0 AS "TESTVALUE" TO t_languagetest1 FIRST 1
OPEN "t_languagetest1"
CROSSTAB ON KEY COLUMNS KEY SUBTOTAL testvalue COUNT TO
"t_languagetest2.FIL" OPEN
IF FTYPE("Count_TEST") <> 'U' Assign v_CountLabel = 'COUNT_'
IF FTYPE("Anzahl_TEST") <> 'U' Assign v_CountLabel = 'ANZAHL_
PAUSE "Label = %v_CountLabel%
CLOSE
SET SAFETY ON

ACL Services Ltd. 49

ACL | Connections 2013

ACL Services Ltd. 50

ACL language test - screenshots


English

German

ACL | Connections 2013

ACL Services Ltd. 51

ACL version test


DISPLAY VERSION
Especially required if scripts should run on both the Unicode and the Non-Unicode
version of ACL Analytics
Some commands are different between Unicode and Non-Unicode

DISPLAY VERSION creates four numeric variables:

ACL_Ver_Type: type: 0 is non-unicode, 1 is unicode


ACL_Ver_Patch: patch
ACL_Ver_Minor: minor version
ACL_Ver_Major: major version

ACL | Connections 2013

ACL Services Ltd. 52

ACL version test


One command to be used differently in the two versions:

ASCII: ZONED(number, length)

string

string type (A for ASCII)

UNICODE: BINTOSTR(ZONED(number, length), A)

ACL | Connections 2013

Summary

ACL Services Ltd. 53

ACL | Connections 2013

ACL Services Ltd. 54

Summary
Scripts can be very useful to improve the efficiency of the audit
department
The different methods of script creation when using ACL technology
offer a wide range of possibilities and allow the user to start simple and
to develop easily to become an advanced script writer
So lets get started, but

ACL | Connections 2013

Summary II
How not to perform script writing:

ACL Services Ltd. 55

ACL | Connections 2013

ACL Services Ltd. 56

Contact
Anke Giegandt
Bosch and Siemens Home Appliances Group
Internal Audit
Carl-Wery-Str. 34
81739 Munich
Germany
Phone:
Fax:
E-Mail:
Web:

+49 89 - 4590 5093


+49 89 - 4590 2158
anke.giegandt@bshg.com
www.bsh-group.com

ACL User Group D/A/CH: http://www.am-dataconsult.de/acl-usergroup.html

ACL | Connections 2013

ACL Services Ltd. 57

ACL | Connections 2013

2012 ACL Services Ltd. 58

Você também pode gostar