Professional Documents
Culture Documents
APD - How To Get Delta If 'Created On - Changed On' Date Field Available
APD - How To Get Delta If 'Created On - Changed On' Date Field Available
Applies to:
SAP BW 3.x & SAP BI NetWeaver 2004s (BI7.0). For more information, visit the Business Intelligence
homepage.
Summary
Many times there are situations where your APD needs to extract delta records to flat file. If you have fields
like Created on or Changed on dates in your data source objects, then the delta can be possible using
Customer exit and SAP delivered TVARVC table.
Author:
Yogesh Patil
Author Bio
Yogesh Patil is working as Analyst Programmer with Accenture India Pvt. Ltd. He has got rich
experience on various BW Implementation/Support Projects in both SAP BW 3.5 and SAP BW
7.0.
Table of Contents
Introduction ................................................................................................................................................... 3
Business Scenario ........................................................................................................................................ 3
Step by Step Guide ....................................................................................................................................... 3
1. Create Variable on Created On InfoObject ............................................................................................. 3
2. Create Entry in TVARVC table ............................................................................................................... 4
3. Create Filter in APD ............................................................................................................................. 5
4. Create customer exit for your varible to populate Delta date parameters ................................................ 5
5. Create Custom ABAP program to maintain Delta date parameters ......................................................... 6
6. Process Chain ....................................................................................................................................... 7
Related Content ............................................................................................................................................ 8
Disclaimer and Liability Notice ....................................................................................................................... 9
Introduction
In SAP BW/BI, data from various databases from systems available in the company are collected,
consolidated, managed and prepared for evaluation purposes. There is often further, valuable potential in
this data.
It deals with completely new information that is displayed in the form of meaningful connectivity between data
but that is too well hidden or complex to be discovered by simple observation or intuition.
The Analysis Process Designer (APD) makes it possible to find and identify these hidden or complex
relationships between data in a simple way. Various data transformations are provided for this purpose, such
as statistical and mathematical calculations, and data cleansing or structuring processes.
The analysis results are saved in BW data targets or in a CRM system. They are available for all decision
and application processes and thus can be decisive (strategically, tactically, operatively).
One of the problem with the APD is it always do full extract from the data sources (DSOs, Master Data
InfoObjects) and there is not delta functionality provided.
But if you have Created On/Changed On Date fields populated in your data sources, then we can get delta
using TVARVC table and Customer Exit. Lets explore!
Business Scenario
Lets take an example- Suppose you are fetching data from DSO where Created On date is populated. This
data is used for calculating complex scenarios using other data and then send the output to the Flat file
which will be input file to some legacy system. As APD extract always all data from DSO which Customer
feels unnecessary and demand is SAP BI should be intelligent enough to send only delta records.
Below is the step by step process how to achieve delta based on Created On date available.
Go to InfoArea
Fig.1
Fig.2
Fig.3
Go to SM30 transaction
Press CTRL+F1
Press F5
Go to transaction RSANWB
Go to Properties of this filter -> Field Selection and select Created on Date
4. Create customer exit for your varible to populate Delta date parameters
Go to CMOD and navigate to Function exit EXIT_SAPLRRS0_001.
Implement below code in INCLUDE ZXRSRU01************************************************************************
* Author:
Yogesh Patil
*
* Variable : ZDELTA_DATE - Get Delta date range
*
* Description: This variable is used in APD processes in
*
*
filters. It contains Delta date range
.
*
************************************************************************
*
PLEASE DO NOT USE THIS VARIBLE for any other Object
*
*
It should be used by APD - XXXXXXXX
*
************************************************************************
WHEN 'ZDELTA_DATE'.
DATA: ls_tvrv TYPE STANDARD TABLE OF tvarvc WITH HEADER LINE.
DATA: lv_date TYPE sy-datum.
**********************************************************************
* Please note that the Variables are determined in program - ZGET_DELTA_DATE
* And this program should be run before APD XXXXXXXX run to set delta parameters
**********************************************************************
IF i_step = 1.
CLEAR l_s_range.
SELECT SINGLE * FROM tvarvc INTO CORRESPONDING FIELDS OF ls_tvrv
WHERE name = 'ZDELTA_DATE_APD1'.
IF sy-subrc = 0.
l_s_range-low = ls_tvrv-low. "Last Run
l_s_range-high = ls_tvrv-high. "Current Run
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range.
ENDIF.
ENDIF.
*&---------------------------------------------------------------------*
*& Report ZGET_DELTA_DATE
*&
*&---------------------------------------------------------------------*
************************************************************************
* Author:
Yogesh Patil
*
* Variable : ZDELTA_DATE - Get Delta date range
*
* Description: This variable is used in APD processes in
*
*
filters. It contains Delta date range
.
*
************************************************************************
*
PLEASE DO NOT USE THIS VARIBLE for any other Object
*
*
It should be used by APD - XXXXXXXX
*
************************************************************************
REPORT ZGET_DELTA_DATE.
DATA: ls_tvrv TYPE STANDARD TABLE OF tvarvc WITH HEADER LINE.
data: lv_date type Sy-datum,
lv_date2 TYPE sy-datum.
SELECT SINGLE * FROM tvarvc INTO CORRESPONDING FIELDS OF ls_tvrv
WHERE name = 'ZDELTA_DATE_APD'.
IF sy-subrc = 0.
lv_date = ls_tvrv-high. "Last run- High Value
lv_date2 = sy-datum - 1.
if lv_date lt lv_date2.
lv_date = lv_date + 1.
endif.
ls_tvrv-low = lv_date.
lv_date
= sy-datum - 1.
ls_tvrv-high = lv_date.
"Current Run
MODIFY tvarvc FROM ls_tvrv. "Update Variables
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
ENDIF.
6. Process Chain
The APD should run using Process chain to work delta
functionality and to set parameters correctly.
So create Process chain which will have two ABAP
program process types1. To run ZGET_DELTA_DATE program
2. To run APD using standard program
RSAN_PROCESS_EXECUTE
(Refer-How To Use Analysis Process in Process
Chains)
Related Content
Analysis Process Designer (APD) Step by Step
How To Use Analysis Process in Process Chains
http://forums.sdn.sap.com/thread.jspa?threadID=1577721
For more information, visit the Business Intelligence homepage.