I am playing around with RAP so I created some demo app. I defined root entity ZIS_I_Training and projection of it in ZIS_C_Training.
Here is the definition of these entities
define root view entity ZIS_I_Training
as select from zis_a_training as Training
composition [0..*] of ZIS_I_Participant as _Participant
composition [0..*] of ZIS_I_TrainingTask as _Task
association [1..1] to ZIS_I_Status as _Status on $projection.Status = _Status.Status
{
@ObjectModel.text.element: ['Name']
@Search.defaultSearchElement: true
key training_uuid as TrainingUuid,
@Search.defaultSearchElement: true
name as Name,
@Search.defaultSearchElement: true
@ObjectModel.foreignKey.association: '_Status'
@Consumption.valueHelpDefinition: [{entity:{name: 'ZIS_I_Status', element: 'Status' }}]
status as Status,
valid_to as ValidTo,
created_by as CreatedBy,
created_at as CreatedAt,
last_changed_by as LastChangedBy,
last_changed_at as LastChangedAt,
local_last_changed_at as LocalLastChangedAt,
/* Associations */
_Participant,
_Status,
_Task
}
Here is the projection:
@EndUserText.label: 'Training projection view'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Metadata.allowExtensions: true
@Search.searchable: true
define root view entity ZIS_C_Training
provider contract transactional_query
as projection on ZIS_I_Training
{
@Search.defaultSearchElement: true
key TrainingUuid,
@Search.defaultSearchElement: true
Name,
@Search.defaultSearchElement: true
@ObjectModel.text.element: ['StatusText']
Status,
ValidTo,
@Search.defaultSearchElement: true
CreatedBy,
CreatedAt,
LastChangedBy,
LastChangedAt,
LocalLastChangedAt,
_Status._Text.StatusText as StatusText : localized,
_Participant : redirected to composition child ZIS_C_Participant,
_Task : redirected to composition child ZIS_C_TrainingTask,
_Status
}
I think that definition of associated entites is not relevant for the problem, so I will not write it here.
I wanted to check how would it be possible to grab the input from the user described in the Blog post, so I introduced new action extendValidity and defined behavior for the interface entity as follows:
managed implementation in class zbp_is_i_training unique;
strict ( 2 );
define behavior for ZIS_I_Training alias Training
persistent table zis_a_training
lock master
authorization master ( instance )
etag master LocalLastChangedAt
{
create;
update;
delete;
association _Participant { create; }
association _Task { create; }
action extendValidity parameter ZIS_I_TrainExtend result [1] $self;
field ( numbering : managed, readonly ) TrainingUuid;
field ( readonly ) CreatedBy, CreatedAt, LastChangedBy, LastChangedAt, LocalLastChangedAt;
field ( mandatory ) Name;
determination setInitialValues on modify { create; }
determination setReadFieldOnChange on save { field Name; field Status; }
mapping for zis_a_training
{
TrainingUuid = training_uuid;
Name = name;
Status = status;
ValidTo = valid_to;
CreatedBy = created_by;
CreatedAt = created_at;
LastChangedBy = last_changed_by;
LastChangedAt = last_changed_at;
LocalLastChangedAt = local_last_changed_at;
}
}
and the projection
projection;
strict ( 2 );
define behavior for ZIS_C_Training alias Training
use etag
{
use create;
use update;
use delete;
use action extendValidity;
use association _Participant { create; }
use association _Task { create; }
}
The problem is that I am getting following error after I enter date in the popup window and confirm input.
Error is: Function import 'extendValidity' is not unique for actions ZIS_I_TRAINING-EXTENDVALIDITY and ZIS_C_TRAINING-EXTENDVALIDITY
What should be the reason for this?
Request clarification before answering.
I've just tried to create OData V4 service and found out that this works perfectly fine. Maybe this will help someone who has the same problem. Still, would be interested to know how to solve this for OData V2.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.