Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
2011-04-14
QlikView Version: 10.xx English
Page 1 of 14
Contents
1
INTRODUCTION................................................................................................................. 3
PREREQUISITES................................................................................................................ 4
CONTENTS.................................................................................................................... 5
DATA LOAD................................................................................................................... 5
SCRIPT DETAILS................................................................................................................ 8
4.1
4.2
4.3
4.4
Page 2 of 14
1 Introduction
QlikStart templates provide a sample set of key information deliverables for your SAP
modules that combine data extraction scripts, pre defined calculations and a variety of sample
analyses in a front end application combining dashboards, charts and reports.
QlikStart templates contain value for both IT and the business, for IT a series of predefined
extraction scripts with table joins and calculations provide valuable insight. The business user
can start using the predefined reports to analyse their business within a very short time.
A high level architecture diagram of the QlikStart template is described below:
SAP R/3
01-SAP-FI-GL_QVDGENERATOR.qvw
QVD Layer
02-SAP-FI-GL_LAYOUT.qvw
This document covers the technical background involved with the data extraction along with a
step by step guide to implement the QlikStart template .
Page 3 of 14
2 Prerequisites
Completion of the QlikView Designer training courses as the process assumes knowledge of
standard QlikView script syntax such as mapping load etc.
Prior to starting the process you should have downloaded and installed the QlikView Connector
for use with SAP from here. The installation guide includes all the information re setup of the
connector on both the client and SAP instances.
Page 4 of 14
Contents
01_SAP-FI-GL_QVDGENERATOR.qvw
o Connection string for SAP
o Load script to extract relevant tables with calculations and associated key fields
o QVD creation script
02_SAP-FI-GL_LAYOUT.qvw
o Load script for previously created QVD's
o Dashboards and reports for SAP FI - General Ledger
3.2
Data Load
The first step in the process will be to create the qvd files which the layout application can read
from to populate the various reports contained within.
1. Copy both qvw files to a file location and create a folder for the QVD files.
2. Open 01_SAP-FI-GL_QVDGENERATOR.qvw and set the variables shown:
The SAP Language variable is used in the mapping loads for various
descriptions.
QVD Destination determines the location the resulting qvd files will be stored.
Page 5 of 14
The Fiscal Year will add a date to a where clause based on the following year
fields:
o BSEG - GJAHR
o BKPF - GJAHR
o FAGLFLEXT - RYEAR (New GL)
o GLT0 - RYEAR (Old GL)
The chart of account variable is used to generate the measures and hierarchies
for the general ledger and is added to the where clause of the following tables:
o BSEG - KTOPL (joined from T001)
o FAGLFLEXT - KTOPL (New GL joined from T001)
o GLT0 - KTOPL (Old GL joined from T001)
o SKAT - KTOPL
o FAGL_011ZC - KTOPL (New GL hierarchy)
o FAGL_011PC - VERSN (New GL hierarchy)
o SETLEAF - KTOPL (Old GL hierarchy)
o SETNODE - SUBCLASS (Old GL hierarchy)
The New G/L variable will determine which parts of the script will be run and
which tables are extracted:
o Old GL
Fact Table - GLT0
Hierarchy tables - SETNODE,SETLEAF,SETHEADERT
o New GL
Fact Table - FAGLFLEXT
Hierarchy tables - FAGL-011ZC, FAGL_011PC, FAGL_011QT
An additional filter is available if New G/L Tables is set to 'N' this caters for an
additional where clause on the SETLEAF table where SETCLASS = '0109'
indicating G/L hierarchy.
3. Open the script editor and add your connection string using the QVSAPConnector.dll
option.
4. Reload the script.
Page 6 of 14
The QVD location is the folder where the pre extracted qvd files are generated
from the first step
The New G/L variable will determine which parts of the script will be run and
which tables are to be loaded from qvd files:
o Old GL
Fact Table - GLT0_General_Ledger_Totals,qvd
Hierarchy tables - PANDL_OLD_Expanded.qvd,
SKAT_OLD_Chart_Of_Accounts.qvd
o New GL
Fact Table - FAGLFLEXT_General_Ledger_Totals.qvd
Hierarchy tables - PANDL_Expanded.qvd,
SKAT_Chart_Of_Accounts.qvd
Reload the application.
Page 7 of 14
4 Script Details
4.1
The extraction script will connect to SAP and pull information from the following tables
described below:
Table
T001
T003T
TKA01
TGSBT
T074A
T074T
BSEG
T004T
BKPF
FAGLFLEXT (New G/L)
GLT0 (Old G/L)
SKB1
SKA1
SKAT
FAGL_011ZC (New G/L)
FAGL_011PC (New G/L)
FAGL_011QT
SETLEAF
SETNODE
SETHEADERT
CSKT
T894T
KNA1
LFA1
Description
Company Codes
Document Type Descriptions
Controlling Areas
Business Area Descriptions
Special G/L Transaction Type Descriptions
Special G/L Indicator Descriptions
Accounting Document Segment
Chart of Account Descriptions
Accounting Document Header
General Ledger Totals
General Ledger Totals
G/L Account Master Company Code
G/L Account Master Chart of Accounts
G/L Chart of Accounts Description
Assignment FS Items
Items in Financial Structure
Text for Financial Items
Values in Sets
Lower Level Sets in Sets
Sets Descriptions
Cost Centre Descriptions
Version Type Descriptions
Customer Master
Vendor Master
Each table has a key field prefixed with '%' these fields are hidden from the main reporting
application via the SET HidePrefix = '%' command on the main tab.
4.2
Calculated Fields
The extraction process contains a number of calculated fields used in the front end analysis
application as shown below:
Table
BSEG
Column
Sp.G/L
trans.type.name_LT
Calculation
Applymap('T074A', UMSKS)
Page 8 of 14
Description
Special ledger transaction
type names
BSEG
BSEG
EXT
Amount in
LC_DMBTR
Special G/L
ind.name_LTEXT
if(SHKZG='H',-1,1) *
DMBTR
ApplyMap('T074T',KOART&'
/'&UMSKZ)
BSEG
if([AUGDT]='',0,1)
BSEG
Open/Closed Item
if([AUGDT]='','Open
Item','Closed Item')
BSEG
Debtor/Creditor Flag
if(KUNNR <>'','D','C')
BSEG
Debit/Credit_Flag_S
HKZG
if(SHKZG =
'S','Debit','Credit')
T001
KTPLT
applymap('T004T',KTOPL)
FAGLFLEXT
Amt.Trans.Currency
_Debit_TSL
if(DRCRK =
'S',Amt.Trans.Currency_T
SL,0)
FAGLFLEXT
Amt.Trans.Currency
_Credit_TSL
if(DRCRK =
'H',Amt.Trans.Currency_T
SL,0)
FAGLFLEXT
Controlling Area
Description_BEZEI
Debit/Credit_Flag_D
RCRK
ApplyMap('TKA01', KOKRS)
Controlling area
descriptions
Debit /credit flag
ApplyMap('TGSBT',RBUSA)
FAGLFLEXT
Business Area
Name_GTEXT
Bal. c/f TC_TSLVT
if(Period=1,[TSLVT],0)
FAGLFLEXT
if(Period=1,[HSLVT],0)
GLT0
Amt.Trans.Currency
_Debit_TSL
if(DRCRK =
'S',Amt.Trans.Currency_T
SL,0)
GLT0
Amt.Trans.Currency
_Credit_TSL
if(DRCRK =
'H',Amt.Trans.Currency_T
SL,0)
GLT0
Controlling Area
Description_BEZEI
Debit/Credit_Flag_D
RCRK
ApplyMap('TKA01', KOKRS)
Controlling area
descriptions
Debit /credit flag
Business Area
Name_GTEXT
Bal. c/f TC_TSLVT
ApplyMap('TGSBT',RBUSA)
if(Period=1,[TSLVT],0)
FAGLFLEXT
FAGLFLEXT
GLT0
GLT0
GLT0
if(DRCRK =
'S','Debit','Credit')
if(DRCRK =
'S','Debit','Credit')
Page 9 of 14
GLT0
if(Period=1,[HSLVT],0)
SKAT
SKAT_SAKNR_G/L
ACCOUNT NO
num([SAKNR],'0000000000'
)
SETLEAF
VALFROM
num([VALFROM],'000000000
0')
SETLEAF
VALTO
num([VALTO],'0000000000'
)
Formatting of valid to
account number
4.3
Fact Tables
The extraction contains a multistage process to produce the main fact table used for either the
new G/L (FAGLFLEXT) or old G/L tables (GLT0), the steps below show examples of the new G/L
fact table FAGLFLEXT, the methodology is the same for GLT0:
Step 1:
Create a temporary table from the source GL table - (FAGLFLEXT) with keys required for later
stages, the first extraction loads the period values for both local (HSL01-16) and transaction
(TSL01-16) currency types.
[FAGLFLEXT_Temp]:
// General Ledger: Totals
Load
[RCLNT] &'/'& [RLDNR] &'/'& RYEAR &'/'& [DRCRK] &'/'& [RBUKRS] & '/' & [RACCT] &'/'&
[RBUSA] &OBJNR00 & OBJNR01 & OBJNR02 & OBJNR03 & OBJNR04 & OBJNR05 & OBJNR06 & OBJNR07
& OBJNR08 AS %KEY_FAGLFLEXT,
[RCLNT] &'/'& [RBUKRS] as [%MANDT/BUKRS_KEY],
[RCLNT]& '/' &[RBUKRS]& '/' &[RYEAR]& '/' &[RACCT]&'/'&[RBUSA] as
[%MANDT/BUKRS/GJAHR/HKONT/GSBER_KEY],
[RCLNT]& '/' &[RLDNR]& '/' & [RVERS] as [%MANDT/RLDNR/RVERS_KEY],
[KOKRS].................
Step 2:
Load chart of account for company codes with descriptions ready to link back to the fact table
via company code and client.
[T004T]:
// Chart of Account Names
mapping Load
[KTOPL],
[KTPLT];
SQL Select KTOPL KTPLT from T004T
WHERE SPRAS = '$(vLanguage)';
//T001: Company Master
Left Join (FAGLFLEXT_Temp)
LOAD
MANDT &'/'& BUKRS as [%MANDT/BUKRS_KEY],
[KTOPL],
applymap('T004T',KTOPL) as [KTPLT],
[BUTXT];
Page 10 of 14
from T001;
Step 3:
Create a single column for amount and a single column for period (crosstable function) from the
temporary table loaded in step 1. This step caters for both TSL (transaction) and HSL (local)
values which are joined later.
FAGLFLEXT_TSL:
CrossTable(Period, Amt.Trans.Currency_TSL, 28)
LOAD [%KEY_FAGLFLEXT],
[%MANDT/BUKRS_KEY],
[%MANDT/BUKRS/GJAHR/HKONT/GSBER_KEY],
[%MANDT/RLDNR/RVERS_KEY],
[KTOPL],
[KTPLT],
[BUTXT],
[KOKRS],
[PRCTR],
[AWTYP],
[TIMESTAMP],
[RCLNT],
[RLDNR],
[RRCTY],
[RVERS],
[RYEAR],
[RTCUR],
[RUNIT],
[DRCRK],
[RBUKRS],
[RACCT],
[ACTIV],
[RMVCT],
[COST_ELEM],
[RBUSA],
[RCNTR],
[TSLVT],
[HSLVT],
[TSL01] as 1,
[TSL02] as 2,
[TSL03] as 3,
[TSL04] as 4,
[TSL05] as 5,
[TSL06] as 6,
[TSL07] as 7,
[TSL08] as 8,
[TSL09] as 9,
[TSL10] as 10,
[TSL11] as 11,
[TSL12] as 12,
[TSL13] as 13,
[TSL14] as 14,
[TSL15] as 15,
[TSL16] as 16
Resident FAGLFLEXT_Temp;
//Create column for period and HSL values with crosstable
FAGLFLEXT_HSL:
Page 11 of 14
CrossTable(Period, Amt.Local.Currency_HSL, 2)
LOAD [%KEY_FAGLFLEXT],
[DRCRK] as [Debit/Credit Ind.HSL_DRCRK],
[HSL01] as 1,
[HSL02] as 2,
[HSL03] as 3,
[HSL04] as 4,
[HSL05] as 5,
[HSL06] as 6,
[HSL07] as 7,
[HSL08] as 8,
[HSL09] as 9,
[HSL10] as 10,
[HSL11] as 11,
[HSL12] as 12,
[HSL13] as 13,
[HSL14] as 14,
[HSL15] as 15,
[HSL16] as 16
Resident FAGLFLEXT_Temp;
Step 4:
Rename columns and join HSL/TSL values for final fact table production
Step 5:
Drop temporary columns used in previous steps not required for analysis and store to qvd file
4.4 Hierarchies
The extraction contains a multistage process to produce the hierarchies used for either the new
G/L (FAGL_011ZC,FAGL_011PC,FAGL_011QT) or old G/L tables
(SETLEAF,SETNODE,SETHEADERT), the steps below show examples of the new G/L
hierarchies, the methodology is the same for SETNODE etc:
Step 1:
Load all the Chart of accounts descriptions for language and COA entered into variable and
create a key as a link to the fact table.
SKAT:
// G/L Account Master Record (Chart of Accounts: Description)
Load
[MANDT]&'/'&[KTOPL]&'/'&[SAKNR]
as [%MANDT/KTOPL/SAKNR_KEY],
num([SAKNR],'0000000000')
as [SKAT_SAKNR_G/L ACCOUNT NO],
[SAKNR]
as [G/L Account_SAKNR],
[TXT50]
as [Account Number Long Text_TXT50],
[TXT20]
as [Account Number Short Text_TXT20];
SQL Select MANDT TXT20 KTOPL MCOD1 SAKNR TXT50 from SKAT
WHERE SPRAS = '$(vLanguage)' and KTOPL = '$(vKTOPL)';
Step 2:
Page 12 of 14
Load the ranges of account numbers (from and to) with the associated financial statement item
filtered with the chart of account variable, this assumes the financial statement version and chart
of account code are the same.
[FAGL_011ZC]:
// Fin. Statement Structure: Assignment FS Items - G/L Account
Load
[MANDT] &'/'& [VERSN] &'/'& [ERGSL] as [%HIER_MANDT/VERSN/ERGSL_KEY],
[VERSN]
as [Fin.Stmt Vers._VERSN],
[VONKT]
as [Account from_VONKT],
[BISKT]
as [Account to_BISKT];
SQL Select MANDT VERSN KTOPL ERGSL VONKT BISKT XSOLL XHABN XVERD from FAGL_011ZC
where KTOPL = '$(vKTOPL)' and VERSN = '$(vKTOPL)'
;
Step 4:
Link the account code ranges from the previous step to the SKAT table to create a single table
with an interval match, finally remove temporary tables and store to qvd.
//Join on account code ranges
Inner Join (FAGL_011ZC)
intervalmatch([SKAT_SAKNR_G/L ACCOUNT NO])
Load
[Account from_VONKT],
[Account to_BISKT]
resident FAGL_011ZC;
Left Join(SKAT)
Load * resident FAGL_011ZC;
Drop Table FAGL_011ZC;
//Store into individual qvd files per chart of account
store SKAT into $(vDirectoryPath)SKAT_Chart_Of_Accounts.qvd;
drop table SKAT;
Step 5:
Load the parent and child relationships for the financial statement structure and join the financial
statement item descriptions.
[HierTemp]:
// Fin. Statement Structure: Items in Fin. Statement Structure
Load
[MANDT] &'/'& [VERSN] &'/'& [ERGSL]
as [%HIER_MANDT/VERSN/ERGSL_KEY],
[ID]
as [NODE_ID],
[PARENT]
as [PARENT_ID],
[ERGSL]
as [FS Item_ERGSL],
[STUFE]
as [Hierarchy level_STUFE];
SQL Select MANDT VERSN ID PARENT TYPE AEDAT USNAM SIGN CHILD STUFE ERGSL NEXTN SUMME
from FAGL_011PC where VERSN = '$(vKTOPL)'
;
Page 13 of 14
HierTemp2:
load [%HIER_MANDT/VERSN/ERGSL_KEY],
[NODE_ID],
[PARENT_ID],
[FS Item_ERGSL],
[FS Item_ERGSL] &'-'&Description as [FS Hierarchy],
[Hierarchy level_STUFE]
Resident HierTemp;
drop table HierTemp
Step 6:
Create a flattened hierarchy and store to qvd
PANDL_Expanded:
hierarchy(NODE_ID,PARENT_ID,[FS Hierarchy],PARENTNAME,[FS Hierarchy],PATH,'/',DEPTH)
LOAD [%HIER_MANDT/VERSN/ERGSL_KEY],
[NODE_ID],
[PARENT_ID],
[FS Item_ERGSL],
[FS Hierarchy]
Resident HierTemp2;
drop table HierTemp2;
//Store into individual qvd files for chart of account
store PANDL_Expanded into $(vDirectoryPath)PANDL_Expanded.qvd;
drop table PANDL_Expanded;
Page 14 of 14