Skip to Content
0
May 18, 2020 at 03:03 PM

CDS Association Value help issue

429 Views Last edit May 19, 2020 at 07:45 AM 3 rev

Hi Experts,

I have the following basic scenario:

I am trying to create a Fiori List Report application from CDS views, that shows each Department with the corresponding Boss.

I have created the CDS views for Department and Employee and I have publish the Department view as OData service. I want to give the possibility to the user to edit the Boss of a Department having a Value help dialog with all the Employees. This is what I managed to have in my application (providing the Value help based on modeled value help views):

The Value help works but my goal is to display the name of the Boss ("name" property of Employee) instead of the Boss ID ("boss_id" property of Department) while keeping the possibility to choose a new Boss from the Value help dialog. But if I try to add the annotation for the Value help on the Boss name derived from the association, the Value help does not display any possible value.

Here it is the code of the Consumption CDS view for Department:

...
define view ZIPDB_C_DEPARTMENT as select from ZIPDB_T_DEPARTMENT
association [0..1] to ZIPDB_EMPLOYEE as _BOSS on $projection.boss_id = _BOSS.employee_id
{
...
  @UI.hidden: true
  ZIPDB_T_DEPARTMENT.boss_id,
  
  @Consumption.valueHelp: '_BOSS'
  @UI: {
    fieldGroup: [{ qualifier: 'department_id_FG', position: 30, label: 'Boss' }],
    identification: { position: 30, importance: #HIGH },
    lineItem: [{position: 30, label: 'Boss'}]
  }
  _BOSS.name as boss,

  _BOSS
}

Then, If instead of

@Consumption.valueHelp: '_BOSS'

I use

@Consumption.valueHelpDefinition: [{entity: { name: 'ZIPDB_EMPLOYEE', element: 'employee_id'  }}]

Then the Value help shows all the possible Employees, but when I choose one of them and click "save", a POST request with the employee_id selected is done on the "boss" property of the Department (that does not exist, so there is no update), while the correct behavior would be to update the boss_id of the Department.

It's seems a quite common scenario but I could not find the solution anywhere. Thanks in advance.

Attachments

scenario.png (16.8 kB)
screen-edit.png (9.4 kB)