Integration of Legacy Database Tables into BOPF Business Objects using the Legacy Data Access Class (Legacy DAC)
The Business Object Processing Framework (BOPF) processes data that is uniquely identifiable by the help of UUIDs. Thus, the database tables of a BOPF node contain by default a RAW16 typed key field called “DB_KEY” (as the name “KEY” is reserved). This DB_KEY field is renamed KEY in the combined structure of the corresponding Business Object Node. If the node is not the root of the Business Object, the information about its parent and root node instance is also persisted:
In order to have a node representing instances stored in a database table that does not have a UUID as primary key, the Legacy DAC can be used. While reading the data, this special DAC class creates a RAW16 typed transient key value for each instance. This key is temporarily stored during that session in an internal mapping table.
To create a node for managing that database table in a BOPF Business Object, the Legacy DAC can be used. Thereto 3 configuration steps must be followed:
- Maintain Legacy DAC
Maintain the class “/BOBF/CL_DAC_LEGACY_TABLE” in the field “Data Access Class” of a new node.
- Maintain Alternative Keys
Create an Alternative Key on the new node called “DB_KEY” containing of all the key elements defining the legacy key. If this node is a direct subnode of the root, also add an Alternative Key called “PARENT_KEY” containing all the elements that define the parent key. Finally, if this node is third level or below in the Business Object’s hierarchy, add also an Alternative Key called “ROOT_KEY”.
- Maintain Own Lock Implementation
The BOPF default locking works only for UUIDs. Thus if this node shall be separate lockable, in the configuration UI the default implementation of the internal locking and unlocking action (/BOBF/CL_LIB_A_LOCK) must be replaced by an application specific implementation.
Finally, there are some restrictions to be aware of:
- Below a node that is managed by a legacy DAC only further legacy DAC managed nodes can be defined.
- In order to implement queries, the mapping from a transient key to its real legacy is might be required. Thereto use class /BOBF/CL_DAC_LEGACY_MAPPING.
- Don’t store or use the transient keys across multiple sessions as they are only valid in the current one.
- The legacy DAC class is available with NetWeaver 7.50 and above
- In case of creating a node instance, you must of course fill the "real" key attributes fields (and for subnodes also the "real" parent key fields) - just filling the technical fields KEY and PARENT_KEY would not be sufficient.