Skip to Content

Hi,

I would like to describe a really special case of a transformation that is questioned within this community – how to split a record during the load/replication process on the SLT system in two records.

First of all I would like to note, that this is a special case and not implemented as a E2E solution – everything you have to specify to split a record is via ABAP coding. Also this is an expert example – so I will not explain each available transaction in details. Please get trained beforehand with the available documentation.

For the example I used the following scenario – table SFLIGHT is available and should be splitted and appear as two records on the HANA system.

  1. Create a new configuration or use an existing configuration.
  2. Table adjustment

Would you just create a second record – this would be a duplicate and cannot be processed (you will get an error msg in the application log). So the only way is to modify an existing key field – but much better for the transparancy is to introduce an additional key field for the target structure on the HANA system.

Very easy to achieve via SLT. Just navigate to transaction IUUC_REPL_CONTENT and enhance the target table structure for your table with a new key field (tab IUUC_TABSTG).

/wp-content/uploads/2013/06/1_248065.png

Save your settings.

  3.   Create an ABAP include + transformation rule

Navigate to transaction SE38 and create a new ABAP include where you define your rule.

Background information:

When you run a replication, SLT will automatically generate specifiy code, such as internal tables, objects for each table in replication. With the option to define a transformation rule, SLT gives you the option to integrate custom transformation code into the standard process flow.You can look at it like a customer exit. When you define a transformation rule within an ABAP include or via the UI – SLT merge this ABAP coding into the specific flow.

Several interntal tables, structures and counters exist. To add a new field, you have to increse the internal counter and fill the a record manually into the internal table. The second record will be automatically inserted into the internal table – execute by the usual process flow.

First of all we have to increase the internal counter by 1.

           R_SFLIGHT_NO = R_SFLIGHT_NO + 1.

     //SLT uses an internal counter for processing with the convention R_<table>_NO


     _WA_R_SFLIGHT_RECNO = R_SFLIGHT_NO
.

     //in the corresponding internal workarea, you have to fill _WA_R_<table>-_RECNO

Afterwards you fill the new key field with the entry for the first record.

            _WA_R_SFLIGHTkey = ‘0001’.

     // This is the part where you are flexible with the input value

     – e.g. you could also think about a scenario where you concatenate the

     new key field based on existing other values of the record

     – you can do what ABAP allows you 😉 .

     To access a value just follow this convention: _WA_R_<table>-<field>

   

In the next step you insert the changed record into the internal table (convention: _ITB_R_<table>) manually.

     INSERT _WA_R_SFLIGHT INTO TABLE _ITB_R_SFLIGHT.

      

        The last step is to override the key field  with a new value. This lead to a new uniquie record.

         

        _WA_R_SFLIGHTkey = ‘0002’.

        The SLT coding automatically inserted the record which ahs now a new key filed into the internal table.

        In the internal table you would find now two records, only differs by the key ‘0001’ and ‘0002’.

  

        Save and activate your include. Please note, that no syntax check can be executed for includes.

        When you change the existing coding during a replication – errors can occur during the activation.

        You can ignore them.

Find below the complete coding.

    

          /wp-content/uploads/2013/06/2_233401.png

4.   Activate the transformation rule for table SFLIGHT

      Navigate to transaction IUUC_REPL_CONTENT.

      And add a new record into section IUUC_A S S_RUL_MAP as in the following screenshot.

           /wp-content/uploads/2013/06/3_233465.png

        Save your settings afterwards.

5.     Start the load/replication of the table SFLIGHT from the Data Provisioning UI of the HANA Modeler

6.     You find the result on the following screenshot

               /wp-content/uploads/2013/06/4_233466.png

          You see now that two records exist which differ by a newly introduced key field.

This is the end of this HowTo Guide.

Additional information (THX to Udo):

If you perform the split in timestep BOR – begin of record – that means you append the new record before the field-related transformations are applied.

So BOR is okay, if you have no further field related transformations. But if you have some field-related transformations, you usually want to append the transformed records. Then you must use the timestep EOR – end of record.

Best,

Tobias

To report this post you need to login first.

10 Comments

You must be Logged on to comment or reply to a post.

  1. Edgar Jubillar Vera

    Hi Tobias,

    very interesting post.

    Which steps need to be considered in order to proceed with your example for a table that is already being replicated from the SAP source system (ECC) to the HANA target system? Sopt replication jobs before code the include? Stop and start the replication process after the section IUUC_A S S_RUL_MAP is created?

    Thanks in advance,

    Edgar.

    (0) 
    1. Tobias Koebler Post author

      Hi Edgar,

      1.) Stop the master job for your configuration (via LTR)

      2.) Add/Change the rule (IUUC_REPL_CONTENT)

      3.) Reset Migration Object (you find it in IUUC_REPL_CONTENT in the bar on the top)

      4,) Restart the Master Job

      Thats all – if you think this procedure should be part of a How To – I am pleased to create such a blog.

      Best,

      Tobias

      (0) 
  2. Markus Richter

    Hi Tobias,

    this is really helpful! Also in the understanding of the overall writing of user-defined functions or as you call it “transformation rule”.

    Great help!

    Thanks so much.

    Markus

    (0) 
  3. Meiyalagan Kulandhivelu

    Hi Tobias,

    Its a great post.

    I got a quick couple of questions on it.

    1.Does Internal table _ITB_R_SFLIGHT has the entire data package sent to HANA?

    2.Can we read any other SAP table and use it in the logic for calculation?

    3. How to debug this code?

    Regards,

    Meiyalagan

    (0) 
  4. Edgar Jubillar Vera

    Hi Tobias,

    I was thinking on the example you give us in that post and then I found a question to ask you:

    If the register is deleted in the souce system. How the replication will know that it needs to delete two registers on the target system?

    Thanks in advance!

    Edgar.

    (0) 
    1. Tobias Koebler Post author

      Hi Edgar,

      if you delete a record in the source, SLT process this information and will internally also run though this piece of code that doubles the entry. So internally SLT knows that there are two records for deletion on the HANA system. So two sql delete statements will be created and executed on HANA.

      Best,

      Tobias

      (0) 
  5. Udo Matthias Sommer

    Hi Tobias,

    In your example you perform the split in timestep BOR – begin of record – that means you append the new record before the field-related transformations are applied.

    So BOR is okay, if you have no further field related transformations.

    But if you have some field-related transformations, you usually want to append the transformed records. Then you must use the timestep EOR – end of record.

    Some months ago I used a similar coding to transpose some columns of NewGL data, i.e. table FAGLFLEXT, into rows; in detail, the currency types (transaction currency, local currency and group currency) into 3 rows and the period fields HSLVT, HSL01, … HSL12 etc. into 13 rows. so in total 39 columns were transformed into 39 rows because it simplified the models built on top of the tables.

    BR, Udo

    (0) 
  6. Rajesh Sanikommu

    Hi Tobi,

    I have a question about table split, we have a table in ECC application which was spilt into 3. When we replicate the table to BW HANA it came as single big table with records of more than 2 billions. I want to know how can we split the table after the replication using IUUC_REPL_CONTENT. We are on DMIS 2011_1_731 SP 11, your advice will be very much appreciated.

    (0) 

Leave a Reply