cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to change key in extended standard OData service?

amar786
Explorer
0 Likes
408

I have a requirement where we need to show the Sales order line item and the Sales Order header item in one app. The Track Sales Order app (F2577) meets most of the requirement however, the business also wants to see the line items in the first page. I've been trying to work out a POC and stumbled on a small issue. Our backend developer extended the standard OData service and added 2 new fields (material # and sales document item) as well as some logic to fetch data. We tested out the service in the gateway client and the data shows up fine. The issue happens when I try to utilize the OData service in a Fiori app. I tried 3 methods:

  1. Adaptation project: I replaced the standard OData service with new OData service. However, when the data is displayed on the table, the salesDocumentItem column gets duplicated with the last item from the get request of a sales document. For example: if the get request fetches the first 20 record of a sales document, the salesDocumentItem column shows the same salesDocumentItem number which happens to be the last item from the get request 
  2. SAP Fiori elements app: I also tried to create a new Fiori elements app and utilize the service, but the same issue happens
  3. Custom Fiori app: I developed a fully custom app but instead of a smart table I used a regular sap.m responsive table with a JSON Model. The issue was solved here, and I am able to see unique salesDocumentItems in its respective column. 

After implementing the JSONModel in the custom Fiori app I realized the issue could be with the key that is implemented in the backend OData service. I noticed in SEGW that SalesDocument was the only key maintained. Ideally, we would need salesdocumentitem to be a key as well since each record is unique to the SalesDocument and salesdocumentitem. When I clicked on edit mode in SEGW and tried to click on "Is Key" for salesdocumentitem, it was blanked out and I actually could not edit any of the other properties. 

My question is, is there a way to change, add, or create a composite key for a standard OData service that has been extended?

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
SAP Champion
SAP Champion
0 Likes

do you have any experience of manipulating metadata by coding?

just get that property and set it as key in yout mpc ext.

lo_property->set_is_key( ).