This Blog is written to provide an insight about the new change in persistency of Durations in Service transactions as part of SAP S/4 Service – 2108 onwards.
In the Service IMG, they are integrated via Basic Functions > Date Management > Define Date Types, Duration Types and Date Rules.
On database level, the durations are stored in table SCAPPTSEG. The duration type is held in database field APPT_TYPE (i.e.appointment type).And the actual duration is stored in an encrypted form in the database field TXT_PUB_ID (rule ID).
The combination of duration plus unit is stored in a compressed form in one database field and can only be retrieved by an ABAP cast to an X type field
This encrypted form of actual duration is the real reason behind the new design, as we cannot query the value directly from the db table which causes a problem for implementing a CDS view.
A new transparent database table CRMS4D_DURATION is created for durations which holds the numeric value of the duration and the unit as separate columns.
This table can easily be integrated into the Virtual Data Model.
Only the durations will be stored in this table(CRMS4D_DURATION).
Dates will remain in the existing tables SCAPPT and SCAPPTGEN, as these can be queried directly from the database table.
A new field SDM_STATUS_DURA is added to the header segment ORDERADM_H.This field contains the information whether the durations of the given transaction have already been migrated to the new persistency.
In the One Order framework, this field(SDM_STATUS_DURA) controls whether the durations are read from the old or from the new persistency table CRMS4D_DURATION.
Design of CRMS4D_DURATION (New Duration Persistency table):
The design of the new database table for durations is more a straightforward.
Since the One Order component APPOINTMENT is a complex set, the key of the new database table comprises the key of header object type, transaction ID, item number and one additional key field which is the duration type.
There is no need to store additionally a GUID for the records. When a database record is transferred to the buffer, a GUID is created which remains stable during transaction processing. This is sufficient to identify the new, changed and deleted records.
Action on old transactions:
For all the old transactions in system, these can be migrated by using Silent Data Migration(SDM).
For S/4HANA Cloud this migration will be managed by SAP.
On-Prem customers, however, have to handle this migration via SDM for now.