Posts

Preparing the ABAP developement environment for SAP BTP

Image
Setup SAP BTP ABAP environment Login to the SAP BTP account with your registered email id Click on Trial Home Click on Go To Your Trail Account to navigate to trail intance BTP cockpit   Create service instance: you can do this by simply going to the booster tab Click start, it will create your instance on the cloud. Once the setup is done download the Service key. You can view the created service under instance tab How to Create ABAP Cloud project: Note: You must already have an SAP BTP account with an ABAP service and service key. Also install Eclipse and the SAP ABAP Development Tools. Open ABAP Perspective -> Choose File -> New -> ABAP Cloud Project Use a Service key option will be selected as default. Choose Next Import the file or paste the service key into the editor. Choose Next Select Open Logon Page in Browser for validatng the account. Use your BTP login credentials to validated the account and you will see success message  Once verified the account success...

Functions in JavaScript

Functions: Functions are blocks of code designed to perform a specific task. Functions can help organize the code, avoid repetition and reduce the complexity of the code. 1. Function Declaration: the function in the main code flow To declare a function, you use the "function" keyword, followed by the function name, a list of parameters, and the function body as follows: function sum(a, b) {   let result = a + b;   return result; } 2. Function Expression: the function in the context of an expression Function name: It must be a valid JavaScript Identifier. The function names are in camelCase like "getSum()". "console.log()" is also a function to output a message to the console. let getSum = function(a, b) {   let result = a + b;   return result; }; Parameters vs Arguments:  The terms parameters and arguments are often used interchangeably. However, they are essentially different. When declaring a function, you specify the parameters.  However, when calling...

CDS Views

Image
Association Association is nothing but an on-demand/Lazy Join and is defined with Cardinality syntax. Does not support with ABAP editor. It is not a JOIN statement but we can join multiple tables. Cardinality: [MIN...MAX] to define the association between entities in a CDS view 0..1 - zero to one 0..* - zero to many 1..0 - one to zero 1..* - one to many @AbapCatalog.sqlViewName: 'zwm_sales_v' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'sales info' @ClientDependent: true @OData.publish: true   define view zwm_cds_sales     with parameters p_vkorg : vkorg    as select from vbak as header    inner join vbap as items          on header.vbeln = items.vbeln    association[1..*] to mara as _material         on items.matnr = _material.matnr    association[1..*] to makt as _text       ...

JavaScript Data Types

Image
What are Data Types? Data Types are an important and basic concept of JavaScript. JavaScript is dynamic and loosely typed language. It means you don't require to specify a type of a variable. JavaScript variables can hold different data types such as numbers, strings, objects and more. JavaScript Types are dynamic JavaScript has dynamic types. This means that the same variable can be used to hold different data types. We do not have to manually define the data type of the value stored in a variable. Instead, data types are determined automatically. Primitive and object Data types The values can be either of Object data type or Primitive data type . Object Data Type : Objects such as functions and arrays are referred to as non-primitive values. Primitive Data Type : The predefined data types provided by JavaScript language are known as primitive data types. Primitive data types are also known as in-built data types. The fundamental difference between primitives and non-primitives is...

Cast Operations and Case Statements in CDS

Cast Operations Cast operations represent some of the most important fundamental SQL functions. You can use cast operations for determining the type of a calculated field and for converting the type of existing fields on the database level. The CDS syntax supports casts onto elementary ABAP types as well as onto data elements. @AbapCatalog.sqlViewName: 'zcds_cast_v' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'View with Cast Operations' define view ZCDS_CAST as select from t000 {     t000.logsys as ProjectedField,     '20170809'  as CharacterField,     cast ( '20170809' as abap.dats )    as DateField,     cast ( cast ( 'E' as abap.lang ) as sylangu preserving type ) as LanguageField,     1.2 as FloatingPointField,     fltp_to_dec( 1.2 as abap.dec(4,2) ) as DecimalField }      By default, a field keeps the typ...

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...