Step by Step Approach for End Routine with Look Up

Similar documents
Implementation and Usage of Transformation End Routine in SAP BI 7.0

Step by Step Method for File Archival in BW

How to Write Inverse Routine with Expert Routine

Routines in SAP BI 7.0 Transformations

Using Rule Group in SAP-BI. Part - 1

Step by Step Procedure for DSO Creation

Standalone BW System Refresh

Using Nested Exception Aggregation in BEx Reports- Scenario

Process Chain Log Deletion

DB Connect with Delta Mechanism

Data Source Replication and Activation of Transfer Structures

Database Statistics During ODS Activation

Using Radio Buttons in Web Template

Role and Scope of ABAP in SAP BI

Replacement Path: Explained with an Illustrated Example

Step By Step: the Process of Selective Deletion from a DSO

SAP BW Copy Existing DTP for Data Targets

How to use Boolean Operations in the Formula as Subsidiary for IF Condition

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

How to Display Result Row in One Line While Reporting On Multiproviderer

Table Row Popup in Web Dynpro Component

Extracting Missing Fields of Data Source Which Are Present In Their Extract Structure

Maintaining Roles and Authorizations in BI7.0 - RSECADMIN

Reporting Duplicate Entries

MDM Syndicator: Custom Items Tab

Customized Transaction to Trigger Process Chain from Failed Step

Easy Lookup in Process Integration 7.1

Reading Enhanced DataSource fields for the Remote Cube

Recreating BIA Indexes to Address the Growth of Fact Index Table

Generate Export Data Source

Linking Documents with Web Templates

Creation of Sets in SAP-ABAP, How to Read them INI SAP-ABAP Reports

Cut Over Activities Specific for LIS* Data Sources

Performance Management in Data Loading: an Overview

Using Customer Exit Variables in BW/BI Reports Part - 1

Data Mining: Scoring (Linear Regression)

Data Flow During Different Update Mode in LO Cockpit

Data Extraction & DS Enhancement in SAP BI Step by Step

Explore to the Update Tab of Data Transfer Process in SAP BI 7.0

Errors while Sending Packages from OLTP to BI (One of Error at the Time of Data Loads through Process Chains)

Extraction of Hierarchy into Flat File from R/3 and Loading in BW System

Currency Translation in SAP BI Step by step Guide

Step-By-Step guide to Virtual InfoCube Implementation

SAP Net Weaver 400s BI 7.0For more information, visit the Business Intelligence homepage.

About ITAB Duplicate_Key (SAP lrsaods) Runtime Error

Procedure to Trigger Events in Remote System Using an ABAP Program

How to Work with F4 Input Help Effectively in BEX

Using Query Extract to Export Data from Business warehouse, With Pros and Cons Analyzed

Hierarchy in Business Objects with Expanded Hierarchy Logic

Implying Security on Business Object XI 3.1 Universe having SAP BW as Source

BW Reconciliation. Applies to: Summary. Author Bio

Using Customer Exit Variables in BW/BI Reports: Part - 14

Creation of Key Figures with Higher Decimal Place Precision

SMT (Service Mapping Tool)

Integrating POWL with WebDynpro ABAP

Steps to Activate ALE Delta for Custom Master Datasource Created on ZTable

Step by Step Guide on How to Use Cell Definition in BEx Query

Loading the Data for Time Dependent Hierarchy in SAP BI

Changing the Source System Assignments in SAP BW Objects without Affecting the Data Modeling

Validity Table in SAP BW/BI

How to Create Top of List and End of List of the ALV Output in Web Dynpro for ABAP

Developing Crystal Reports on SAP BW

SDN Community Contribution

Performance Tuning in SAP BI 7.0

Add /Remove Links on ESS Home Page in Business Package 1.5

Triggering the Process Chains at Particular Date using Events

Integration of Web Dynpro for ABAP Application in Microsoft Share Point Portal

Load Info Cube in SCM 5.0 (BI 7.0)

Deploying BusinessObjects Explorer on Top of a SAP BI Query

This article explains the steps to create a Move-in letter using Print Workbench and SAPScripts.

How to Default Variant Created for Report Developed In Report Painter/Writer

SAP BI Analysis Authorization (Customer Exit Variables)

Data Mining: Decision Trees

List of Values in BusinessObjects Web Intelligence Prompts

Information Broadcasting Part 3 Scheduling the First Report

Planning Functions and Characteristic Relationship in Integrated Planning

Freely Programmed Help- Web Dynpro

SDN Community Contribution

Download SAP Query Output to Local/ Network Folders in Background

Material Listing and Exclusion

ABAP Code - Recipients (Specific Format) SAP BW Process Chain

POWL: Infoset Generation with Web Dynpro ABAP

Financial Statement Version into PDF Reader

How to Configure User Status in mysap SRM

Material Master Archiving in Simple Method

Custom BADI Using Function Module UJQ_RUN_AXIS_QUERY

Customizing Characteristic Relationships in BW-BPS with Function Modules

How to Check BW system Before Go-Live

All about Compression

Limitation in BAPI Scheduling Agreement (SA) Create or Change

ecatt Part 6 System Data Container

Dynamically Enable / Disable Fields in Table Maintenance Generator

Using Customer Exit Variables in BW/BI Reports: Part - 4

MDM Import Manager - Taxonomy Data (Attribute Text Values) Part 3

Steps for Implementation of Standard Data Store Object (DSO) for Purchase Cube in SAP BI 7.0

Purpose of Goods Receipt Message indicator in Purchase Orders

Server Connectivity and Data Load from Non SAP System to BW

Roadblocks During SAP BI 7.0 Upgrade and Their Resolutions

How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3

Graphical Mapping Technique in SAP NetWeaver Process Integration

Transcription:

Step by Step Approach for End Routine with Look Up Applies to: SAP BW 3.x & SAP BI Net Weaver 2004s. For more information, visit the EDW homepage. Summary This document will give the reader detailed information with respect to implementation of an end routine for a business scenario where Header to Item look up is required. Author: Vikram Srivastava Company: Infosys Technologies Limited Created on: 22 August 2010 Author Bio Vikram Srivastava is working as Technology Analyst with Infosys Technologies Limited. He has got rich experience on various BW Implementation/Support Projects in both SAP BW 3.5 and SAP BW 7.0. 2010 SAP AG 1

Table of Contents Business Scenario... 3 Data Flow... 3 Understanding the Scenario with Example... 4 Data in Header DSO:... 4 Data in Item DSO:... 4 Output After Merging:... 4 Step by Step Approach... 5 Step 1:... 5 Step 2:... 5 Step 3:... 5 Step 4:... 6 Sample end Routine... 6 Step 5:... 10 Step 6:... 10 Related Content... 11 Disclaimer and Liability Notice... 12 2010 SAP AG 2

Business Scenario This article explains how to write an end routine for a business scenario where we want to merge the data or item and header by doing a lookup from header to item DSO. This is a common business scenario especially in the occasions where we want to show the article details along with the header information. One such example could be merging Sales Header and Item Data in one DSO. Data Flow Below shown the typical data flow which will be seen when we try to achieve the business scenario explained above. 2010 SAP AG 3

Understanding the Scenario with Example Data in Header DSO: Order Number Doc. type Request.dlv.dt S1 A 01.01.2010 S2 B 01.05.2010 Data in Item DSO: Order Number Item Number Article Item type Order quantity S1 10 A1 X 10 S1 20 A2 Y 20 S1 30 A5 X 15 S2 10 A3 Y 6 S2 20 A1 Y 15 Output After Merging: Order Number Item Number Doc. type Request.dlv.dt Article Item type Order quantity S1 10 A 01.01.2010 A1 X 10 S1 20 A 01.01.2010 A2 Y 20 S1 30 A 01.01.2010 A5 X 15 S2 10 B 01.05.2010 A3 Y 6 S2 20 B 01.05.2010 A1 Y 15 Here as we can see we are trying to show Document Type and Request Delivery Date from the header table along with the item information. In this scenario business wants the delta to be based on header instead of item. Note: While loading the data from Header DSO to the merged DSO the total number of records increases. Let s assume the name of the DSO s to be ZHEADER, ZITEM and ZMERGE. 2010 SAP AG 4

Step by Step Approach Step 1: Go to TCode RSA1 Step 2: Double Click on the Transformation where you want to write the routine. You get the below screen on the top. Step 3: Click on Create End Routine Below screen appears: 2010 SAP AG 5

Step 4: Write the end routine as shown in the below sample after the section: Sample end Routine Below is the code which can be used when trying to implement such scenario. PROGRAM trans_routine. *---------------------------------------------------------------------* * CLASS routine DEFINITION *---------------------------------------------------------------------* * *---------------------------------------------------------------------* CLASS lcl_transform DEFINITION. PUBLIC SECTION. This is the declaration done by the SAP while defining the class * Attributs DATA: p_check_master_data_exist TYPE RSODSOCHECKONLY READ-ONLY, 2010 SAP AG 6

*- Instance for getting request runtime attributs; * Available information: Refer to methods of * interface 'if_rsbk_request_admintab_view' p_r_request TYPE REF TO if_rsbk_request_admintab_view READ-ONLY. PRIVATE SECTION. TYPE-POOLS: rsd, rstr. * Rule specific types TYPES: BEGIN OF _ty_s_tg_1, * Field: RECORD. RECORD TYPE RSARECORD, * InfoObject: ZORDNUM Order Number. /BIC/ZORDUM TYPE /BIC/OIZORDNUM, * InfoObject: ZDOCTYP Document Type. /BIC/ZDOCTYP TYPE /BIC/OIDOCTYP, * InfoObject: ZDELDATE Request Delivery Date. /BIC/ZDELDATE TYPE /BIC/OIZDELDATE, * InfoObject: 0RECORDMODE BW Delta Process: Update Mode. RECORDMODE TYPE RODMUPDMOD, END OF _ty_s_tg_1. TYPES: _ty_t_tg_1 TYPE STANDARD TABLE OF _ty_s_tg_1 WITH NON-UNIQUE DEFAULT KEY. This is the declaration done by the SAP while defining the source structure (Header) *$*$ begin of global - insert your declaration only below this line *-*... "insert your code here *$*$ end of global - insert your declaration only before this line *-* METHODS new_record end_routine IMPORTING source_segid type rstran_segid source_record type sytabix EXPORTING record_new type sytabix. METHODS end_routine IMPORTING request datapackid EXPORTING monitor CHANGING RESULT_PACKAGE RAISING cx_rsrout_abort. METHODS inverse_end_routine IMPORTING i_th_fields_outbound type rsrequest type rsdatapid type rstr_ty_t_monitors type _ty_t_tg_1 TYPE rstran_t_field_inv i_r_selset_outbound TYPE REF TO cl_rsmds_set i_is_main_selection TYPE rs_bool i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set i_r_universe_inbound TYPE REF TO cl_rsmds_universe CHANGING c_th_fields_inbound TYPE rstran_t_field_inv c_r_selset_inbound TYPE REF TO cl_rsmds_set c_exact TYPE rs_bool. ENDCLASS. "routine DEFINITION 2010 SAP AG 7

*$*$ begin of 2nd part global - insert your code only below this line *... "insert your code here TABLES: /BIC/AZITEM00. DATA: ITAB2 TYPE STANDARD TABLE OF /BIC/AZITEM00. WITH HEADER LINE. DATA: WA LIKE LINE OF ITAB2. We declare some internal tables and work area of type of Item table *$*$ end of 2nd part global - insert your code only before this line * *---------------------------------------------------------------------* * CLASS routine IMPLEMENTATION *---------------------------------------------------------------------* * *---------------------------------------------------------------------* CLASS lcl_transform IMPLEMENTATION. * Method end_routine * Calculation of result package via end routine * Note: Update of target fields depends on rule assignment in * transformation editor. Only fields that have a rule assigned, * are updated to the data target. * <-> result package METHOD end_routine. *=== Segments === FIELD-SYMBOLS: <RESULT_FIELDS> TYPE _ty_s_tg_1. DATA: MONITOR_REC TYPE rstmonitor. *$*$ begin of routine - insert your code only below this line *-*... "insert your code here *-- fill table "MONITOR" with values of structure "MONITOR_REC" *- to make monitor entries DATA: ITAB_REFRESH TYPE STANDARD TABLE OF _TY_S_TG_1. DATA: ITAB_TARGET TYPE STANDARD TABLE OF _TY_S_TG_1. DATA: WA_TARGET LIKE LINE OF ITAB_TARGET. DATA : ICOUNT TYPE RSARECORD. We declare some local variables 2010 SAP AG 8

********************************************************** * Start of Routine ********************************************************** * Ensuring the source package is not empty IF RESULT_PACKAGE IS NOT INITIAL. ICOUNT = 1. REFRESH ITAB2. *Selecting records from Item DSO for which * Document no matches with the same of source package SELECT * FROM /BIC/AZITEM00 INTO TABLE ITAB2 FOR ALL ENTRIES IN RESULT_PACKAGE WHERE /BIC/ZORDNUM = RESULT_PACKAGE-/BIC/ZORDNUM. * Sorting for optimizing readaccess SORT ITAB2 BY /BIC/ZORDNUM. * Processing Refresh itab_target. SORT RESULT_PACKAGE BY /BIC/ZORDNUM /BIC/ZITEMNUM. LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>. LOOP AT ITAB2 INTO WA WHERE /BIC/ZORDNUM = <RESULT_FIELDS>-/BIC/ZORDNUM. This is the sample end routine. Here as we can see we are incrementing the record number. This is very crucial as if we do not do this we will face problems in activating the data from new table to active table as the record number had been the same. <RESULT_FIELDS>-/BIC/ZITEMNUM = WA-/BIC/ZITEMNUM. <RESULT_FIELDS>-MATERIAL = WA-MATERIAL. <RESULT_FIELDS>-/BIC/ZITMTYP = WA-/BIC/ZITMTYP. <RESULT_FIELDS>-QUANT_B = WA-QUANT_B. <RESULT_FIELDS>-BASE_UOM = WA-BASE_UOM. <RESULT_FIELDS>-RECORD = ICOUNT. ICOUNT = ICOUNT + 1. APPEND <RESULT_FIELDS> TO ITAB_TARGET. ENDLOOP. ENDLOOP. SORT ITAB_TARGET BY /BIC/ZINHUNUM /BIC/ZHUITEM. REFRESH RESULT_PACKAGE. RESULT_PACKAGE[] = ITAB_TARGET[]. ENDIF.... "to cancel the update process * raise exception type CX_RSROUT_ABORT. *$*$ end of routine - insert your code only before this line *-* ENDMETHOD. "end_routine 2010 SAP AG 9

* Method inverse_end_routine * * This subroutine needs to be implemented only for direct access * (for better performance) and for the Report/Report Interface * (drill through). * The inverse routine should transform a projection and * a selection for the target to a projection and a selection * for the source, respectively. * If the implementation remains empty all fields are filled and * all values are selected. * * METHOD inverse_end_routine. *$*$ begin of inverse routine - insert your code only below this line*-*... "insert your code here *$*$ end of inverse routine - insert your code only before this line *-* ENDMETHOD. "inverse_end_routine METHOD new_record end_routine. ***** IMPLEMENTATION is only visible in generated program ***** ENDMETHOD. ENDCLASS. "routine IMPLEMENTATION Step 5: Save and Activate. Step 6: Load the data, to get the desired output. 2010 SAP AG 10

Related Content http://wiki.sdn.sap.com/wiki/display/bi/business+intelligence+home http://help.sap.com/saphelp_nw04/helpdata/en/44/b4a0137acc11d1899e0000e829fbbd/content.htm http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/e73bfc19-0e01-0010-23bc-ef0ad53f2fab For more information, visit the EDW homepage 2010 SAP AG 11

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. 2010 SAP AG 12