Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
tobias_koebler
Advisor
Advisor
HI,
this blog describes the procedure to replicate from different source systems into one HANA schema the same table.
In this example the table SFLIGHT is available in System UA7 and UA5, the SLT system is U72 and the HANA Box is SLO.
     1. Setup of configurations
         You have to setup the first configuration. In this example I connect the system UA5 to the HANA box. I named the configuration N_1_SCHEMA.
         The same name is used as the schema name on the HANA side.
Afterwards you can wait until the DD* tables are all loaded to HANA and the configuration is ready to use.
Now it is time to create the second configuration. To achieve a N:1 replication, we have to replicate into the same schema. So it is quite easy - just use the same configuration/schema name you used for the first configuration. Only the source system information (RFC destination or DB connection) is different.
Before you can finish the creation of the second configuration you will receive the following message:
To connect the second configuration to the already existing schema on the HANA system - just confirm and that is all :smile:
After you finished the creation of the second configuration, the DD* tables will be dropped and loaded again. Just wait until this is finished.
Both configurations are running and enabled for N:1 replication.
    2. Avoid duplicates (optional)
         What will happen when you want to replicate the same table (e.g. SFLIGHT) from multiple systems and merge it to one table on the HANA side           and the records are not  totally unique over all involved systems? - You will run into duplicates.
         
           How can SLT support to avoid duplicates and transfer all records? To achieve a record that is also unique over more systems - a additional key           field has to be added to the target table. For the new key field would suggest the system id.
   
          a.) Extend target table structure for the first configuration
               You can extend the target table structure within transaction IUUC_REPL_CONTENT. You can dowload the full guide for this transaction here.
               When you access the transaction IUUC_REPL_CONTENT you will find both created configurations.
              
                Select the first configuration and navigate to the table setting screen (IUUC_REPL_TABSTG) and choose Edit table Structure.
                  
                Add a new field. In this example I added a new field  name SID, at position 2 od data type CHAR and length 3.
              
               After you confirmed your input and saved the settings for the first configuration.
          b.) Fill new field with the system id for the first configuration
               In the next step you have to assign a transformation rule to fill the new key field with the system id.
               Navigate to the transformation rule screen (IUUC_***_RUL_MAP) and choose and apply the following rule.
              
                    
Field nameValueComment
Table NameSFLIGHTThis is the table you would like to transform a field.
EVENTLet it empty to use parameter-based rule.
Export Field NameSIDThis is the field you would like to modify.
Import Parameter 1'UA5'This is a literal an point to the id of the source system.
Insert Line of CodeE_SID = I_P1.This is the rule, do not miss the space between the equal and the full stop at the end.
               Save all settings afterwards for your first configuration.
          
          c.) Extend target table structure for the second configuration

         

               Select the second configuration and navigate to the table setting screen (IUUC_REPL_TABSTG) and choose Edit table Structure.

               Extend the target table structure by an additional key field as described in a.)

              

               After you have extended the structure, an additional setting has to be specified. In the N:1 case - you would start replication for the first source                table and afterwards for the second source table. Usually SLT will drop a existing table on HANA before it creates a new replication for this table.                This behaviour would lead to the fact, that you will never get both tables at the same time into HANA.

               To avoid this, just check the field No Drop.

              

               Afterwards, you can save the settings for the second configuration.

         

          d.) Fill new field with the system id for the second configuration

               In the next step you have to assign a transformation rule to fill the new key field with the system id.

               Navigate to the transformation rule screen (IUUC_***_RUL_MAP) and choose and apply the following rule.
                                  
            
Field nameValueComment
Table NameSFLIGHTThis is the table you would like to transform a field.
EVENTLet it empty to use parameter-based rule.
Export Field NameSIDThis is the field you would like to modify.
Import Parameter 1'UA7'This is a literal an point to the id of the source system.
Insert Line of CodeE_SID = I_P1.This is the rule, do not miss the space between the equal and the full stop at the end.
            
            All records replicated from the second source system will get as additional key field the id 'UA7'.
            Save all settings afterwards for your second configuration.
    3. Replicate the Table
         
         a.) Start the replication for the first configuration for your table (e.g. SFLIGHT)
         
         
               Wait until the table is in action Replicate and status In Process.
 
     Let us have a look at the structure, numbers of records and the content.
     The structure is enhanced by SID defined as a key field.
     In total we replicated from the first source system 2712 records.
     Example of the first four records - the records are now unique also over multiple systems.
b.) Start the replication for the second configuration for your table (e.g. SFLIGHT)

     Wait until the table is in action Replicate and status In Process.

     When you check now the numbers of records: 5034
     And when you have a look at the extraxt of the table you see:
    
    Now you can consume the data of a table that was feeded from to different source systems in realtime.
Enjoy your N:1 repliction :smile: - Feedback is appreciated.
Best,
Tobias
25 Comments