Posts

Showing posts from January, 2022

Function Imports in OData and UI5

Image
Function Imports: Function imports are used to perform an action on a business object that can’t be executed by using CRUD-Q methods. An example of such an action is data retrieval of a different entity not directly in the context of a bound entity. Other examples including GetLongText, SaveLongText, ReleaseInspectionLot, setUsageDecision and ReleaseSalesOrder, performAvailablitiyCheck etc... If a function import is read-only, GET should be used as the HTTP method. If POST  is used, the framework checks for a CSRF token. Therefore function imports that perform changes should use the HTTP method POST. Function imports are defined on the service level, not the entity set level. As a result, you must determine the name of the function import in the service implementation. Define function import Define function import parameters By default all input parameters are mandatory however we can make it optional by checking the nullable column. There's a hidden field in the ALV-View of the p

Promises in SAPUi5

Image
Promises are useful for async success/failure because you're less interested in the exact time something became available, and more interested in reaching the outcome.  A promise is an object that may produce a single value some time in the future. It can be one of 3 states: Fulfilled: the asynchronous operation is completed, and the Promise has a value. Rejected: the asynchronous operation is failed. and the Promise will never be fulfilled Pending: the Promise's outcome hasn't yet been determined, because the asynchronous operation hasn't been completed yet. Promise users can attach callbacks to handle the fulfilled value or the reason for rejection. When a Promise is pending, it can transition to the fulfilled or rejected state. however, it will never transition to any other state, and its value or failure reason will not change. Creating Promise: Promise constructor takes one argument, a callback with two parameters, fnResolve, and fnReject (optional) Do something wi

Binding in SAPUI5

Image
  To work with the JSON data, SAPUI5 provides the class sap.ui.model.json. JSONModel and also called a client-side model and is necessary to load the data before operating on the data. Context A binding path consists of a number of name tokens, which are separated by a separator char. In all models provided by the framework, the separator char is the slash "/". Binding Path: Binding paths address the different properties and lists in a model and define how a node in the hierarchical data tree can be found. The binding path can be Absolute binding path absolute binding paths start with slash "/" Relative binding path relative binding paths start with a name token resolved relative to the context of the control that is bound Property Binding To define property binding on a control, you have the following options: As part of the control's declaration in an XML view Using JavaScript, in the settings object in the constructor of a control  In special cases bindProper