return table
TRANSCRIPT
-
8/8/2019 return table
1/20
How t o use Return Tab le in UpdateRules
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 Return Table concept in Update Rules which allowsdistributing aggregated value and also helps to attain the structured data according to user requirement.
Author: Rudra Pradeep Reddy Neelapu
Company: Satyam Computer Services Ltd.
Created on: 26 May 2009
Author Bio
Working as a SAP Technical consultant with Satyam Computer Services Ltd.Skill set includesSAP Business Intelligence, ABAP and Business Objects.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
2/20
How to use Return Table in Update Rules
Table of Contents
Introduction .........................................................................................................................................................3Business Scenario #1 .........................................................................................................................................3
Background Information..................................................................................................................................4Step-by-Step Procedure..................................................................................................................................5
Prerequisite..................................................................................................................................................................5Code for Scenario # 1 .....................................................................................................................................8
Start Routine:...............................................................................................................................................................8Update Routine: ...........................................................................................................................................................9
Business Scenario #2 .......................................................................................................................................12Background Information................................................................................................................................12Step-by-Step Procedure................................................................................................................................13
Prerequisite................................................................................................................................................................13Code for Scenario #2 ....................................................................................................................................16
Related Content................................................................................................................................................19Disclaimer and Liability Notice..........................................................................................................................20
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
3/20
How to use Return Table in Update Rules
Introduction
Return table in Update rules is used to generate additional records based on one data record. It returnsmultiple records by splitting the single record based on the specified conditions.
Update routines generally only have one return value. However, in the Data Field Calculation tab strip, youcan create a routine by choosing the Return table option. The corresponding key figure or characteristic fieldfor which routine now has a return table instead of a return value. Using this we can generate multiple recordsfrom one data record. In Routines with Return Table the RESULT parameter is replaced with theRESULT_TABLE. The return table has the same structure as the data target. We can fill the key figure or data
field, for which the routine was created, plus its characteristics or key fields. The calculated characteristicvalues are stored in the ICUBE_VALUES structure. We can fill the RESULT_TABLE return table by copyingthe ICUBE_VALUES structure and only fil l the corresponding key figure and adjust the characteristic values.Using this Return Table allows you to distribute aggregated values and also helps in attaining the structureddata as required.
Business Scenario #1
To distribute aggregated value using Return Table Concept.
Our source delivers revenue generated by an Organization which needs to be distributed across its Servicesbased on %Revenue Share of each service.
Source data record structure is as follows:
Organization Revenue
10009 1000
Revenue generated by the Organization need to be distributed across its services, based on its contribution inRevenue using %Revenue Share.
Organization Service %Revenue Share
10009 A 0.50
10009 B 0.25
10009 C 0.10
We can attain the Revenue value generated by each service using the Return Table in Update Rules by
splitting the single data record of Organization revenue across its Services.
Organization Service Revenue by Service
10009 A ??
10009 B ??
10009 C ??
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
4/20
How to use Return Table in Update Rules
Note: If you use a key figure routine with return table and additional currency translation, the currencies are NOT stored inICUBE_VALUES structure, because they are only calculated once the routine has been executed.
In this scenario fixed currency is used; the currency is fixed for the amount. The key figure refers specifically tothe currency (here USD), so the currency does not have to be entered again in the data record.
Background Information
The Data Source delivers the Organization Revenue. The following processing steps are required in theUpdate Rules:
Read the master data table with the Services in the Organization and its % revenue Share in the StartRoutine.
Create a Routine with Return table selected, to divide the key figure (Revenue of Organization) by itsServices that have been read from the master data table.
Create an entry in the return table for each Service.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
5/20
How to use Return Table in Update Rules
Step-by-Step Procedure
Prerequisite
Create Master Data ODS: ZSER
To maintain the organization Services and %Revenue share.
In this scenerio I am maintaing the same with a flat file.Data in ODS ZSER is maintained as below.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
6/20
How to use Return Table in Update Rules
Create an ODS: Z_RTRNCreate an Info Provider with the final structure which in turn is the RETURN TABLE Structure.
Create Data Source: ZIS_RTRNIt has the structure of Source Data Record.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
7/20
How to use Return Table in Update Rules
Create Update Rules between the Data Source ZIS_RTRN and ODS Z_RTRN.
Create a Start Routine to fetch the Master Data of Services of an Organization and its contribution Share intoan internal table.
Now create a Routine by selecting the Return table option for filed ZREV which gives us the Revenuegenerated by each Share in the total Organization Revenue.
Now the code is written for the Field ZREV and its corresponding Characteristics and key fields can be filled
simultaneously using the Return Table.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
8/20
How to use Return Table in Update Rules
Code for Scenario # 1
Start Routine:
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
9/20
How to use Return Table in Update Rules
Update Routine:
Here we are filling the RESULT_TABLE, which contains the structure of our data target Z_RTRN withICUBE_VALUES; hence all the Characteristic values are copied to it.
We are appending each of the field to the RESULT_TABLE by looping across internal table itab, whichcontains the master data of Services across the Organization and its contribution Share.
We are calculating the Revenue generated by each service by its share contribution.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
10/20
How to use Return Table in Update Rules
For the above scenario we have to create a Flat File (.csv) corresponding to the Data Source structure. Createan Info Pack for the data source.
Flat File Structure:
Organization Revenue
10009 1000
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
11/20
How to use Return Table in Update Rules
Preview of the data record
And schedule the load
We can observe that the single data record has been split to 3 records in the Update Rules based on theServices offered by Organization.
Below is the required result of service wise revenue generated across an Organization.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
12/20
How to use Return Table in Update Rules
Business Scenario #2
We can attain the required structure for the data by formatting the input source data using Return TableConcept.
The data records form R/3 had Issue descriptions corresponding to a key filed Item Code in more than onecolumn in a single row. In BW end we require to display the issues encountered by an item in a single columnone below the other.
Source data record structure is as follows:Item Code Issue 1 Issue 2
10008 Lack of durability Unavailability of Spare parts
10009 Frequent issues High cost
Need to display all the issues against a product in a Single Column. This can be attained using the ReturnTable in Update Rules.
Item Code Issue
10008 Lack of durability
10008 Unavailability of Spare parts
10009 Frequent issues
10009 High cost
Background Information
The Data Source delivers the Item Code with descriptions of Issue1 and Issue2.
The following processing steps are required in the Update Rules:
Create a Routine with Return table selected, to append the Issue2 description record to item withIssue1.For attaining this we maintain a temporary key filed ZON_ASID along with item code as weare loading into an ODS in this scenario, to avoid the possibility of records getting overwritten.
Create an entry in the return table for each Issue Description.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
13/20
How to use Return Table in Update Rules
Step-by-Step Procedure
Prerequisite
Create a ODS: ZRETURN
Create an Info Provider with the final structure which in turn is the RETURN TABLE Structure.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
14/20
-
8/8/2019 return table
15/20
How to use Return Table in Update Rules
Create Update Rules between the Data Source ZRETURN and ODS ZRETURN.
Now Create a Routine for field ZPRI_SO1 (Issue) with Return table Option Selected.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
16/20
How to use Return Table in Update Rules
Code for Scenario #2
Now the code is written for the Field ZPRI_SO1 and its corresponding Characteristics and key fields can befilled simultaneously using the Return Table.
We are appending each of the field to the RESULT_TABLE based on the issue description. As we are loadingthe data into ODS we are appending the description of Issue2 of first item code to Issue 1 description by usinga temporary field ZON_ASID.
For the above Scenario Create a Flat File (.csv) corresponding to the Data Source structure.Create an Info Pack for the data Source.
Flat File Structure:
Item Code Issue 1 Issue 2
10008 Lack of durability Unavailability of Spare parts
10009 Frequent issues High cost
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
17/20
How to use Return Table in Update Rules
Preview of the data record
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
18/20
How to use Return Table in Update Rules
Schedule the Load.
We can observe that the 2 data record has been split to 4 records in the Update Rules i.e. one record gotappended below the other.
Below is the required result of Issue Description for an Item Code.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
19/20
How to use Return Table in Update Rules
Related Content
Taken most of the inputs from sap help in preparing this Article.
http://help.sap.com/saphelp_nw04/helpdata/en/7f/61fc37f456491ee10000009b38f8cf/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/21/894eeee0b911d4b2d90050da4c74dc/frameset.htm
https://www.sdn.sap.com/irj/scn/thread?messageID=6293014#6293014
https://www.sdn.sap.com/irj/scn/thread?messageID=515459For more information, visit the Business Intelligence homepage.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG
-
8/8/2019 return table
20/20
How to use Return Table in Update Rules
Disclaimer and Liability Notice
This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is notsupported 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 codesample, including any liability resulting from incompatibility between the content within this document and the materials and servicesoffered 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.