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.
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….
Step 2. Select the option Transaction data, and then click to continue.
Step 3. Enter a name and a description, and then click to continue.
Step 4. The InfoSource is displayed but is not active yet. Double-click the InfoSource to create a communication structure.
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
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.
Step 1. In the Administrator Workbench: Modelling window, right-click the InfoSource demo: IC_DEMOBC, and then select Assign DataSource….
Step 2. Enter SS_DEMOFF in the field Source system, and then click to continue.
Step 3. Click to pass the message.
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.
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.
Step 6. In the pop-up window, select the option @9WQLocalA, and then click to create an ABAP transfer rule.
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.
Step 7. Enter a name for the Transfer routine, select the option All fields, and then click to continue.
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.
Step 9. Click to return to the main screen.
Step 10. The cell icon changes from to . Click to activate all transfer rules.
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
Aggregates and Multi-Cubes
Operational Data Store (ODS)
Generic R/3 Data Extraction
Appendix A. BW Implementation Methodology
Appendix B. SAP Basis Overview
Appendix C. Glossary
Appendix D. Bibliography