cancel
Showing results for 
Search instead for 
Did you mean: 

Create Deep Entity in SAP UI5 - oData Model

Former Member
0 Kudos

Hi,

I am doing a CRUD project and want to perform a deep entity creation. I've an entity Student and another is Enrollment. A Student can have multiple Enrollments. For this, I've created Association b/w these 2 entities.

Now from SAP UI5, i want to call create operation in which while creating Student record, i also want Enrollment records to be inserted into DB.

I am trying to use the following code to create the required Data object.

oNewEntry.StudentID = "000";        // Will be generated

oNewEntry.StudentName = "Xyz";

oNewEntry.Course = "ABC";

oNewEntry.Age = parseInt(25);

oEnrollment = {};

oEnrollment.StudentID = "000";

oEnrollment.CertificateID = "SAPUI5";

oEnrollment.EnrollDate = new Date(2014,03,30,00,01,00);

oEnrollment.CreateDate = new Date(2014,03,30,00,01,00);

oEnrollment.Status = "X";

oNewEntry.Enrollment = oEnrollment;

oModel.create("/StudentSet",

  oNewEntry,

  null,

  function()

  {

   alert("Student record created successfully!");

  },

  function()

  {

   alert("Student record creation failed!");

  }

);

I am trying the above code, but it always throw the following error.

The following error text was processed in system GW1 : Specified value is not a valid value for the type of an XML document                                                                                                                                                                                           The error occurred on the application server XXXXXX. The termination type was: RABAX_STATE.

Am i doing any mistake while creating oNewEntry object ? As I am able to create entity StudentSet & EnrollmentSet  individually but not as Deep Entity in one go.

Please Help.

Accepted Solutions (0)

Answers (1)

Answers (1)

ChandraMahajan
Active Contributor
0 Kudos

Hi,

Just refer this blog

Regards,

Chandra

Former Member
0 Kudos

Hi,

Thanks for you reply.

Probably this will not solve my problem because the link is about Batch operation But in my case i want to create one entity of Student but with 1 or more entities of Enrollment (using Deep Insert).

Regards,

Rohit

ChandraMahajan
Active Contributor
0 Kudos

you can refer this thread discussion which talks about parent-child entity relationship.

also please mention navigation name as mentioned in the thread.

Regards,

Chandra