Hi,
I am trying to explore side effects that shows error message immediately on entering the field input. But it is not reflecting in OData v2 or V4.
Please see below link.
Determine action executed on field affects messages
Steps followed:
validation Valid_Dates on save { create; update; field BeginDate; } determine action Det_act_valid_dates { validation Valid_Dates; }<code>side effects
{
determine action Det_act_valid_dates executed on field BeginDate affects messages; " This is not working
field BookingFee affects field TotalPrice; " This works fine
}
Not sure if there are additional prerequisites are there. Can you please help in resolving the issue.
Please see the complete code.
<code>managed implementation in class ZRK_SDE_BP_TRAVEL unique;
strict ( 2 );
with draft;
define behavior for ZRK_SDE_I_TRAVEL alias Travel
persistent table zrk_sde_a_travel
draft table zrk_sde_d_travel
etag master LocalLastChangedAt
lock master total etag LastChangedAt
authorization master ( global )
{
create;
update;
delete;
association _Booking { create; with draft; }
draft action Edit;
draft action Activate;
draft action Discard;
draft action Resume;
draft determine action Prepare;
field ( readonly )
TravelUUID,
TravelID,
OverallStatus,
TotalPrice,
LocalCreatedAt,
LocalCreatedBy,
LastChangedAt,
LocalLastChangedAt,
LocalLastChangedBy;
field ( numbering : managed )
TravelUUID;
determination Set_Travel_no on save { create; }
validation Valid_Dates on save { create; update; field BeginDate; }
determination Calculate_Total_price on modify { field BookingFee; }
determine action Det_act_valid_dates { validation Valid_Dates; }
internal action ReCalcTotalPrice;
side effects
{
determine action Det_act_valid_dates executed on field BeginDate affects messages;
field BookingFee affects field TotalPrice;
}
mapping for zrk_sde_a_travel
{
TravelUUID = travel_uuid;
TravelID = travel_id;
AgencyID = agency_id;
CustomerID = customer_id;
BeginDate = begin_date;
EndDate = end_date;
BookingFee = booking_fee;
TotalPrice = total_price;
CurrencyCode = currency_code;
Description = description;
OverallStatus = overall_status;
LocalCreatedBy = local_created_by;
LocalCreatedAt = local_created_at;
LocalLastChangedAt = local_last_changed_at;
LocalLastChangedBy = local_last_changed_by;
LastChangedAt = last_changed_at;
}
}
define behavior for zrk_sde_i_booking alias Booking
persistent table zrk_sde_a_book
draft table zrk_sde_d_book
lock dependent by _Travel
authorization dependent by _Travel
etag master localLastChangedAt
{
field ( numbering : managed )
BookingUuid;
update ( features : instance );
delete ( features : instance );
field ( readonly ) BookingUuid, TravelUUID;
association _Travel { with draft; }
// determination for calculation of total flight price
determination calculate_Total_Price on modify { create; delete; field flightprice; }
action Apply_Discount parameter zrk_sde_a_apply_disc result [1] $self;
side effects
{
field FlightPrice affects field _Travel.TotalPrice;
action Apply_Discount affects field _Travel.TotalPrice;
}
mapping for zrk_sde_a_book
{
BookingUuid = booking_uuid;
TravelUUID = parent_uuid;
BookingId = booking_id;
BookingDate = booking_date;
CustomerId = customer_id;
CarrierId = carrier_id;
ConnectionId = connection_id;
FlightDate = flight_date;
FlightPrice = flight_price;
CurrencyCode = currency_code;
}
}
Behavior Projection:
projection implementation in class ZRK_BP_SDE_C_TRAVEL unique;
strict ( 2 );
use draft;
use side effects;
define behavior for ZRK_SDE_C_TRAVEL alias Travel
use etag
{
use create;
use update;
use delete;
use association _Booking { create ; with draft;}
use action Edit;
use action Activate;
use action Discard;
use action Resume;
use action Prepare;
}
define behavior for zrk_sde_c_booking alias Booking
use etag
{
use update;
use delete;
use action Apply_Discount ;
use association _Travel { with draft; }
}
Best wishes,
Ramjee Korada