Skip to Content

CDS Association Value help issue

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.

scenario.png (16.8 kB)
screen-edit.png (9.4 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.