Skip to Content

CDS Generated BOPF - Alternative key not generated

Hi,

I have defined the following annotations in my CDS view:

@ObjectModel.alternativeKey: [
{
    element: ['concept'],
    uniqueness: #UNIQUE_IF_NOT_INITIAL,
    id: 'ConceptID'
}
]

However, upon activation the Alternative Key is not generated in the BO

Has anyone been through the same issue?

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Jan 13 at 12:32 PM

    Hi Marco Hernandez

    I too tried that and it didn't work.. Moreover I couldn't find any documentation related to it in the ABAP programming model for fiori documentation, so I guess it is not supported yet.

    I only found it in the keyword documentation, where it didn't give any information about it.

    https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abencds_annotations_frmwrk_tables.htm

    I also tried to debug and found that it will work if the key type is GUID and that also it will not work straightaway, you need to make the alternativekey id as 'ACTIVEUUID'. (It is hardcoded in the std. code).

        alternativeKey: [{
            element: ['salesorder'],
            id: 'ACTIVEUUID',
            uniqueness: #UNIQUE 
         }]
    

    Also, the Element should be of GUID as well :D.(so many restrictions)

    /BOBF/CL_CONF_CDS_LINK_DR_2=>CREATE_NODE_ALTERNATIVE_KEYS,UPDATE_NODE_ALTERNATIVE_KEYS class details if you want to check by yourself. I am not sure if my analysis is completely correct. If i were you I would raise a bug to SAP.

    I am just wondering if there is any reason why you want to create the additional alternative keys? and why you are not creating them manually in the BO layer?

    Best Regards,
    Mahesh

    Add comment
    10|10000 characters needed characters exceeded