(GLUE-1812) 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. You can find in this document 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 a 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 data stored in a target structure 
  • Except for the 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.
  • After creating an extractor, the system sets by default the Direct assignment rule. However, in the case a field is of a ‘CURR’(Currency) type the system uses the Currency conversion rule.

    Default currency rule isn't assigned to a currency field, when all keys from the Reference table aren't included in the Fieldname Mapping and the reference table is different than the source table. More information can be found in the chapter (GLUE-1812) Structured Data Extraction.

  • If you enable the functionality Meaningful values on the Glue table, the Meaningful field values rule is used in the extractor.
  • In the case rules were edited or deleted, the default assignment can be selected with Apply rules.



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 you change 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 you may 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 a conversion according to a currency key during the extraction. It is necessary to convert the value of the currency field 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 changes the particular amount into a proper value and stores it in a target storage. 

Currency conversion can be disabled for BW InfoCubes. This can be achieved through the 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 we recommend to disable all BW namespaces when creating and extracting tables. 

Routine 

In the case that a value in a particular field needs to be changed, deleted or adjusted, you can create your custom ABAP code, which will be then processed for the selected field during the load. 

By selecting Routine you 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.  You can change the value of the selected field through the parameter cv_field which modifies the value according your requirements. 



Meaningful field values 

This option transforms original values into more meaningful ones, so you can use a full description of a value. For example, you 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 Glue table by selecting the checkbox Use meaningful values. This option automatically adjusts the table structure on the background, so that the fields can store longer texts. 


For a 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. You can adjust the settings in the GLUE Cockpit. 


When you create an extractor for a target table with checked Meaningful Field Values, the Import Fields function automatically creates all meaningful field rules.

When you create an extractor for a target table without checked Meaningful field values, you can still add this transformation rule to specific fields using the pop-up menu in the 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, its field size isn't adjusted, 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 contains 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 

You 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, please run the program '/DVD/GL_BPL_SPKFL_CONTENT_GEN'.


Example without using the meaningful values: 



Example using the 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. 

 


In the case values of the data element RSSID are included in the Master data table, then by a SID conversion they are converted into a value from this table. However, this conversion makes sense for HANA optimized cubes, which don't contain dimension tables and the F table already contains SID values (which points directly to the values in Master data table). Every part of the process (adjusting fields during table creation and making rules in extractor) is performed automatically. For example, source table can look like: 



And an example of converted values in the target table: