cancel
Showing results for 
Search instead for 
Did you mean: 

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

0 Kudos

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).

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

Accepted Solutions (0)

Answers (0)