Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Applies to:
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:
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.
Table of Contents
Routines .............................................................................................................................................................. 3 Start Routine ................................................................................................................................................... 3 End Routine .................................................................................................................................................... 4 Expert Routine ................................................................................................................................................ 4 InfoPackage Routine ....................................................................................................................................... 5 Characteristic Routine ..................................................................................................................................... 5 ABAP in Process Chains .................................................................................................................................... 6 Customer Exit Variable (BEx) ............................................................................................................................. 9 Data Extraction ................................................................................................................................................. 10 Enhancing a Datasource in ECC/SRM using Tcode RSA6 .......................................................................... 10 Related Content ................................................................................................................................................ 18 Disclaimer and Liability Notice .......................................................................................................................... 19
Routines
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.
End Routine 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.
InfoPackage Routine 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.
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.
You will see that the new ABAP Program process block has appeared. It is circled in red below.
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.
Data Extraction
Enhancing a Datasource in ECC/SRM using Tcode RSA6 The first step involves logging onto Tcode RSA6 and finding the relevant datasource which will then be enhanced as per the additional requirements.
An append structure needs to be created which will contain all the enhanced fields along with their metadata definition. Give a name to the append structure starting with Z:
Post activation, one needs to write the exit code in the source system to populate the source fields. The same is done through Tcode CMOD wherein you can then refer to the associated project and log onto enhancement RSAP0001. The following four exits exists and will be enhanced depending on the requirements: EXIT_SAPLRSAP_001 Transaction data EXIT_SAPLRSAP_002 Master Data Attributes EXIT_SAPLRSAP_003 Master Data Text EXIT_SAPLRSAP_004 Master Data Hierarchy Tcode: CMOD:
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.
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.
Related Content
http://wiki.sdn.sap.com/wiki/display/BI/ABAP+in+BW ABAP Development for SAP NetWeaver BI User Exits and BAdIs (2nd Edition) http://forums.sdn.sap.com/thread.jspa?threadID=6021 For more information, visit the EDW homepage