Remote Subscription of Type INSERT

Remote subscriptions of type INSERT return the complete delta history in the target table of the replication in BW.

A remote subscription of type INSERT replicates data in real time from a remote source object to a table on the local SAP HANA database. Type INSERT means that all types of data changes (inserts, updates, and deletions) are written to the target table with an INSERT SQL command. The statement writes the original change type to the SDI_CHANGE_TYPE column. For each data change, a commit time stamp is written to the SDI_CHANGE_TIME column and a unique sequence number is written to the SDI_CHANGE_SEQUENCE column.

Use

This type of real-time replication can be used to track all data changes that a remote source object has experienced. In this way, you can, for example, process the complete data change history in SAP BW. Another advantage of the INSERT remote subscription type compared to the UPSERT type is that before and after images are recorded for each data change. This makes it possible to transfer the data changes to an InfoCube-like INSERT-only target or to aggregate the key figures during the transformation with the "Summation" aggregation behavior. The data target does not, therefore, have to have the same key as the remote source object. Neither are possible with remote subscription type UPSERT, which only delivers after images with deletion indicator.

Dependencies

If you select the INSERT remote subscription type for a DataSource, the delta process of the DataSource changes automatically to ABR Complete delta update with deletion indicator. Five further fields are then added to the DataSource:

  • SDI_CHANGE_TIME: Returns the commit time stamp of the last data change

  • SDI_CHANGE_SEQUENCE: Returns the sequence number for each data change. The sequence number, together with the commit time stamp, identifies each record uniquely.

  • SDI_CHANGE_TYPE: Displays the type of the last data change. For updates, two records are added: one with the values prior to the change and one with the values after the change.

  • SDI_RECORD_MODE: Translates the change type into corresponding values of the technical characteristic 0RECORDMODE. For updates: a before image and an after image

  • SDI_ENTITY_COUNTER: Allows a distinction to be made between rows with zero values in the remote source object and rows that have been deleted from the remote source object

When the DataSource is activated for remote subscription type INSERT, three additional SAP HANA objects are generated:

  • The remote subscription

  • A target table for the real-time replication

    The primary key for the target table is SDI_CHANGE_TIME and SDI_CHANGE_SEQUENCE, since the primary key values of a record that has been changed in the remote source object are contained multiple times in the target table.

  • An SQL view on the target table

In the target table, the additional columns have the following properties:

  • SDI_CHANGE_TIME has data type TIMESTAMP.

  • SDI_CHANGE_SEQUENCE has data type INTEGER.

  • SDI_CHANGE_TYPE has data type NVARCHAR(1) and value I for inserted records, valueD for deleted records, value B for values prior to an update, and value U for values after an update.

  • SDI_RECORD_MODE is not part of the target table. It is calculated in the generated SQL view.

  • SDI_ENTITY_COUNTER is not part of the target table. It is calculated in the generated SQL view.

In the SQL view, the additional columns have the following properties:

  • SDI_CHANGE_TIME is converted into a NUMC(21) value by removal of the decimal point from the DECIMAL(14,7) display. The time stamp 2015-11-11 11:11:11, for example, which is displayed in SAP HANA as decimal value 20151111111111.0000000, is converted into the numerical character value '201511111111110000000' so that it can be consumed more easily in ABAP.

  • SDI_CHANGE_SEQUENCE is passed as INT4.

  • SDI_CHANGE_TYPE is passed as CHAR(1). However, for values B and D, the signs for key figures are reversed with aggregation behavior "Summation".

  • SDI_RECORD_MODE is calculated for the SDI_CHANGE_TYPE value B as 0RECORDMODE value X (before image), as R (reverse image) for the SDI_CHANGE_TYPE value D, and as ' ' (blank, that is, after image) for all other SDI_CHANGE_TYPE values.

  • SDI_ENTITY_COUNTER is calculated for the change type values B and D as -1, and for all other change types as 1.