cancel
Showing results for 
Search instead for 
Did you mean: 

Multilevel Deep Insert Issue

Former Member
0 Kudos

Hello fellow SAPers.

I have an issue figuring out how to make a multilevel deep insert to work out.

So far the issue I'm having is how to make a working types for it to work, the scenario is as follows.

We have our main entity, which is Insurance, insurances has header data, such as an ID and a few more fields.

Insurance has defined three navigation properties/associations with another three entities, that works correctly.

One of those entities is a beneficiary, for an insurance there can be n number of given beneficiaries.

Lastly, the beneficiary entity has two navigation properties/associations defined.

Issue comes when trying to fetch/fill the associated entities. The types we use in ABAP is something like this:

TYPES BEGIN OF insurancebeneficiaryset.
           INCLUDE TYPE zcl_ztest_request_gene_mpc=>ts_insurancebeneficiary.
   TYPES:   imageset               TYPE STANDARD TABLE OF zcl_ztest_request_gene_mpc=>ts_image WITH DEFAULT KEY,
                  electronicsignatureset TYPE zcl_ztest_request_gene_mpc=>ts_electronicsignature,
         END OF insurancebeneficiaryset.

   DATA: lt_insurance TYPE STANDARD TABLE OF insurancebeneficiaryset WITH DEFAULT KEY,
         ls_insurance LIKE LINE OF lt_insurance.

 
   DATA: BEGIN OF lty_full_insurance.
           INCLUDE TYPE /cbcr/cl_pr_moborigin_mpc_ext=>ts_insurance.
   DATA: insurancebeneficiaryset LIKE TABLE OF lt_insurance,
             insurancemodalityset    TYPE /cbcr/cl_pr_moborigin_mpc_ext=>ts_insurancemodality,
             insurancepaymentset    TYPE /cbcr/cl_pr_moborigin_mpc_ext=>ts_insurancepayment,
    END OF lty_full_insurance.


When I do the query request to the set using an expand command, only the main info is being taken in consideration, so only insuranceModalitySet and InsutancePaymentSet is taken into consideration, however insuranceBeneficiaryset is getting ignored, as well as ImageSet and electronicSignature in the response, just like this:


We're using an expand_entityset to perform this test.

I've also checked, the expand properties are being called correctly, and the names for the types are set correctly.

I'm also facing the issue trying to call the two entities in the beneficiarySet in the URL:

If the URI is like this:  InsuranceModalitySet,InsurancePaymentSet,InsuranceBeneficiarySet/ImageSet it "works".

If however, in the URI i try to expand the electronic signature set and the image set, it gives me this error:


With an URI like this: /InsuranceSet?$expand=InsuranceModalitySet,InsurancePaymentSet,InsuranceBeneficiarySet/ImageSet/ElectronicSignatureSet or this /InsuranceSet?$expand=InsuranceModalitySet,InsurancePaymentSet,InsuranceBeneficiarySet/ImageSet,ElectronicSignatureSet

Perhaps I'm not calling the URI correctly or something else.

If any of you guys could give me any idea of what's the error it would be highly appreciated, in the mean time I'll still run some tests and figure out what's wrong.

Cheers.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Well, there's an update on my current issue.

I managed to create the correct payload in order to create a Deep Insert request. However I've stumbled upon a new issue regarding the relations of some of my data.

My payload, is built like this:

Insurance Data:

     Beneficiary Data

          Beneficiary Images Data

That's the relationship tree I have right now, however, when I perform the post with the payload, the BeneficiaryImage Data is getting mixed up.

The mapping is as follows:

Associations are settled as:

Insurance to beneficiary 1 - n

Beneficiary to Images 1 - n

There's no referencial constrains set, and there's navigation properties set as well.

Debugging, I can see that the info is getting set correctly for the insurance header data, beneficiary data, however, the image data gets moved.

Here's how the info is set:

Here's the payload with the Image info.

Strangely enough, if I run the test with 2 beneficiary registers, the second one gets the images set.

I used this to guide myself

to create the relationships.

I'm unsure if this is an issue with how I declared the types to catch the data or if there's something missing in the model.

If you guys have any idea, please do let me know.

Best regards and thank you all in advance.

Cheers.