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 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.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2010 SAP AG 1
APD: How to Get Delta if ‘Created On/Changed On’ Date Field Available
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
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2010 SAP AG 2
APD: How to Get Delta if ‘Created On/Changed On’ Date Field Available
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. Let’s explore…!
Business Scenario
Let’s 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.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2010 SAP AG 3
APD: How to Get Delta if ‘Created On/Changed On’ Date Field Available
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2010 SAP AG 4
APD: How to Get Delta if ‘Created On/Changed On’ Date Field Available
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.
ENDIF.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2010 SAP AG 5
APD: How to Get Delta if ‘Created On/Changed On’ Date Field Available
*&---------------------------------------------------------------------*
*& 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.
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
(The logic works like setting ‘Upper limit as ‘1’ as safety interval.)
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2010 SAP AG 6
APD: How to Get Delta if ‘Created On/Changed On’ Date Field Available
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 types-
1. 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)
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2010 SAP AG 7
APD: How to Get Delta if ‘Created On/Changed On’ Date Field Available
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.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2010 SAP AG 8
APD: How to Get Delta if ‘Created On/Changed On’ Date Field Available
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2010 SAP AG 9