In Section 3.3, we used BW's default simple one-to-one mappings for characteristic data. In this section, we will write a transfer rule in the ABAP language.
Table 1.4 lists the material per unit sales price and quantity sold. It does not provide any sales revenue data, however. To improve future query performance, it is recommended that we calculate the sales revenue and save this result in the fact table, rather than calculate the sales revenue during a query run. The database design in Figure 1.1 reflects this idea, and the following procedure shows how to implement it.
Work Instructions
Step 1. In the Administrator Workbench: Modelling window, select InfoSources under Modelling in the left panel, right-click Application Component demo, and then select Create InfoSource….
SCREEN 3.48
Step 2. Select the option Transaction data, and then click to continue.
SCREEN 3.49
Step 3. Enter a name and a description, and then click to continue.
SCREEN 3.50
Step 4. The InfoSource is displayed but is not active yet. Double-click the InfoSource to create a communication structure.
SCREEN 3.51
Note
In Section 3.3, we skipped this step. BW created a communication structure for us automatically based on the characteristic attribute information.
A communication structure is needed here so that the data passed by an InfoPackage can feed multiple InfoCubes. See the note for Screen 3.70.
Step 5. Enter InfoObjects as shown, and then click to save and activate the communication structure
SCREEN 3.52
Result
You have created the communication structure. A status message Communication Struct. IS_DEMOBC activated will appear at the bottom of Screen 3.52. Now we can clearly see that an InfoSource is simply a communication structure.
Next, let's create the transfer rules.
Work Instructions
Step 1. In the Administrator Workbench: Modelling window, right-click the InfoSource demo: IC_DEMOBC, and then select Assign DataSource….
SCREEN 3.53
Step 2. Enter SS_DEMOFF in the field Source system, and then click to continue.
SCREEN 3.54
Step 3. Click to pass the message.
SCREEN 3.55
Step 4. BW proposes a transfer structure based on the information of the communication structure. Under the Trans. structure tab, check four fields in the Selection column. You can use these four fields as selection conditions when loading data using an InfoPackage.
SCREEN 3.56
Note
A transfer structure maps DataSource fields to InfoSource InfoObjects.
Step 5. Under the Transfer rules tab, the simple one-to-one mappings appear in the left table, called Communication str./Transfer rules. Click at the intersection of IO_REV and Tp to replace the one-to-one mapping with an ABAP transfer rule for the sales revenue calculation.
SCREEN 3.57
Step 6. In the pop-up window, select the option @9WQLocalA, and then click to create an ABAP transfer rule.
Note
The first option, InfoObject, is the default – the simple one-to-one mapping. The second option, , allows us to specify a constant. The third option, @9WQLocalA, enables us to define an ABAP transfer rule.
SCREEN 3.58
Step 7. Enter a name for the Transfer routine, select the option All fields, and then click to continue.
SCREEN 3.59
Note
In BW, the ABAP transfer rule is called a transfer routine.
Step 8. Scroll down the ABAP routine, to the right of RESULT = enter TRAN_STRUCTURE-/BIC/IO_PRC * TRAN_STRUCTURE-/BIC/IO_QUAN. The statement should appear as shown on line 68. This ABAP statement specifies how we calculate IO_REV, the RESULT, from IO_PRC and IO_QUAN.
Click to check the ABAP routine. If it is valid, click to save it.
SCREEN 3.60
Step 9. Click to return to the main screen.
SCREEN 3.61
Step 10. The cell icon changes from to . Click to activate all transfer rules.
SCREEN 3.62
Result
You have created transfer rules. A status message Transfer rules IS_DEMOBC_AH activated will appear at the bottom of Screen 3.62.
Part I. Guided Tours
Business Scenario and SAP BW
Creating an InfoCube
Loading Data into the InfoCube
Checking Data Quality
Creating Queries and Workbooks
Managing User Authorization
Part II. Advanced Topics
InfoCube Design
Aggregates and Multi-Cubes
Operational Data Store (ODS)
Business Content
Generic R/3 Data Extraction
Data Maintenance
Performance Tuning
Object Transport
Appendix A. BW Implementation Methodology
Object Transport
Appendix B. SAP Basis Overview
Object Transport
Appendix C. Glossary
Appendix D. Bibliography