cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to see List View of child entity in the parent object page || ABAP RAP

basantmhr
Participant

Hi All,

I am working on ABAP RAP to expose a managed scenario wherein we have an Employee root entity and an Employment child entity. For the managed scenario, I developed the persistence table, CDS View, and everything.

Now while previewing the Fiori UI, these are the screen I get.

Here the issue is with the following screen as I am not getting any ListView for EmploymentInfo that will allow me to create any entries.

I have created metadata extension for both the CDS view and have also included EmploymentInfo entity in the target of the Employee metadata.

Below are the Codes

1.Metadata Extension for Employee

//Metadata Extension for Employee
@Metadata.layer: #CORE
@UI: {
  headerInfo: { typeName: 'Employee',
                typeNamePlural: 'Employees',
                title: { type: #STANDARD, label: 'Employee', value: 'EmployeeID' } },
  presentationVariant: [{ sortOrder: [{ by: 'EmployeeID', direction:  #DESC }] }] }
annotate view ZC_RAP_E2E_AEMP with
{
  @UI.facet: [ { id:              'Employee',
                 purpose:         #STANDARD,
                 type:            #IDENTIFICATION_REFERENCE,
                 label:           'Employee Info',
                 position:        10 }
                 ,{ id:              'Employment',
                 purpose:         #STANDARD,
                 type:            #LINEITEM_REFERENCE,
                 label:           'Employment Info',
                 position:        20,
                 targetElement:   '_Employment'}]
  @UI:{ identification: [{ position: 1, label: 'EmployeeUUID' }] }
  EmployeeUUID;
  @UI: {  lineItem:       [ { position: 10 }  ],
          identification: [ { position: 10 } ],
          selectionField: [ { position: 10 } ] }
  EmployeeID;
  @UI: {  lineItem:       [ { position: 20 }  ],
         identification: [ { position: 20 } ],
         selectionField: [ { position: 20 } ] }
  FirstName;=
  @UI: {  lineItem:       [ { position: 30 } ],
          identification: [ { position: 30 } ]}
  LastName;
  @UI: {  lineItem:       [ { position: 40 } ],
          identification: [ { position: 40 }  ]}
  DateOfBirth;
  @UI: {  lineItem:       [ { position: 50 } ],
          identification: [ { position: 50 } ] }
  Active;
  @UI.hidden: true
  LastChangedAt;
  @UI.hidden: true
  LocalLastChangedAt;
}

2. Metadata extension for employment

@Metadata.layer: #CORE
@UI: {
  headerInfo: { typeName: 'Employment',
                typeNamePlural: 'Employments',
                title: { type: #STANDARD, label: 'Employment', value: 'EmploymentUUID' } } }
annotate view ZC_RAP_E2E_AEMPL with
{
  @UI.facet: [{ id:              'Employment',
                 purpose:         #STANDARD,
                 type:            #IDENTIFICATION_REFERENCE,
                 label:           'Employment Info',
                 position:        10 } ]
  @UI:{ identification: [{ position: 1, label: 'EmploymentUUID' }] }
  EmploymentUUID;
  @UI.hidden: true
  EmployeeUUID;
  @UI: {  lineItem:       [ { position: 20 }  ],
          identification: [ { position: 20 } ] }
  PositionId;
  @UI: {  lineItem:       [ { position: 30 } ],
          identification: [ { position: 30 } ]}
  EmployeePosition;
  @UI: {  lineItem:       [ { position: 40 } ],
          identification: [ { position: 40 } ]}
  DateOfJoining;
  @UI: {  lineItem:       [ { position: 50 } ],
          identification: [ { position: 50 } ] }
  salary;
  @UI.hidden: true
  LocalLastChangedAt;
}

3. Behavior Definition

managed; //implementation in class zbp_i_rap_e2e_aemp unique;
define behavior for ZI_RAP_E2E_AEMP alias Employee
persistent table zrap_e2e_aemp
lock master
//authorization master ( instance )
etag master LocalLastChangedAt
{ association _Employment { create; }
  create;
  update;
  delete;
  field ( numbering : managed, readonly ) EmployeeUUID;
  field ( readonly ) active;
  field ( mandatory ) firstName, lastName, dateOfBirth;
  mapping for ZRAP_E2E_AEMP
  {
    EmployeeUUID = emp_uuid;
    EmployeeID = empid;
    FirstName = first_name;
    LastName = last_name;
    DateOfBirth = dob;
    Active = active;
    LastChangedAt = last_changed_at;
    LocalLastChangedAt = local_last_changed_at;
  }
}
define behavior for ZI_RAP_E2E_AEMPL alias Employment
persistent table zrap_e2e_aempl
lock dependent by _Employee
//authorization dependent by _Employee
etag master LocalLastChangedAt
{
  association _Employee;
  update;
  delete;
  field ( numbering : managed, readonly ) EmploymentUUID;
  field ( readonly ) EmployeeUUID;
  mapping for zrap_e2e_aempl
  {
    EmploymentUUID = employment_uuid;
    EmployeeUUID = emp_uuid;
    PositionId = position_id;
    EmployeePosition = e_position;
    ActiveDateOfJoining = active_doj;
    Salary = salary;
    LocalLastChangedAt = local_last_changed_at;
  }
}

So Basically, I have Employee and Employment entity, where Employee is the root entity and Employment is the child and the composition is via EmployeeUUID.

View Entire Topic
former_member14709
Contributor

Hi Basant,

Have you specified 'redirected to' statement to your parent entity association in your child entity Projection View?

Thanks,

Aman

basantmhr
Participant
0 Kudos

Thanks for the reply and yes, I have specified the "redirected to" statement.