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 BW. For more information, visit the EDW homepage
Summary
The document provides a detailed description of the usage of APAP in SAP BI.
Author: Adlin Sundararaj & Kavita Srivastava
Company: Accenture Services Pvt. Ltd.
Created on: 10 March 2011
Author Bio
Adlin Sundararaj is working as SAP-BI Consultant in Accenture Services Private Ltd and has experience of working on implementation and maintenance projects.
Kavita Srivastava is working as SAP-BI Consultant in Accenture Services Private Ltd and has rich project experience in SAP-BI domain.
End Routine .................................................................................................................................................... 4
ABAP in Process Chains .................................................................................................................................... 6
Data Extraction ................................................................................................................................................. 10
Enhancing a Datasource in ECC/SRM using Tcode RSA6 .......................................................................... 10
Related Content ................................................................................................................................................ 18
Disclaimer and Liability Notice .......................................................................................................................... 19
Role & Scope of ABAP in SAP BW/BI
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
The different Routines Available in SAP BI are as follows:
Start Routine
End Routine
Expert Routine
InfoPackage Routine
Characteristic Routine
Start Routine
The start routine is run for each data package at the start of the transformation. The start routine has a table in the format of the source structure as input and output parameters. It is used to perform preliminary calculations and store these in a global data structure or in a table. This structure or table can be accessed from other routines. You can modify or delete data in the data package.
Click on Start Routine button (Circled in Red)to create Start Routine. SOURCE_PACKAGE contains contents of source data. SOURCE_PACKAGE has same structure as that of Source of the Transformation.
Role & Scope of ABAP in SAP BW/BI
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
End Routine is available with Transformation. It is triggered after Transformation. Generally End user is used for updating data based on existing data.
An end routine is a routine with a table in the target structure format as input and output parameters. You can use an end routine to postprocess data after transformation on a package-by-package basis. For example, you can delete records that are not to be updated, or perform data checks.
Click on End Routine button to create End Routine. RESULT_PACKAGE contains process data i.e. processed via start routine and transformation. RESULT_PACKAGE has same structure as that of target Object.
Expert Routine
To create an Expert routine go to Edit menu and select Expert Routine. Expert Routine will trigger without any transformation Rule. All existing Rules will be deleted once you develop Expert Routine. This is used generally for customizing rules.
This type of routine is only intended for use in special cases. You can use the expert routine if there are not sufficient functions to perform a transformation. The expert routine should be used as an interim solution until the necessary functions are available in the standard routine.
You can use this to program the transformation yourself without using the available rule types. You must implement the message transfer to the monitor yourself. If you have already created transformation rules, the system deletes them once you have created an expert routine. SOURCE_PACKAGE has same structure as that of Source of the Transformation. RESULT_PACKAGE has same structure as that of target Object. You can manipulate values from SOURCE_PACKAGE and append them in RESULT_PACKAGE.
Role & Scope of ABAP in SAP BW/BI
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Info Package routine is available with Info Package of Flat file Datasource. This routine enables us to give dynamic filename to IP. To Create Routine for filename, click the button circled in red in the image below.
You need to create a routine by clicking on the Routine button. Give a name to routine. Write a code inside this routine to derive file name and assign it to variable p_filename.
Characteristic Routine
Characteristic Routine is inside Transformation. This routine will be triggered inside the Transformation based on the characteristic or key figure. If rule is for Characteristic, then Characteristic transformation routine will trigger. If rule is for key figure, then key figure transformation routine will trigger.
This routine is available as a rule type; you can define the routine as a transformation rule for a key figure or a characteristic. The input and output values depend on the selected field in the transformation rule
In Rule details of transformation select Routine to create a Characteristic Routine. Here you can do calculation of InfoObject value and assign value to variable Result, which in turn will get assigned to InfoObject. Characteristic routine is executed after Start routine and before End Routine. All global objects declared in Start Routine are available in Characteristic Routine.
Role & Scope of ABAP in SAP BW/BI
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Use the ABAP Program process type if you want to use a simple, independent program in a chain or if you want to use a program scheduled by a user or another program in the background. This allows you to schedule a program of your choice (ABAP report) in the process chain management, with or without program variants.
To add a ABAP Program process type:
Go to RSPC.
Click on the Process Types button circled in red below.
Here you can also see the ABAP Program process variant in the ‘General Services list’.
Drag and drop the variant into the process chain build pane.
You will get the following pop-up asking for the program name.
You can either use a pre-existing program by pressing
Alternatively, you can create a new program by pressing
In our example we will be using a pre-existing program ZTESTOSC.Press to confirm.
Role & Scope of ABAP in SAP BW/BI
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Customer Exit Variable created in BEx query provides means to do complex calculation (not possible with BEx) in ABAP. Coding for Customer Exit variable is done in EXIT_SAPLRRS0_001 Function Module. Data records from BEx query are passed in I_T_VAR_RANGE internal table. Structure of this internal table is as follows:
Field Description
VNAM Variable name
IOBJNM InfoObject name
SIGN (I)ncluding or (E)xcluding
OPT Operators: EQ =, BT Between, LE <=, LT <, GE >=, GT >, CP and so on.
LOW Characteristic value
HIGH Upper limit characteristic value for intervals/the node-InfoObject for hierarchy nodes.
I_STEP parameter from the Exit Function Module determines when customer exit code will be executed. Depending upon i_step values we can populate values in variable during different steps of BEx execution. I_STEP has values from 0-3, most commonly used values are explained below.
I_STEP = 0
When i_step has value 0, the enhancement has been called via authorization check or from the monitor and not from variable screen.
I_STEP = 1
When i_step has value 1 the enhancement call takes place directly before variable entry. This can be used to populate variable with some default values.
I_STEP = 2
When i_step has value 2 the enhancement call takes place directly after variable entry. This step is only started up when the same variable is not input ready and could not be filled at I_STEP=1. This step can be used to validate user input.
I_STEP = 3
When i_step has value 3 you can check the values of the variables. Triggering an exception here (RAISE) causes the variable screen to appear once more. Afterwards, I_STEP=2 is also called again.
Role & Scope of ABAP in SAP BW/BI
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
The include as shown below will contain all the relevant code controls which define the field population. This is a generic include and the code piece needs to be controlled through datasource name as shown below in the sample code (screenshot). The existing fields along with their values are stored in the internal table
C_T_Data which is to be further modified to also include and populate values for the newly enhanced and added fields.
Further modularization can be done by creating datasource specific includes. The technique also helps in better readability of the code.
Role & Scope of ABAP in SAP BW/BI
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Once the changes are done & new fields are fetched, internal table C_T_Data needs to be modified accordingly. The modifications and the new fields population is then automatically transferred to the fields of the datasource. The same can then be validated by executing the datasource through Tcode RSA3.
Role & Scope of ABAP in SAP BW/BI
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.