Skip to Content
0
Sep 02, 2022 at 08:48 PM

Draft not working for Association RAP

854 Views

Hi Gurus,

Lloyd Fernandes

Siddhartha Routh

I am facing Issue in saving draft for Association table. Below is my Behavior definition code...

When I am saving draft only non Key field is getting saved in Draft table but key fields are not saving...

issue.jpg

highlighted fields are key fields which are not getting updated in draft.. Even they are not getting saved with Draft as well... and this started when I activated Draft functionality.

managed implementation in class zbp_i_stud5001 unique; //Everything will be taken care by Framework
//strict;
with draft;

define behavior for ZI_STUD5001 alias Student

persistent table zrap_stud5001
draft table zrap_drstud5001
lock master total etag Lastchangedat
authorization master ( instance )
etag master Locallastchangedat
{
  create;
  update;
  delete;
  association _academicres { create; }
  field ( numbering : managed, readonly ) Id;
  field ( readonly ) Courseduration;
  action ( features : instance ) setActive result [1] $self;
  validation validateAge on save { field  Age; create; }
  determination updateCourseDuration on save  { field Course; }
  //instance : Operations of a business object can be enabled or disabled depending on instance-specific criteria
  //result : The output parameter for an action or function is defined with the keyword result.
  //It can be used to store the result of an action or function in an internal table.
  //$self : specifies that the result type is the same type as the entity for which the action or function is defined.

  mapping for zrap_stud5001
  {
    Id = id;
    Firstname = firstname;
    Lastname = lastname;
    Age = age;
    Course = course;
    Courseduration = courseduration;
    Status = status;
    Gender = gender;
    Dob = dob;
    Lastchangedat = lastchangedat;
    Locallastchangedat = locallastchangedat;

  }
}

define behavior for ZI_AR_5001 alias AcademicResult
persistent table zcim_rap_ar_5001
draft table zrap_dr_ar_5001
lock dependent by _student
authorization dependent by _student
//etag master <field_name>
{
  update;
  delete;
  association _student;

  field ( readonly ) Id;
  field ( readonly ) course_desc;
  field ( readonly ) semester_desc;
  field ( readonly ) semres_desc;

  mapping for zcim_rap_ar_5001
  {
    Id = id;
    Course = course;
    Semester = semester;
    Semresult = semresult;
  }

}

Please help. let me know if I need to make my question more clear..

Thanks-

Abhishek

Attachments

issue.jpg (28.8 kB)