Example for Versioning

This example shows you the behavior of the system for the entries in the versioning fields for a business partner. For this simplified example, we assume that initially both current and history tables (sap.fsdm::BusinessPartner and sap.fsdm::BusinessPartner_Historical) are empty. Decimal digits are shortened.

  1. Data Load
    The following helper SQL procedure is used to load data for this example. In a productive environment, you use the write procedures of the interface generator:
    1. Initial loading with input write procedure: Initial version of the business partner John Doe (ID 4711), valid in the application dimension from January 01, 2000. This leads to an insert in the database. System time when calling the write procedure is May 4th, 2020.

      Input Data
      BusinessPartnerID BusinessValidFrom BusinessValidTo Name
      4711 2000-01-01 9999-12-31 John Doe
      Current Table "sap.fsdm::BusinessPartner"
      BusinessPartnerID BusinessValidFrom BusinessValidTo SystemValidFrom SystemValidTo Name
      4711 2000-01-01 9999-12-31 2020-05-04 00:00:00 9999-12-31 23:59:59 John Doe

      The history table stays empty.

    2. Correction of the business partner with the input write procedure: The name was wrong and has to be corrected. System time when calling the write procedure is May 6th, 2020.

      Input Data
      BusinessPartnerID BusinessValidFrom BusinessValidTo Name
      4711 2000-01-01 9999-12-31 Richard Doe
      Current Table "sap.fsdm::BusinessPartner"
      BusinessPartnerID BusinessValidFrom BusinessValidTo SystemValidFrom SystemValidTo Name
      4711 2000-01-01 9999-12-31 2020-05-06 00:0 0:00 9999-12-31 23:59:59 Richard Doe
      History Table "sap.fsdm::BusinessPartner_Historical"
      BusinessPartnerID BusinessValidFrom BusinessValidTo SystemValidFrom SystemValidTo Name
      4711 2000-01-01 9999-12-31 2020-05-04 00:0 0:00 2020-05-06 00:00:00 John Doe
    3. A new version comes from the source system with validity starting on May 10th, 2020 and a name change due to marriage. The system time when calling the write procedure is May 10th, 2020 00:00:00. The old record has to be delimited and a new version inserted.

      Input Data
      BusinessPartnerID BusinessValidFrom BusinessValidTo Name
      4711 2020-05-10 9999-12-31 Richard Doe-Roe
      Current Table "sap.fsdm::BusinessPartner"
      BusinessPartnerID BusinessValidFrom BusinessValidTo SystemValidFrom SystemValidTo Name
      4711 2000-01-01 2020-05-10 2020-05-10 00:00:00 9999-12-31 23:59:59 Richard Doe
      4711 2020-05-10 9999-12-31 2020-05-10 00:00:00 9999-12-31 23:59:59 Richard Doe-Roe
      History Table "sap.fsdm::BusinessPartner_Historical"
      BusinessPartnerID BusinessValidFrom BusinessValidTo SystemValidFrom SystemValidTo Name
      4711 2000-01-01 9999-12-31 2020-05-06 00:00:00 2020-05-10 00:00:00 Richard Doe
      4711 2000-01-01 9999-12-31 2020-05-04 00:00:00 2020-05-06 00:00:00 John Doe
    4. Backdated changes come from the source system with a validity starting on May 8th, 2020 because the name change to Richard Doe-Roe was in fact two days earlier than provided in the version before. The system date when calling the write procedure is May 12th, 2020.

      Input Data
      BusinessPartnerID BusinessValidFrom BusinessValidTo Name
      4711 2020-05-08 9999-12-31 Richard Doe-Roe
      Current Table "sap.fsdm::BusinessPartner"
      BusinessPartnerID BusinessValidFrom BusinessValidTo SystemValidFrom SystemValidTo Name
      4711 2000-01-01 2020-05-08 2020-05-12 00:00:00 9999-12-31 23:59:59 Richard Doe
      4711 2020-05-08 9999-12-31 2020-05-12 00:00:00 9999-12-31 23:59:59 Richard Doe-Roe
      History Table "sap.fsdm::BusinessPartner_Historical"
      BusinessPartnerID BusinessValidFrom BusinessValidTo SystemValidFrom SystemValidTo Name
      4711 2000-01-01 2020-05-10 2020-05-10 00:00:00 2020-05-12 00:00:00 Richard Doe
      4711 2020-05-10 9999-12-31 2020-05-10 00:00:00 2020-05-12 00:00:00 Richard Doe-Roe
      4711 2000-01-01 9999-12-31 2020-05-06 00:0 0:00 2020-05-10 00:00:00 Richard Doe
      4711 2000-01-01 9999-12-31 2020-05-04 00:0 0:00 2020-05-06 00:00:0 John Doe
    5. The business partner is no longer valid as of May 18th, 2020 and has to be archived. The system date when calling the delete procedure is May 20th, 2020.

      Input Data
      BusinessPartnerID BusinessValidFrom BusinessValidTo Name
      4711 2020-05-18 9999-12-31 Richard Doe-Roe
      Current Table "sap.fsdm::BusinessPartner"
      BusinessPartnerID BusinessValidFrom BusinessValidTo SystemValidFrom SystemValidTo Name
      4711 2000-01-01 2020-05-08 2020-05-12 00:00:00 9999-12-31 23:59:59 Richard Doe
      4711 2020-05-08 2020-05-18 2020-05-20 00:00:00 9999-12-31 23:59:59 Richard Doe-Roe
      History Table "sap.fsdm::BusinessPartner_Historical"
      BusinessPartnerID BusinessValidFrom BusinessValidTo SystemValidFrom SystemValidTo Name
      4711 2020-05-08 9999-12-31 2020-05-12 00:00:00 2020-05-20 00:00:00 Richard Doe-Roe
      4711 2000-01-01 2020-05-10 2020-05-10 00:00:00 2020-05-12 00:00:00 Richard Doe
      4711 2020-05-10 9999-12-31 2020-05-10 00:00:00 2020-05-12 00:00:00 Richard Doe-Roe
      4711 2000-01-01 9999-12-31 2020-05-06 00:00:00 2020-05-10 00:00:00 Richard Doe
      4711 2000-01-01 9999-12-31 2020-05-04 00:00:00 2020-05-06 00:00:00 John Doe
  2. Reporting

    Based on the final data of May 20th, 2020, you can perform the following queries:

    • Select the currently valid version on May 25th, 2020:

      Since the data was deleted starting from May 18th, 2020, the system will read no data.

    • Select a specific application time version for May 8th, 2020:

      The system finds the following data record:
      Result
      BusinessPartnerID BusinessValidFrom BusinessValidTo SystemValidFrom SystemValidTo Name
      4711 2020-05-08 2020-05-18 2020-05-20 00:00:00 9999-12-31 23:59:59 Richard Doe-Roe
    • Select a specific application time version (valid on May 8th, 2020) at May 09th, 2020 at 12:00 p.m. system time:

      The system finds the following data record:
      Result
      BusinessPartnerID BusinessValidFrom BusinessValidTo SystemValidFrom SystemValidTo Name
      4711 2000-01-01 9999-12-31 2020-05-06 00:00:00 2020-05-10 23:59:59 Richard Doe
    • Select a specific application time version that was valid in a range on the system time period:

      The system finds the following data records:
      Result
      BusinessPartnerID BusinessValidFrom BusinessValidTo SystemValidFrom SystemValidTo Name
      4711 2000-01-01 9999-12-31 2020-05-06 00:00:00 2020-05-10 23:59:59 Richard Doe
      4711 2000-01-01 9999-12-31 2020-05-04 00:00:00 2020-05-06 23:59:59 John Doe
    • Select a range of application times:

      The system finds the following data records:
      Result
      BusinessPartnerID BusinessValidFrom BusinessValidTo SystemValidFrom SystemValidTo Name
      4711 2000-01-01 2020-05-08 2020-05-12 00:00:00 9999-12-31 23:59:59 Richard Doe
      4711 2020-05-08 2020-05-18 2020-05-20 00:00:00 9999-12-31 23:59:59 Richard Doe-Roe

More Information

For more information, see the related entities and their definitions in the data model represented in SAP PowerDesigner.