I have been using Web IDE trial version to try out one application.
The application needs to pass data to Gateway method Create Deep Entity.
While using oModel.create() getting an error which says method not implemented (i.e. Plain create method is called with oModel.create(), which is not implemented on SAP Gateway. but what I need to call is create_deep_entity method )
Just need to know is there any syntax that will tell Web IDE that Deep Create is to be called.
there is not a create_deep entity method as such in SAPUI5. If your deep insert is correctly implemented on SAP Gateway, you just need to use a standard create or post mehod on sapui5 with the difference that the data you are sending will not have a flat structure. See the example of #serban Petrscu.
oModel.create({field1: '', field2: 0, childEntity: {field3: 'ABC'}})
Related
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
Friends:
In the service class I am trying to query the DB and get result to populate my domain class. I am not sure if I thinking this correctly or I have to use the find methods approach to fill my domain classes ?
The understanding I have is:
Grails thru URLMappings will call my controller and inside that I can do a direct instantiation of Service class.
I am then using SQL directly there inside Service class to iterate thru the Resultset and populate the Domain class list and return that to controller class which will then return a list back to the REST call user.
Is this the right approach or I have to call Service from controller but using the find method and that will fill the list and that should be used to return the list ?
In all cases I am using the H2 db itself.
Regards and Thank you for your time.
-Narahari
As per the standards, Flow goes from controller > Service > DAO.
All the business logic should be written in the service class only.
As you are using DAO layer is hidden through GORM.
Grails is very powerful and productive language. You use GORM for database activity. For your scenario, you could use findAll, createCriteria, HQL or native SQL query approach, but the flow should not be broken. It means that if write database related code in the controller then in future it will be difficult to maintain debug code.
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'am new in Olingo: sorry if my question is strange.
When Olingo service receive request to get entity of EntitySet_1 it calls method of custom entityProcessor (then processor call some storage object and send to it EdmEntitySet and List objects). But this processor method must get entity of EntitySet_2 to end processing. How i can realize getting entity of another entitySet? Or in other words: how can i get entity of another entitySet programatically (is it necessary to create new EdmEntitySet object? etc.) ?
Maybe some ideas, clever words...
Found only one solution: REST-request to the same service for entity of EntitySet_2 while processing entity of EntitySet_1.
Such feature should comes from the design itself. Calling same service from itself is not recommended.
What you should do is utilize the data access methods (ex:- database access method) you already have and get the required EntitySet_2 from it for processing.
For this you will need to create data access requests (ex:- SQL query for EntitySet_2) and map the results to create the EntitySet_2. As I said earlier, the design of your service should be flexible enough for this.
Have all a structure for creating complex queries and obtaining data on the client side using Breeze and webapi IQueryable<T>.
I would use this structure on the client side to call another webapi controller, intercept the result of the query, and use this to make an Excel file returned by HttpResponseMessage.
See: Returning binary file from controller in ASP.NET Web API
How can I use the executeQuery without getting return data in standard Breeze JSON and without interfering with the data on the client side cache to have the 'octet-stream'.
The goal is to create an 'Export to Excel' without existing frontend paging for a large volume of data.
If you don't want to track changes, call EntityQuery.noTracking() before calling executeQuery(). This will return raw javascript objects without breeze tracking capabilities.
You can't make executeQuery() return binary 'octet-stream' data. But you can use breeze ajax implementation:
var ajaxImpl = breeze.config.getAdapterInstance("ajax");
ajaxImpl.ajax() // by default it is a wrapper to jQuery.ajax
Look http://www.breezejs.com/documentation/customizing-ajax
Create a custom "data service adapter" and specify it when you create an EntityManager for this special purpose. It can be quite simple because you disable the most difficult parts to implement, the metadata and saveChanges methods.
You don't want to cache the results. Therefore, you make sure the manager's metadata store is empty and you should add the " no caching" QueryOption. [exact names escape me as I write this on my phone].
Make sure these steps are really adding tangible value
Specialized server operations often can be performed more simply with native AJAX components.
p.s. I just saw #didar 's answer which is consistent with mine. Blend these thoughts into your solution.