This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
SAP NetWeaver Business Warehouse (Formerly BI), Will also work on SAP BW 3.5/SAP BI 7.X. For more information, visit the EDW homepage
Summary
This Article tells about, “How to write a Start Routine in Update Rules, Transformations and How to Debug the Routines”. Here I taken one example i.e., needs to delete the unwanted data in Start Routine of Update Rules/Transformations based on Customer number.
Author: Surendra Kumar Reddy Koduru
Company: ITC Infotech India Ltd. (Bangalore/INDIA)
Created on: 20 June 2011
Author Bio
Surendra Kumar Reddy Koduru is a SAP BI Lead Consultant currently working with ITC Infotech India Ltd (Bangalore/INDIA). He has got rich experience and worked on various BW/BI Implementation/Support Projects and he is the author for various Articles and Blogs (SAP-BW/BI) in
How to Write a Start Routine in Update Rules: .................................................................................................. 3 Introduction: ........................................................................................................................................................ 3 Live Scenario: ..................................................................................................................................................... 3
InfoCube Details: ............................................................................................................................................. 3 Create Start Routine: ...................................................................................................................................... 4 Code before Start Routine: ............................................................................................................................. 5 Code After Start Routine: ................................................................................................................................ 6 Data Loading: .................................................................................................................................................. 9 Monitor the Data Load:.................................................................................................................................. 10 Request Details: ............................................................................................................................................ 12 Display Data in InfoCube: ............................................................................................................................. 13
Data in PSA : ............................................................................................................................................................. 13 Data in Source Flat File: ............................................................................................................................................ 14
How to Debug the Start Routine in Update Rules: ........................................................................................... 14
Change Start Routine:................................................................................................................................... 14 Data Loading: ................................................................................................................................................ 16
Monitor the Data Load:.................................................................................................................................. 17 Manual Update/Simulation: ........................................................................................................................... 18 Debugger Window: ........................................................................................................................................ 19 Our Code: ...................................................................................................................................................... 19 Data Package: ............................................................................................................................................... 20
How to Write Start Routine in Transformations: ............................................................................................... 22 Introduction: ...................................................................................................................................................... 22
Live Scenario: ............................................................................................................................................... 22 InfoCube Details: ........................................................................................................................................... 22 Create Start Routine: .................................................................................................................................... 23 Code Before Start Routine: ........................................................................................................................... 24 Code After Start Routine: .............................................................................................................................. 27 Data Loading: ................................................................................................................................................ 31 Monitor the Data Load:.................................................................................................................................. 33 Request Details: ............................................................................................................................................ 36 Display Data in InfoCube: ............................................................................................................................. 37
Data in PSA: .............................................................................................................................................................. 37 Data in Source Flat File: ............................................................................................................................................ 38
How to Debug Start Routine in Transformations: ............................................................................................. 38 Introduction: ...................................................................................................................................................... 38
Live Scenario: ............................................................................................................................................... 38 Change Start Routine:................................................................................................................................... 38 Data Loading: ................................................................................................................................................ 40
Monitor the Data Load:.................................................................................................................................. 41 DTP and Settings for Debug: ........................................................................................................................ 42 Debugger Window: ........................................................................................................................................ 45
Related Content ................................................................................................................................................ 48 Disclaimer and Liability Notice .......................................................................................................................... 49
How to Write Start Routine in Update Rules, Transformations and How to Debug the Routines
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
“How to write a Start Routine in Update Rules”. Here I taken one example i.e., needs to delete the unwanted data in Start Routine of Update Rules based on Customer number.
Live Scenario:
We are loading the data to InfoCube, the Source system is Flat File (the logic, code and execution is same for even any SAP Source systems also) and we need to delete the unwanted records/data in Update rules at the time of data loads based on some Customer numbers.
InfoCube Details:
See the below screens, which will give the details of the InfoCube ZIC_DEMO2.
How to Write Start Routine in Update Rules, Transformations and How to Debug the Routines
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Write the below code in code window, here I written Customer is equal to 000000C100 or C100, because 0CUSTOMER length is 10 and so if record will come with or without leading zeros the code will work.
PROGRAM UPDATE_ROUTINE.
*$*$ begin of global - insert your declaration only below this line *-*
* TABLES: ...
* DATA: ...
*$*$ end of global - insert your declaration only before this line *-*
* The follow definition is new in the BW3.x
TYPES:
BEGIN OF DATA_PACKAGE_STRUCTURE.
INCLUDE STRUCTURE /BIC/CSZIS_DEMO2.
TYPES:
RECNO LIKE sy-tabix,
END OF DATA_PACKAGE_STRUCTURE.
DATA:
How to Write Start Routine in Update Rules, Transformations and How to Debug the Routines
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Click on Header Tab and then click on Termination if records occur…, see below screen.
It opens the detailed window about the status of records updating, see below screen, totally we have 5 records in Flat file and 5 sent and 5 received, PSA got 5 records, but finally updated only One record in InfoCube, because Start Routine in Update rules worked properly.
How to Write Start Routine in Update Rules, Transformations and How to Debug the Routines
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
We have 5 records in Flat File, so it deleted all 4 records which will satisfy our Condition in Start Routine and the rest of the records i.e. only one will appear in DATA PACKAGE, see below screen.
Then press F8.
Close the above window it will display the details of the records updated. After that Load data manually from PSA to InfoCube then see the Request/Data in InfoCube.
How to Write Start Routine in Update Rules, Transformations and How to Debug the Routines
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
“How to write a Start Routine in Transformations”. Here I took one example i.e., needs to delete the unwanted data in Start Routine of Transformations based on Customer number.
Live Scenario:
We are loading the data to InfoCube, the Source system is Flat File (the logic, code and execution is same for even any SAP Source systems also) and we need to delete the unwanted records/data in Transformations at the time of data loads based on some Customer numbers.
InfoCube Details:
See the below screens, which will give the details of the InfoCube ZIC_DEMO1.
Note: I had taken ZIC_DEMO1 InfoCube, which is having just simple Transformations.
How to Write Start Routine in Update Rules, Transformations and How to Debug the Routines
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Write the below code in code window, here I written Customer is equal to 000000C100 or C100, because 0CUSTOMER length is 10 and so if record will come with or without leading zeros the code will work.
After that Check the Syntax then Save, and come back.
So our code is correct and now we can Save, Activate the Transformations.
Data Loading:
After activation, load the data form Flat File.
We are working in BI 7.X, so there are only Transformations in between DataSource and InfoSource (in this example). So in BI 7.X once you create Transformations and DTP, InfoPackage is only used to load the data up to PSA, after that we need to use DTP (to load the data from PSA to Data Targets).
In below InfoPackage, see the Processing Tab and Data Targets Tab.
How to Write Start Routine in Update Rules, Transformations and How to Debug the Routines
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
“How to Debug the Start Routine in Transformations”, before this article you please reads/go through the content called “How to Write a Start Routine in Transformations”. Here I taken one example i.e., needs to delete the unwanted data in Start Routine of Transformations based on Customer number and we will debug the same
Live Scenario:
We are loading the data to InfoCube, the Source system is Flat File (the logic, code and execution is same for even any SAP Source systems also) and we need to delete the unwanted records/data in Transformations at the time of data loads based on some Customer numbers. So in scenario we will how to debug the start routine Transformations.
Change Start Routine:
Click on Change Start Routine like below.
How to Write Start Routine in Update Rules, Transformations and How to Debug the Routines
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
It opens the below code window like below, keep break point i.e. BREAK-POINT.
In above screen, you can see the code that we written in “How to write Start Routine in Transformations”. Check the Syntax Check, Save and Activate the Transformations.
How to Write Start Routine in Update Rules, Transformations and How to Debug the Routines
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
We are working in BI 7.X, so there are only Transformations in between DataSource and InfoSource (in this example). So in BI 7.X once you create Transformations and DTP, InfoPackage is only used to load the data up to PSA, after that we need to use DTP (to load the data from PSA to Data Targets).
In below InfoPackage, see the Processing Tab and Data Targets Tab.
How to Write Start Routine in Update Rules, Transformations and How to Debug the Routines
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
See the number of records; in Flat file we have only five records, so it is displaying only five records.
DTP and Settings for Debug:
See the above screen, the data is loaded only up to PSA, from there we need to execute DTP to load the data into InfoCube.
Here we are trying to Debug the Start Routine, so we need to set some settings in DTP, right click on DTP and select Change and go to Execute Tab give Processing Mode is equal to Serially in the Dialog Process (for Debugging).
How to Write Start Routine in Update Rules, Transformations and How to Debug the Routines
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Once you click on Simulate button then it will open the Debug screen, and it will go to our Code there we put BREAK-POINT, then press F5 for line by line debug.
How to Write Start Routine in Update Rules, Transformations and How to Debug the Routines
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
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.