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..
Related
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.
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
I am using an OData model in my SAP UI5 application. I do the following:
var oView = this.getView();
this._oModel = oView.getModel();
which I thought loaded the model and allowed me to access whatever I needed to inside the model. However whenever I try to get a property using getProperty(path) it returns undefined. I know the path is correct because I used it elsewhere in my application and it worked okay. The model I am using is named "metadata.xml" if that helps.
If you read the documentation provided by SAP talking about OData services (I assume v2), you might find your answer there. Since you are using getProperty(), "you can only access single entities and properties with these methods. To access entity sets, you can get the binding contexts of all read entities via a list binding." Therefore you may want to a read() of the entity set first and then use the results of this read to access whatever property you want.
Link to doc: https://sapui5.hana.ondemand.com/#docs/guide/6c47b2b39db9404582994070ec3d57a2.html
I'm using breezejs with an entity framework 5 model. The model is the old-school edmx/objectcontext style- not the newer dbcontext/poco style.
The model is shared with some wcf ria services domain services so I cannot switch to entity framework 6 or poco style entity framework at this time.
When using wcf ria services, if you wanted to add a property to an entity beyond what is generated by entity framework you could create a partial class, define the property and annotate it with the datamember attribute. Wcf ria services treats this new property like any other property and sends it to the client from the server and back to the server.
Is there a way to do the same thing with breezejs? Without moving entirely away from the automatic metadata generation goodness that comes with using entity framework?
Using fiddler I can see the property I want exposed is transmitted to the client during a query request.
I've looked at the documentation here http://www.breezejs.com/documentation/extending-entities but none of the examples seem to fit this scenario.
Breeze supports unmapped properties, these are properties that are declared on your javascript constructor that cannot be matched to any property in metadata. By default these properties are both persisted locally and sent to the server on a save. This is described in the link you mentioned:
http://www.breezejs.com/documentation/extending-entities
var Customer = function () {
this.myUnmappedProperty = "anything22";
};
myEntityManager.metadataStore.registerEntityTypeCtor("Customer", Customer);
These values will be available on the server after a SaveChanges call via the 'UnmappedValuesMap' property on each EntityInfo instance.
var unmappedValue = entityInfo.UnmappedValuesMap["myUnmappedProperty"];
What is sounds like you are looking for is "unmapped" properties to go in the "other" direction, i.e. from the server to the client. What might work for that but we haven't tried is adding a property to your server side EF class ( via the partial class mechanism) and mark it up for Json serialization. It "should" then get serialized down to the client, even though it won't show up in Metadata.
If this does NOT work, please post back here and we will consider it as a breeze feature request. The basic idea does make a lot of sense and we should support it.
I'm trying to implement some custom model metadata in ASP.NET MVC 3. I can't use data annotation attributes since some of the metadata could change based on configured values, so I need a solution that will let me set the metadata on every request. I've been reading about custom model metadata providers, but I can't find anything about support for dynamic metadata scenarios.
Does the MVC framework cache the metadata from the model metadata provider, or will the CreateMetadata method be called on every request? Is a custom model metadata provider a good solution for dynamic metadata, or should I just put it in the view model?
Edit: This isn't necessarily validation metadata I'm talking about, so I'm not looking for a validation specific solution. It could just be metadata to be displayed or used by the view (in HTML 5 data attributes for example).
Another example might be a database driven field label. Usually one would use the Name property of the Display attribute, but this wouldn't work if you wanted to dynamically set the display name based on a value in the database.
You can derive your custom provider from DataAnnotationsModelMetadataProvider so you will inherit all the base behaviour.
Yes, CreateMetadata is called on every request, so you can do something fancy, like go to DB and load some data that may change in time.
For labels I would implement custom ResourceProvider that uses Db as the source of label (based on current culture / account, etc.) Example is here: http://www.codeproject.com/Articles/14190/ASP-NET-2-0-Custom-SQL-Server-ResourceProvider