Skip to Content

MDK: OData association/navigation, readlink

Hi,

I don't know how the MDK handles OData associations and navigation and I couldn't find anything useful in the documentation or the different blogs.

I have the following data model:

entity Reports {
	key ID: UUID;
	expenses: Composition of many Expenses on expenses.report = $self;
}

entity Expenses {
	key ID: UUID;
	report: Association to Reports;
}

I'd like to display the expenses associated to a report on a detail page. However I don't know how to achieve this. Maybe using the ReadLink property?

Here's how I can get the expenses for a given report using my OData service:

https://hostname:443/odata/v2/ExpensesService/Reports(guid'039f38bd-bd83-49b2-b3b8-793a012478bb')/expenses

Note: the generated list/detail application gives me an error and the expenses are not displayed (see https://answers.sap.com/questions/766202/mdk-read-entityset-failed-error-missing-property.html)

Cheers,

Pierre

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Mar 01, 2019 at 04:55 PM

    Pierre,

    Can you attach the $metadata for your service? It would be helpful to see how this is being represented in your application. Also are you trying to consume the service as online or offline?

    --Bill

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 19, 2020 at 08:41 AM

    Hi Pierre,

    did you tried the following target definition for your table in detailscreen:

    "Target": {
    		"EntitySet": "{{#Property:@odata.readLink}}/expenses",
    		"Service": "<yourMdkService>.service"
    	},
    
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 09, 2020 at 10:52 AM

    Hello,

    I also face a similar issue. I need to populate ShipTo list picker in my form, based on value selected for Customer list picker. Attaching metadata metadata.txt of my service. the solution provided by Michael above does not work for me!

    Please help.


    metadata.txt (16.9 kB)
    Add a comment
    10|10000 characters needed characters exceeded

    • Aanchal,

      I see you have also posted a new question for this issue as well. That is the preferred path as it will get the most visibility. Unless someone is directly following this question they may not see your post (I didn't).

      --Bill