SEGW warning "Potential data loss" for Edm.DateTime - odata

Is it possible to add Edm.DateTime field based on CDS View Date Source Reference without warnings in SAP Gateway Service Builder?
I created simple CDS View based on select from dd07l with Date field just to show this case, code to create date field is taken directly from sap help example: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abencds_f1_date_time_conversions.htm
It works fine, but during project check in SAP Gateway Service Builder (segw) there is warning shown due to missing Precision field settings, but it is not possible to change it manually in segw for Data Source Reference.
I was looking for some annotation for that purpose, but I didn't find any suitable for it.
#AbapCatalog.sqlViewName: 'ZTEST2_V'
#AbapCatalog.compiler.compareFilter: true
#AbapCatalog.preserveKey: true
#AccessControl.authorizationCheck: #CHECK
#EndUserText.label: 'Test'
define view ZTEST2_CDS as select from dd07l as domain
{
key domain.domname,
key domain.domvalue_l,
tstmp_to_dats(tstmp_current_utctimestamp(), abap_system_timezone($session.client, 'NULL'), $session.client, 'NULL') as dat
}

Most probably in your SEGW service definition OData V2 is specified. OData V2 only has Edm.DateTime and when converting ABAP DATS field to Edm.DateTime you will always receive this warning.
Starting from NW 750 you can also implement Odata V4 services via SEGW which has special Edm.Date type, but it significantly affects frontend implementation. So, if you have to stick with Odata V2 I would suggest just ignore this warning.

Related

SAP OData Service Filter is not filtering

I'm learning to get delta data from SAP Fiori sample gateway to Azure SQL by using Azure Data Factory and filter feature on OData service.
I'm using OData Service that exposed by Fiori sample, and one of the table sample is PurchaseOrders.
I tried like this:
$filter=ChangedAt ge datetime '2020-09-08T22:00:00'
But it is still return all the records.
I found sap:filterable is false at metadata
Is that filterable false is made me cannot filter this?
Is there any other way to do delta extraction on OData rather than using filter?
Thank You
As #Boghyon wrote above the "sap:filterable" is just an Annotation, which can help to build the UI. You have to check the DPC_EXT class's GET_ENTITY_SET method of the entity type that you try to filter. If filtering isn't implemented then (1.) in case of standard service you're more or less stuck (it cannot be filtered for a reason) (2.) in case of custom service you can implement filtering

Do Item custom properties share the same limitations as extended properties?

The documentation mentions that extended properties are a finite resource in a user's mailbox, and exceeding this limit will result in unexpected errors when trying to create new properties.
It is not mentioned explicitly anywhere that I could if item customProperties, as written to through the Office.js client, has the same limitation. Does it?
We plan to optionally write a small amount of data to item customProperties if the user modifies inputs exposed in our Add-in Taskpane in the Outlook client. These properties will later be read by a server consuming changed events through the events delta API.
Will we eventually run into issues with this approach if we don't implement some sort of "garbage collection" of no longer used customProperties?
Item custom Properties are extended properties https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcext/4cf1da5e-c68e-433e-a97e-c45625483481?redirectedfrom=MSDN
So you have one extended property and then the value is a Json Key pair so one Extended property provides multiple custom properties (up to the limitation of the size of the Extended property)
Even if you don't want to use Item Custom properties its a good idea to follow the same approach eg create one extended property for your app and then store what ever combination of property values you need as a JSON structure in the value on the property. Its not a good idea to have your application creating random/multiple custom properties as you will easily exhaust them/create a mess and there is no advantage in doing it that way.

Find picklist values in Dynamics via the Web API

I'm trying to determine how I can find the integer values for picklist fields in Dynamics via the web api. I can access the basic metadata by using:
GET https://[COMPANY].api.crm3.dynamics.com/api/data/v9.0//EntityDefinitions(LogicalName='lead')/Attributes/
but for picklist values I don't see the mapping of the integer value to the displayed string.
Is there a table that holds all of this or a way to expand this information on the above call?
You can use this to retrieve.
https://[COMPANY].api.crm3.dynamics.com/api/data/v9.0/EntityDefinitions(LogicalName='{Entity Name}')/Attributes(LogicalName='{OptionSet Name}')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=GlobalOptionSet($select=Options)
Reference

Change precision of RFC parameter in OData service builder?

I am using SAP function BAPI_TRADINGCONTRACT_GET_LIST in which there is property reqquality whose type is edm.decimal, precision is 13 and scale 3. I want to edit it, but can't do it. How can I change the scale value to 2?
Or how can I edit a property of the RFC module?
Or any other procedure to handle the properties?
This depends on whether the Odata model is a custom one or if you are using an existing SAP delivered one (in the SAP namespace).
If you are using a SAP standard one, I would check if SAP has provided a Business Add In (BADI) to enhance the metadata model and associated data provider - for common Odata models SAP provides extension capabilities, here I would just add a new field and set it to the precision you require.
If the above is not available you could create a new Odata Model (using transaction SEGW) and wrap the function as per this tutorial - http://scn.sap.com/people/volker.drees/blog/2012/10/26/step-by-step-guide-to-build-an-odata-service-based-on-rfcs-part-1
Good Luck..

Can I filter OData resources by last updated date?

Is it possible to query an OData collection filtering by the updated metadata field? The case for that would be to get a list of updates since the last check.
I've tried http://odata.netflix.com/v1/Catalog/People?$filter=updated%20eq%202011-05-15T21:45:31Z, but it gives me "No property 'updated' exists in type 'Netflix.Catalog.Person' at position 0". Is there another way I can do this or reference the updated property in a filter statement?
The updated element in the ATOM feed/entry representation may or may not contain actual data. Some services actually do store the real updated timestamp there, but some don't. Since the element is required to be present in all entries by the ATOM format, services which don't have the data to use there usually put some arbitrary timestamp as the value (by default WCF Data Services uses DateTime.Now for the updated field, which is what netflix service does as well).
The $filter can only reference real properties on a given entity. So if the service does have a property which contains the data backing the updated element you would need to find out the name of such property (in the $metadata for example) and then use that. If the service does not have a property like that (for example the netflix service doesn't), then there's no way to filter based on last updated timestamp, as there's no such thing in the underlying data store (the updated element is effectively a fake).
Also note that if you ask for JSON payload the updated element doesn't exist there and so only the real properties are present. Any query operators in the URL work only on the real properties.

Resources