(GLUE-1806) Transfer Rules
Introduction
With Datavard GLUE Transfer rules you can modify data during the extraction process. This process is similar to transfer routines within BW transformations. The functionality can be used for adjusting data, changing SAP abbreviations to more human-readable form, currency conversion, etc. Here we can find some basic information about transfer rules and the current implementation.
- Transfer rules are set for each field separately
- Currently, there are four options for transfer rules:
- Direct assignment – just copies one to one data from a source field to a target field
- Currency – a transformation of currency values according to currency key
- Routine – custom implementation which changes the value in the selected field
- Meaningful field values – translation of values according to a domain, mapping table, SID or a custom conversion routine
- This functionality behaves as an end routine in BW transformations, where we change/adjust the data stored in the target structure
- Except for direct assignment, all transfer rules are represented by an "include form" which is part of the extractor form. You can access and modify them with the transaction SE38.
- The default assignment rule is automatically set right after creating an extractor. By default, the system uses direct assignment, but in case that a field is of a ‘CURR’(Currency) type the Currency conversion rule is set. In case that Glue table has meaningful values set, Meaningful field values rule is set.
- Default assignment can be also applied with button Apply rules, in case rules were edited or deleted.
Direct assignment
This is the default type when an extractor is created. The extractor takes a source value and copies it in an unchanged form to a target. In the case, the system sets a different rule and the user changes it to the direct assignment rule, the old rule (include form) with the existing code is deleted.
Currency
If a target field is of a ‘CURR’(currency) data type, the system sets this type of rule automatically by it's creation, but the user can also change or delete it manually.
The currency value is stored in a database as a number with two decimal places. This can lead to problems with currencies which have none or more than 2 decimal places. As an example, the Japanese yen doesn't have any decimals, so when we have for instance 1005 JPY, the amount is stored as 10,05 in a database.
The SAP applications, which display these values, perform the conversion according to a currency key during runtime. The currency field is always connected with a currency key through a reference table, which can be either the same table or a foreign table which is be connected through a join. Therefore, it is needed to convert the value to a correct form, before it is stored in an external database. Our functionality enables this conversion automatically, as it finds the currency key during the data load and thus it changes the particular amount into a proper value and stores it in a target storage.
Currency conversion can be disabled for BW InfoCubes if needed. This can be achieved via a GLUE customizing table /DVD/GL_CUS_PAR, where the key value must be set to 'BW_NAMESPACE_PREFIX_+' and the parameter value should be a namespace of BW InfoCubes (for example '/BI0/' or '/BIC'). This makes sense for tables that are part of the InfoCubes since InfoObjects have a defined currency key. The conversion of tables in InfoCubes is currently not supported by GLUE, therefore it is recommended to disable all BW namespaces when creating and extracting tables.
Routine
In case that a value in a particular field needs to be changed, deleted or adjusted, we provide a functionality where the user can create his custom ABAP code, which will be then processed for the selected field during the load.
By selecting a Routine the user can access a generated form with a simple click on the particular arrow in the column Edit Rule. The form can be edited in the same way as any Z*/Y* ABAP report. Importing parameter is_record contains the whole record which is processed. This parameter should not be modified. The user can change the value of the selected field through the parameter cv_field which modifies the value according to user needs.
Meaningful field values
This option transforms original values into more meaningful ones and consequently, the user can use a full description of a value. For example, the user can easily transform the abbreviation 'AA' into a meaningful term 'American Airlines'. In contrary with the above listed transformation types, this type must be already specified while creating a table.The user must select the checkbox Use meaningful values. This option automatically adjusts the table structure on a background, so that the fields can store longer strings.
For every data element (e.g. 'AA') there are different ways on how to transform values. This information is stored in a database table and can be a part of customizing settings. The user can adjust the settings in the GLUE Cockpit.
When the user creates an extractor for a target table with Meaningful field values, the Import Fields function automatically creates all include forms for data elements, that should be transformed to meaningful fields.
When the user creates an extractor for a target table without Meaningful field values, they can still add this transformation rule for specific fields using the pop-up menu in Fieldname Mapping section. This step generates a transformation of the selected table column. However, it is important to note that since the target table is already active, it doesn't have adjusted field size, which may lead to string leaks.
In general, the system transforms the values in four different ways into meaningful values:
- Role – takes short texts of fixed values from a domain
- Mapping – every data element has a mapping on how an old value should be transformed into a new one
- SID – converts data element RSSID into a meaningful value
- ABAP – custom code written by a user
The user can specify which field should be used as a source for a meaningful value in the 'Reference table'. This is part of the customization option, that we mentioned above.
Mapping of the third way (SID) can be adjusted in GLUE Cockpit.
Please note: If the meaningful values are missing some content, the user should run the program '/DVD/GL_BPL_SPKFL_CONTENT_GEN'.
Example without the use of meaningful values:
Example with the use of meaningful values:
If a meaningful value is not found for a value, the system stores the original value and puts it into brackets – please see the column TYPE in the picture below.
By a SID conversion the user can convert values of the data element RSSID into a value from Master data table. However, this conversion makes sense for HANA optimized cubes, which do not contain dimension tables and the F table already contains SID values (which point directly to the values in Master data table). Every part of the process (adjusting fields during table creation and making rules in extractor) is done automatically. For example, source table can look like:
And an example of converted values in the target table: