2025 Oct 03 10:28 PM - edited 2025 Oct 03 10:50 PM
When I query using the REST API the A_JournalEntryItemBasic resource of the API_JOURNALENTRYITEMBASIC_SRV service, if I change the list of fields to retrieve, using the $select parameter, then the order of the results change. Even if I add an $orderby !
For example, I expect that a GET request to this two URLs return the same record (same ID, same URI) but represented with a different set of fields. Because I'm passing `$top=1` so only the first result should be returned:
But two different URIs are returned. First:
{'__metadata': {'id': "https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_JOURNALENTRYITEMBASIC_SRV/A_JournalEntryItemBasic('.1~0C.3~0L.4~2018.5~A000.7~1010.9~0000000001')",
'uri': "https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_JOURNALENTRYITEMBASIC_SRV/A_JournalEntryItemBasic('.1~0C.3~0L.4~2018.5~A000.7~1010.9~0000000001')",
'type': 'API_JOURNALENTRYITEMBASIC_SRV.A_JournalEntryItemBasicType'},
'ID': '.1~0C.3~0L.4~2018.5~A000.7~1010.9~0000000001',
'Ledger': '0C',
'LedgerName': 'Management Accounting',
'SourceLedger': '0L',
'LedgerFiscalYear': '2018',
'ControllingArea': 'A000',
'ControllingAreaName': 'Controlling Area A000',
'CompanyCode': '1010',
'CompanyCodeName': 'BestRun DE',
'GLAccount': '1',
'GLAccountName': 'Paybls Domestic'}And second:
{'__metadata': {'id': "https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_JOURNALENTRYITEMBASIC_SRV/A_JournalEntryItemBasic('.1~0C.71~.73~.75~.77~')",
'uri': "https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_JOURNALENTRYITEMBASIC_SRV/A_JournalEntryItemBasic('.1~0C.71~.73~.75~.77~')",
'type': 'API_JOURNALENTRYITEMBASIC_SRV.A_JournalEntryItemBasicType'},
'Ledger': '0C',
'WBSElement': '',
'WBSElementDescription': '',
'PartnerCompanyCode': '',
'PartnerCompanyCodeName': '',
'CostCtrActivityType': '',
'CostCtrActivityTypeName': '',
'OrderID': ''}The OData specification says:
Select System Query Option ($select): A data service URI with a $select System Query Option identifies the same set of entities as a URI without a $select query option; however, the presence of a $select query option specifies that a response from the data service SHOULD return a subset, as identified by the value of the $select query option, of the properties that would have been returned had the URI not included a $select query option.
What am I missing?
UPDATE:
Apparently what I take as a row ID is actually a GENERATED_ID : a special property name used in OData services to uniquely identify aggregated or grouped data records. When you request aggregated data in an OData service, a GENERATED_ID property is automatically created for each resulting group. This ID serves as a unique key for that aggregated record, allowing you to request the same aggregated data again by referencing this ID.
So now, I don't know how to identify rows and thus how to match two rows from different queries. Can I rely on the order of the results?
Request clarification before answering.
what you are trying achieve?
because you are using different select, you can consider you working on completely different entityset.... what to match????
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 18 | |
| 7 | |
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.