Data Selection Types In InfoPackage

advertisement
Data Selection Types In
InfoPackage
Applies to:
SAP NetWeaver BW 3.x.For more information, visit the Business Intelligence homepage. .
Summary
The objective of this paper is to explain the use of Data Selection Types in InfoPackage which allows
extracting the data selectively according to user requirement.
Author:
Rudra Pradeep Reddy Neelapu
Company: Mahindra Satyam
Created on: 3 July 2009
Author Bio
Working as a SAP Technical consultant with Mahindra Satyam.Skill set includes SAP Business Intelligence, ABAP and Business Objects. SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
1
Data Selection Types In InfoPackage
Table of Contents: Introduction .........................................................................................................................................................3
Background Information......................................................................................................................................3
Step-by-Step Procedure: ....................................................................................................................................4
Business Scenario #1 .........................................................................................................................................6
Business Scenario #2 .........................................................................................................................................9
ABAP Routine: ..............................................................................................................................................10
Business Scenario #3 .......................................................................................................................................12
Related Content................................................................................................................................................16
Disclaimer and Liability Notice..........................................................................................................................17
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2
Data Selection Types In InfoPackage
Introduction
For periodically loading the data from the source system into the SAP BW system we need to change the
Selection field contents periodically (for example, date fields). We can attain this by choosing one of the
following selections in the Type entry column (Variable Changing of Selections with Background Processing)
from the Data Selection tab page of an Info Package.
Types (Variable Changing of Selections with Background Processing) are of 3 types:
•
5 Free temporal selection (for as many fields as you like)
•
6 ABAP routine
•
7 OLAP variables
Background Information
Below is a generalized scenario explaining this:
I have an ODS (ZSOURCE) with Monthly historical data, which need to be loaded into the Data Target Cube
(ZSELEC), whenever the data is loaded from the ODS (ZSOURCE) to Cube (ZSELEC) based on the field
0CALMONTH.
For the above scenario during the data extraction process, all the three Variable Types (“Variable Changing of
Selections with Background Processing“ ) are implemented on the 0CALMONTH for selective data extraction.
Below is the Source Data:
The raw data in “ZSOURCE” ODS contains the Product Code (ZORG) for a month (0Calmonth )along with a
code of Index(ZAS_CIRC ) and the number of products/items (0NO_POS) received by a customer.
We need the above data to be selectively loaded to the target “ZSELEC” based on business scenarios.
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
3
Data Selection Types In InfoPackage
Step-by-Step Procedure:
Prerequisite
Create a Cube : ZSELEC
To maintain the monthly based Product Code ,Product Index and number of items.
Below is the structure of my Data Target ZSELEC, taken same as that of Source.
Time Characteristics:
Key Figures:
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
4
Data Selection Types In InfoPackage
Below is the Generated InfoSource:
Assigned the Info Source 8ZSOURCE to Target ZSELEC and create the Update rules.
Create the Info Package for Loading the data from ODS (ZSOURCE).
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
5
Data Selection Types In InfoPackage
Business Scenario #1
Loading the data using the Variable Type:
Free temporal selection (for as many fields as you like).
In the Data Selection tab of Info Package we had the privilege provided to load the data selectively.
You need to select variable type for a field, confirm the selection, and then choose Detail for Type, an
additional dialog box appears. In this dialog box you can freely restrict the values of the fields.
InfoPackage:
In the Info Package select the Types, which results the below Variables.
In the first scenario, let us load the data or transactions for the month s of 05.2009 to 06.2009 using the option
of Free Temporal Selection “5”. Type 5 gives you a free selection of all fields.
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
6
Data Selection Types In InfoPackage
For the desired field 0CALMONTH we have confirmed variable type “5”.
On conformation it pops up a screen for entering the from value of 0Calmonth, To Value of 0Calmonth, Next
Period from Values and Period indicator. By providing these values you will be driven for entering the value for
Number of Periods until Repetition.
In my scenario, from value is 05.2009 and to value of 06.2009
With the above selection the data requested for time span 05.2009(200905) to 06.2009(200906) including
both the limit values.
Next period from value indicates the period for Second Data Request which spans between
07.2009(200907) to 08.2009(2000908),
In Period Indicator Type we have Year-Like Period (ongoing) and Year/Period-like.
We need to select the Period Indicator “1” Year/Period –Like which is sensible, with period type “0” the
request is carried out with ongoing values.
After the 8th run the system starts counting from 01.2010 (201001), as the Period Indicator is “1” Year/Period –
Like.
If the Period Indicator Type “0” (Year-Like Period (ongoing) is selected for the above scenario…
After the 8th run instead of starting the load from 01.2010 (201001), the scheduler starts over again with time
span 05.2009(200905) to 06.2009(200906) which is not sensible.
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
7
Data Selection Types In InfoPackage
On scheduling the Info Package, in the monitor screen you can observe the Selection field with Temporal
Free Selection Variable Value (200905-200906) in the header tab.
Below is the required data in Target ZSELEC, which are the list of products in the months 05.2009 to 06.2009.
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
8
Data Selection Types In InfoPackage
Business Scenario #2
Loading the data using the Variable Type:
Abap Routine “6”.
My Business scenario is to load the transactions of last month.
We can create an ABAP program that restricts the Info Object data or field data to be requested here based
on month (0CALMONTH). The ABAP routine has access to all selection fields and is the last to be processed
in the runtime.
If you select this variable type for a field in info package data selection tab and confirm the selection as Abap
Routine “6”, it pops up for a window to name the Routine
This further drives to code editor screen for Info package routine.
DATA: l_idx LIKE sy-tabix.
READ TABLE l_t_range WITH KEY
fieldname = 'CALMONTH'.
l_idx = sy-tabix.
*....
MODIFY l_t_range INDEX l_idx.
p_subrc = 0.
Above is the generated code with the fieldname = ‘CALMONTH’,We need to include our lines of code in
between to achieve the previous month by taking the system date as input.
When determining the data selection by routines, the single value selection and intervals were automatically
set for l_t_range-option = "EQ" and l_t_range-sign always = 'I'.
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
9
Data Selection Types In InfoPackage
ABAP Routine:
Info Package:
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
10
Data Selection Types In InfoPackage
On scheduling the Info Package, in the monitor screen you can observe the Selection field for CALMONTH as
06.2209 (200906) which is the result of the routine.
Below is the required data in Target ZSELEC, which are the list of products for the month of 06.2009.
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
11
Data Selection Types In InfoPackage
Business Scenario #3
Loading the data using the Variable Type:
OLAP Variables “7”.
My Business scenario is to load the transactions of last month.
The variable has to be a SAP- exit or customer-exit variable so that it can run as a background job. Variables
are placeholders for values and are not replaced by concrete values until a data request is made.
From the ROOSFIELD table you would be able to know the permitted select option for a variable like EQ, BT,
LT and CP. In such a case even if you use OLAP variable “7” it won't work for LT as the permitted values are
EQ, BT and CP.
Select the variable type” 7” OLAP Variables, confirm the selection, and then choose Detail for Type,
On selecting the Detail Type, a screen pops up, where you had the option to select the SAP defined Variables
or you can use the created Customer Exit variables based on the requirement.
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
12
Data Selection Types In InfoPackage
To meet the requirement we need to select the variable 0CMLMON defined on field 0CALMONTH, you can
even find the User defined variables highlighted in Blue, which can be created at the Query Designer for an
Info Object with variable type Customer Exit.
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
13
Data Selection Types In InfoPackage
On confirming the selection and executing the Info Package, in the Header tab of the Monitor we can observe
that the value of 0CALMONTH is 06.2009 (200906) i.e. Previous month.
Below is the required data in Target ZSELEC, which are the list of products between for the month of 06.2009
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
14
Data Selection Types In InfoPackage
Additional information for selection option types for a variable:
Below are the possible options for the fields from Data Source 8ZSOURCE, we can get the details from
ROOSFIELD.
The way the selections are filled at runtime depends on the Processing Type for the Variables .For the time
selections, you cannot use any variables that use a replacement path or require manual entry.
The system displays the selections in a table ROOSFIELD that would be determined with a data request. An
error occurs, terminating the process, if the variable is not suitable to determine the selection conditions.
Below are the possible select Options permitted for fields in the Data Source.
Here you can observe that CALMONTH (fieldname) is of type 7, which permits the Selection EQ, BT and CP.
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
15
Data Selection Types In InfoPackage
Related Content
Taken most of the inputs from sap help in preparing this Article.
https://forums.sdn.sap.com/thread.jspa?threadID=51288
https://forums.sdn.sap.com/thread.jspa?threadID=259383
https://forums.sdn.sap.com/thread.jspa?threadID=251958
https://forums.sdn.sap.com/thread.jspa?threadID=90997
http://help.sap.com/saphelp_nw04/helpdata/en/a3/4f8f3b294a7f2de10000000a11402f/frameset.htm
For more information, visit the Business Intelligence homepage.
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
16
Data Selection Types In InfoPackage
Disclaimer and Liability Notice
This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not
supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,
and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code
sample, including any liability resulting from incompatibility between the content within this document and the materials and services
offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.
SAP COMMUNITY NETWORK
© 2009 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
17
Download