Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
May 2001
T ABLE OF CONTENTS
1 Business Scenario
The BEx does not normally show characteristics that have no values. However, it occurs quite frequently that an enterprise requires zero values to be shown in reports although these zero values are not delivered in the DataSources. An example of this is a report on a chart of accounts. Even if certain accounts have not been posted with values, they still ought to be shown as having the value 0 in the report. Normally this can be achieved by the use of structures. However, this involves incorporating all accounts that need to be displayed into the structure. This makes the query more complex and also increases maintenance efforts. Queries with complex structures also tend to run more slowly than queries with drilldowns. The following describes a procedure for generating zero values from master data. There are two alternatives: In the first alternative the values are saved in an InfoCube; in the second alternative the zero values are generated using a RemoteCube.
2 The Result
The result is a report with a drilldown for the 'plant' and 'workcenter' characteristics. Values are displayed for all combinations of the 'plant' and 'workcenter' characteristics. If there is no value in the cube, zero values are shown. Obviously, such a procedure does not distinguish between unposted zero values and posted zero values. The following graphic shows the report without generated zero values:
The following graphic shows the same report with zero values for all other 'plant' and 'workcenter' master data combinations. It is also filtered by workcenter in order to retain a printable structure.
This step describes how to generate a generic DataSource for all master data combinations that have zero values. The zero values can then be stored in the InfoCube using this generic DataSource. The following describes how to generate a generic DataSource for zero values for the InfoObjects 0PLANT and 0WORKCENTER.
1. Determine the master data tables for 0PLANT and 0WORKCENTER. One place you can find these is in the relevant InfoObject maintenance screen in the index tab 'Master data/texts'. In our example the master data tables are /BI0/PPLANT and /BI0/PWORKCENTER.
2. Use transaction SE11 to generate a database view. Choose the master data tables determined above as underlying tables in this view. Because the characteristic 0WORKCENTER is paired with the characteristic 0PLANT, you must insert a JOIN condition. Do not do this if characteristics are not compounded. This forms the Cartesian product of the involved characteristic values.
3. You must choose the keys of 0PLANT and 0WORKCENTER as fields for the view.
4. In the selection conditions for the view, you must specify that only active elements of both tables be selected. You do this by limiting the field OBJVERS to the value 'A'. You can also make other limitations here such as suppressing initial values.
6. Use transaction SBIW in the BW system to specify a DataSource for transaction data that uses the database method just created as an extraction method.
7. The extraction method chosen is 'Extraction from view'. Enter the view created above and save it.
8. You can now use another screen to choose which of the DataSource fields are selectable. Choose both fields.
9. The DataSource has now been successfully created. You must now inform BW about it. You do this using the menu option 'Replicate DataSources'. This can be reached by going to the index 'Source Systems' in the Administrator Workbench and calling up the context menu for the entry that is the source system for the BW. After DataSources have been replicated the DataSource can be assigned to an InfoSource.
10. To do this, choose an existing InfoSource or create a new one. You must specify the BW system itself as the source system. You can directly assign 0PLANT and 0WORKCENTER in the transfer rules. The key figure 0QUANTITY and the corresponding unit 0UNIT are set to constant values. A routine is defined for 0CALMONTH that determines the calendar month from the current system date.
11. Activate the InfoSource. This can now be used to fill an InfoCube.
The routine for determining 0CALMONTH from the system date is defined as followed. The line in blue is the only one that needs to be added manually. The rest is generated by the system and is only given here so that you can see the entire coding. FORM COMPUTE_CALMONTH USING RECORD_NO LIKE SY-TABIX TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE G_S_MINFO TYPE RSSM_S_MINFO CHANGING RESULT LIKE /BIC/CSZGDTEST01-CALMONTH G_T_ERRORLOG TYPE rssm_t_errorlog_int RETURNCODE LIKE SY-SUBRC ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel datapackage 2001 SAP AMERICA, INC. AND SAP AG 8
HOW TO DISPLAY UNPOSTED VALUES AS ZERO VALUES IN REPORTING *$*$ begin of routine - insert your code only below this line * DATA: l_s_errorlog TYPE rssm_s_errorlog_int. RESULT = sy-datum(6). * returncode <> 0 means skip this record RETURNCODE = 0. * abort <> 0 means skip whole data package !!! ABORT = 0. *$*$ end of routine - insert your code only before this line ENDFORM. *-* *-*
3.2
3.2.1
In this step the InfoSource data fills a separate InfoCube. The additional zero values generated are therefore not mixed with the actual transaction data.
12. Copy the InfoCube whose zero values you want to display to another InfoCube.
13. Connect this InfoCube with the InfoSource defined above. You do this with update rules.
14. This zero value InfoCube can be filled using a corresponding InfoPackage.
15. In the example you can see that the InfoPackage is started on a monthly basis. When this is done, the initial values for each month are written to the cube.
3.2.2
In this step the InfoSource data fills a separate InfoCube. The additional zero values generated are therefore not mixed with the actual transaction data. However, in contrast to alternative 1, the data is not physically saved - rather it is only read when required. This has negative effects on performance if there is a large amount of data or many concurrent users.
10
HOW TO DISPLAY UNPOSTED VALUES AS ZERO VALUES IN REPORTING In this case there might be no point in assigning the current date to the characteristic 0CALMONTH in the transfer rules. If necessary, modify the transfer rules appropriately. E.g. you could set 0CALMONTH to 01.1900 and then include this value as a filter or restriction in your query definition. The example shown here will be run-capable from BW 2.0B SP 15/ BW 2.1C SP 7.
16. Copy the InfoCube whose zero values you want to display to another InfoCube. Create it as a RemoteCube and assign it to the InfoSource created previously.
3.3
MultiCube
The MultiCube is used for combining the cubes created in the previous sections into one cube for reporting purposes.
11
17. Create a MultiCube. Its underlying InfoCubes are the BasisCube plus the alternative 1 InfoCube OR the alternative 2 InfoCube.
18. Take all available characteristics and key figures into the MultiCube. The MultiCube refers to data from both underlying InfoCubes. You can define this using the button 'Identification'.
19. Create dimensions in the MultiCube to which you assign individual characteristics.
12
20. Save and activate the MultiCube. If you now start a report on the MultiCube, the drilldowns for 0PLANT and 0WORKCENTER in the report will display not only the characteristic value combinations with values in the cube, but also zero values for all other characteristic value combinations.
4 Remarks
The Cartesian product of all involved characteristic values can grow quite large. In this case it might make sense to create a DataSource per characteristic. In the example given, you would create a DataSource for 0PLANT and a separate DataSource for 0WORKCENTER. Link these DataSources to an appropriate InfoCube. This cube should be a copy of the InfoCube whose zero values you want to display. Make sure that you fill all characteristics that are used in restrictions or in the query filter with meaningful values. You could use dummy values, e.g. 01.1900 for 0CALMONTH, and include this dummy value into the restriction and/or filter. Include the resulting InfoCubes into a MultiCube as described in step 3.2.
13