cancel
Showing results for 
Search instead for 
Did you mean: 

SAP RAP behavior definition error with Lock master

sahu101
Explorer

I have three tables, table1 is the parent of table2 and table2 is the parent of table3. I have created the cds views and now I am trying to create the behavior definition. I have marked table1 as root entity and now in the behavior definition I am getting an error The association "_table2_table3" does not reference entity "table1", which is specified as authorization master. Now I cannot specify table2 as root entity as it has association. How do I solve this error? Following is the behavior definition:

managed implementation in class zbp_table1_cds unique;
strict ( 2 );

define behavior for ztable1_cds
persistent table ztable1_tab
lock master
authorization master ( instance )
{
  field ( readonly ) tab1_id, CreatedOn, LastChanged, LocalLastChanged;
  field ( numbering : managed ) tab1_id;
  create;
  update;
  delete;
  association _table1_table2 { create; }
  association _table1_table4 { create; }
  
}

define behavior for ztable2_cds
persistent table ztable2_tab
lock dependent by _table1_table2
authorization dependent by _table1_table2
{
  field ( readonly ) tab2_id, CreatedOn, LastChanged, LocalLastChanged;
  field ( numbering : managed ) tab2_id;
  update;
  delete;
  field ( readonly ) tab1_id;
  association _table1_table2;
  association _table3 { create; }
}

define behavior for ztable3_cds
persistent table ztable3_tab
lock dependent by _table2_table3
authorization dependent by _table2_table3
{
  field ( readonly ) tab3_id, CreatedOn, LastChanged, LocalLastChanged;
  field ( numbering : managed ) tab3_id;
  update;
  delete;
  field ( readonly ) tab3_id;
  association _table2_table3;
}

define behavior for ztable4_cds
persistent table ztable4_tab
lock dependent by _table1_table4
authorization dependent by _table1_table4
{
  field ( readonly ) tab4_id, CreatedOn, LastChanged, LocalLastChanged;
  field ( numbering : managed ) tab4_id;
  update;
  delete;
  field ( readonly ) tab1_id;
  association _table1_table4;
}


patrick_winkler
Product and Topic Expert
Product and Topic Expert

table3 has an association to parent table2 but can also have an additional association to table1. You can then use the association to table1 with authorization dependent by

Accepted Solutions (0)

Answers (3)

Answers (3)

patrick_winkler
Product and Topic Expert
Product and Topic Expert

table3 has an association to parent table2 but can also have an additional association to table1. You can then use the association to table1 with authorization dependent by

PaulTiemann
Participant
0 Kudos

Thank you Patrick!

I found also: https://community.sap.com/t5/technology-q-a/no-behavior-is-defined-for-the-association-quot-travel-q...

Here they use the hierarchy TRAVEL -> BOOKING -> BOOKING_SUPPLEMENT.

In order to avoid our issue, they add an association from BOOKING_SUPPLEMENT to TRAVEL which then allows you to use this in the behavior definition.

I give this some thoughts and find that a good solution.

PaulTiemann
Participant
0 Kudos

I have the same issue.

mremmer
Newcomer
0 Kudos

Hello Sahu101, I have the same issue, and I haven't found any solution yet. Did you have any way to solve this?