Skip to Content
0
Nov 25, 2022 at 08:48 AM

Draft based BOPF (CDS): Cross-Reference between draft enabled nodes

75 Views Last edit Nov 25, 2022 at 08:51 AM 3 rev

Hi everybody,

i've got a questing regarding the draft based BOPF concept used by ABAP Programming Model for SAP Fiori framework.

In my simplified scenario i've got a draft enabled root node with an association to a sub node with mutliple items (1..n).

image.png

Root View

@ObjectModel: {
    modelCategory: #BUSINESS_OBJECT,
    compositionRoot: true,
    transactionalProcessingEnabled: true,
    writeActivePersistence: '...',
    writeDraftPersistence: '...D',
    semanticKey: ['...'],
    representativeKey: '..',
    createEnabled: true,
    updateEnabled: true,
    deleteEnabled: true,
    draftEnabled: true
}


define view ZI_Root_TP
    as select from ZI_Root
    association [0..*] to ZI_SubNodes_TP as _SubNodes on _SubNodes.ParentUUID = $projection.UUID

{
    key UUID,

        @ObjectModel.text.association: '_SubNodes'
        @ObjectModel.foreignKey.association: '_SubNodes'
        UUIDFromSubNode,

        @ObjectModel.association.type: #TO_COMPOSITION_CHILD
        _SubNodes
}


SubNode View

@ObjectModel: {
    transactionalProcessingEnabled: true,
    writeActivePersistence: '...',
    writeDraftPersistence: '...D',
    semanticKey: ['...'],
    representativeKey: '...',
    createEnabled: true,
    updateEnabled: true,
    deleteEnabled: true
}

define view ZI_Items_TP
    as select from ZI_Items
    association [1..1] to ZI_Root_TP as _Root on _Root.UUID = $projection.ParentUUID

{
    key UUID,
        ParentUUID.

        @ObjectModel.association.type: [#TO_COMPOSITION_ROOT, #TO_COMPOSITION_PARENT]  
        _Root

}

The basic draft concept works here. The persistent data is transferred to the draft tables. So when I click the edit button in the Fiori application, I can complete the processing based on the draft data.

As a "special" feature I have a column in the root table with a reference to an entry from SubNode.

Now here is the problem that when you click on the edit button, the data is transferred to the draft tables (with new draft UUIDs), but the references are not updated. This means concretely that in the root draft table in the column UUIDFromSubNode the UUID of the active instance is written. Instead the UUID from the draft SubNode table should be in here.

Is there a way for the draft based concept to automatically update this reference or does this have to be done manually using a Determination?

Best regards,

Niklas

Attachments

image.png (22.2 kB)