SAPUI5 - TECHNICAL GYAN GURU https://technicalgyanguru.com All SAP information on 1 place Wed, 28 Aug 2024 05:12:34 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 https://technicalgyanguru.com/wp-content/uploads/2024/04/cropped-cropped-technical--32x32.png SAPUI5 - TECHNICAL GYAN GURU https://technicalgyanguru.com 32 32 130 SAPUI5, SAP Fiori, HTML, CSS, JavaScript & jQuery, Interview Questions & Answers https://technicalgyanguru.com/130-sapui5-sap-fiori-html-css-javascript-jquery-interview-questions-answers/?utm_source=rss&utm_medium=rss&utm_campaign=130-sapui5-sap-fiori-html-css-javascript-jquery-interview-questions-answers https://technicalgyanguru.com/130-sapui5-sap-fiori-html-css-javascript-jquery-interview-questions-answers/#respond Sat, 28 Sep 2024 06:39:00 +0000 https://technicalgyanguru.com/?p=4860 Many requests for the next round of interview questions and answers came in after I posted my interview questions on SAP Fiori, SAP HANA ABAP. As I stated in my…

The post 130 SAPUI5, SAP Fiori, HTML, CSS, JavaScript & jQuery, Interview Questions & Answers first appeared on TECHNICAL GYAN GURU.

]]>
Many requests for the next round of interview questions and answers came in after I posted my interview questions on SAP Fiori, SAP HANA ABAP. As I stated in my last post, we cannot assess someone’s level of expertise based solely on how they respond to specific queries. Although some highly skilled technical architects are capable of designing and completing intricate projects, they might not perform flawlessly in an interview.
Reason is easy to understand.There are situations when interviewers are rejecting candidates (in which case, not even God can save you), and other situations where the candidate is unable to articulate the correct response in a logical and sequential manner (despite knowing the answer). In my career, I have conducted very few interviews and

I have created a series of questions and answers from my study notes in the hopes that these may assist the deserving candidate who wants to ace the interview for his next project/job. Although you still need to thoroughly comprehend each topic to have a firm grasp of the principles, this quick Q&A may help you review and assess your knowledge.

Q1. SAP Fiori LaunchPad Benefits

Adaptability

Device Assistance

Independent of Platform

Support for Browsers

coherent in character

Combination

Open norm

Record-keeping

First, decide which view (the default view) to load into the app control.

Step 2: Add the view’s object (page) to the app to make the view aware of it.

We return the main view’s object in the createContent method. that is, the page

  1. How Do I Make a Control in the User Interface?

The process involves creating an event for a control (such as a button), defining it in the controller, and then adding the control to the page.

Q4. Using the API to switch to a different view?

Answer app.to

Q5. How can I obtain the object’s runtime instance in order to access the control’s object?

The answer is sap.ui.getCore.byId (“”).

  1. Explain the SAP UI5 Framework.

A framework for creating responsive web applications is SAP UI5. Performance has nothing to do with responsiveness; responsiveness is the capacity of a program to adjust to any type of device. It provides a consistent user experience on all platforms (various browsers and devices).

A framework is made up of libraries; libraries contain classes, and classes contain methods.

Q7. UI technology evolution

Q8. Explain the SAP UI5’s design-time and run-time components.

Yes, in fact. Typically, a framework is made up of two kinds of libraries, each of which has two components: Design-time The SAP UI5 component includes all of the classes, frameworks, and functionalities needed to build any kind of application from the ground up.

The Fiori application is executed by the SAP UI5 run-time component, which also includes a renderer that converts the application code into a format that is readable by browsers (such as HTML5, CSS, and JS).

Q9. What are the steps involved in creating an application in any programming language?

Bootstrap in UI5 –

1 Initialization – Load required dependencies \script id=”sap-ui-bootstrap” src = “sap-ui-core.js” = “sap.m”; data-sap-ui-libs;With theme “sap_bluecrystal,” data-sap-ui
In the tag of the HTML document, specify class=”sapUiBody” to make the theme active on the page.

  1. Declaration – Program Data Variables – Create User Interface Control new libraryName = var var_name.ClassName(sId, sProperties); sId: your UI control's unique ID sProperties: To configure control attributes, use control properties. inside braces with curls.

( ) – curly braces [] – parenthesis { } – bracket

  1. The real program logic, also known as orchestration logic, which includes manipulation, IF, loops, calls, and user display control

PlaceAt(“id of control”) for ObjectContro ;

  1. Output: Present the user’s output.
  2. Tidying Up

Q10. How can the Bootstrap for UI5 framework be loaded so that it can function offline?

Observe the index.html file’s syntax:

The rationale is that all UI5 Framework Libraries are pre-installed on Orion Server, which powers the WebIDE local installation. We define neo-app.json, which serves as an interface between Orion Server ->> Resources (test) to load the framework and use the libraries within.

Q11. How to load the Bootstrap for UI5 framework to work in the Offline Mode?

Reason being: Since the WebIDE local installation runs on Orion Server, which has all UI5 Framework Libraries pre-existing in the Server. To access the libraries in the framework, we define neo-app.json which acts as an interface between Orion Server ->> Resources ( test ) to load the framework.

Q11. Define structure of a Web Application / HTML page?

Every web application that a browser can comprehend is always an HTML page, also known as a static webpage. An HTML page is the typical web application page’s structure.

<html>
                <head>
                                ( * creation of control )
                </head>
                <body>
                                ( * place the control in the body )
                </body>
<html>

  1. What is the SAP WEB IDE?

Yes. Developers can construct and extend Fiori Apps using the SAP WebIDE Integrated Development Environment (IDE).

  • Developing Fiori Apps is made simpler by employing pre-made templates.
  • To expand Fiori Applications, use the Extensibility Pane.
  • Numerous choices for deployment.
  • permits group repository sharing. Git repository
  • can use any device to access it from anywhere. No local footprint; installation must be done locally.

Q13. What is HTML?

HTML stands for Hypertext Markup Language which is created by W3C = World Wide Web Consortium who is responsible for defining HTML tags and versions. All browser vendors like Chrome, IE, Firefox, Safari.

It is used to create static web pages.

HTML is not a programming language. It is based on tags, if we follow the approach, we can create a static webpage using these standard tags. E.g. button, input, datalist, li, ul, h1, table … etc.

Important Points to be noted:

  • HTML is not case-sensitive
  • Browser directly understand HTML
  • User can only see content in browser provided it is kept in body of HTML
  • Every HTML element can have ID property. Developer should make sure that ID is always unique.
  • Html elements can also have name, class (classification) property, which doesn’t needs to be unique.
  • Difference between HTML and HTML5?
    • HTML5 is just the advancement of HTML, it was released in year 2014.
    • HTML5 is labral in nature
      • Even we put something in head of html, it will be visible to user. Ideally we should not do that.4
    • Declaration of DOCTYPE

Older version example <!DOCTYPE html DND_VERSION=“XHTML/4.02” HTMLSCHEMA=“htmlns”>

<!DOCTYPE html> à tells the file that it’s an html page

  • For some of the tags in HTML5, we don’t need to put ending tag e.g. img, input
    • New elements introduced to define proper structure of the website like header, footer, article, section etc.
    • Direct support for Audio and Video tags in HTML5, before that plug-in support was needed in browsers

Q14. Difference between HTML5 and SAP UI5?

Q15. Difference between Open UI5 and SAP UI5?

  • The most widely used libraries for user consumption are included in Open UI5, which is a subset of SAP UI5.
  • While SAP UI5 is a licensed product that is included with SAP Netweaver or SCP (SAP Cloud Platform, formerly known as HCP – HANA Cloud Platform), Open UI5 is available as open source under the Apache 2.0 license.

Q16: In HTML, what is a metatag?

It shows the HTML page’s metadata. (For additional information about attributes, visit www.w3cshools.com.)
Features of a metatag include:
Encoding type: aids the user in determining the appropriate character type
Author: Keyword generated content that appears in a metatag for search engine optimization
Description: An overview of the websites found in search engine

Q17. What do HTML List tags mean?

Data sequences are displayed using list tags.

Two categories of list tags exist:

List not in order: <ul></ul>
List in order: <o></o>

Q18: What elements are at the block level?

The HTML content is correctly structured through the usage of block level components. These components don’t take up any space on the page. Two kinds of elements at the block level:

div stands for division tag.

It begins automatically with a new line.
used to assemble or form a block of components.
span is an inline element.

It doesn’t begin with a new line.
It encloses a preexisting HTML component.

Question19: What is the Document Object Model, or DOM?

The process by which a browser transforms HTML into a tree data structure is called Document Object Model, or DOM. HTML’s runtime structure in a browser.

20 What does HTML table structure mean? Q20.

Q21: What is the <iframe> tag?

<iframe> tag in HTML is used to embed another HTML document.

<iframe href=“(reference of the HTML document)” width=“” height=“”></iframe>

Q22: What is CSS?

Cascading Style Sheet is what CSS stands for. The styling of an HTML element is accomplished by using CSS, which keeps style code and HTML code apart. Three approaches to using CS
1. Inline style is similar to styling at the element level. Overuse of code

Syntax:

                <style>
                                selector : {
                                                prop: value;
                                                prop: value
                                }
                </style>

3. External Style

23: What’s Inline Styling?

All of the elements defined in the tag are styled at the element level or tag level using inline styling. Therefore, it is not possible to apply style to every element if there are several. Then, we employ Internal Style.

Q25 Can you explain responsive web design?

Web design that automatically adjusts to the size of the screen to offer a constant user experience. Without a scroll bar at the page level, the screen adapts itself based on available space on the device.

26 What is the CSS box model, Q26?

The way an element appears on an HTML page with a border and the actual element is called the CSS box model. Padding (property) is the space between the element and the border; margin (pro) is the space between two distinct element boxes.


Q27: In CSS, what is a pseudo class?

Pseudo classes are essentially unique IDs that allow CSS to be applied to items in response to specific user actions or events on the user interface.

choice: pseudo-class� �—CODE

** w3cshools.com has a list of available pseudo classes, such as FOCUS, HOVER, etc.

Question 28: What exactly is JavaScript?

It’s a programming language that the browser can understand. It differs greatly from Java in terms of philosophy, design, and goal.

Case matters in JavaScript
The naming convention that must be used when declaring “functions” and “variables” in JavaScript
The first word should begin with a small letter, followed by a camel cap or the initial letter of the following word in capital letters, for example, Hello World -> helloWorld.

Each and every JS statement should conclude with a semicolon (;)
centered around objects.

Q29: What kinds of JavaScript (JS) are there?

Two varieties of JS exist:

clientele JS: JavaScript code that executes entirely client-side, within a browser. to create online apps that are responsive, such as Angular JS and UIC5.
server-side JS: Server-side JS code is executed. such as Node.JS and XSJS. Server-side programming includes functions like emailing, DB searches, data manipulation, and system status updates.

Q30: What is JavaScript’s (JS) purpose?

Yes. The following uses exist for Java Script:

Verify the information.
Carry out the client’s calculations: Write if, looping, arithmetic, and logical operations in imperative logic.
Examine the circumstances and functioning of the
Speak with the call server
Change the DOM (html)
Runtime CSS changes

Q31. Steps/Techniques to apply JavaScript in the code?

3 ways we can apply JS in the code:

  1. Inline JS – code is written at element level
  2. Internal JS – code is written at page level inside <script></script> tag.
  3. External JS – reference an external file (.js) into your html page,                                           

<script src=“(path of JS file)”></script>

Q32: What are the various JavaScript output functions?

alert(): Show the user Console a popup.log: Print the results to the console document.Write content to take the place of the entire HTML page.innerText: Modify an HTML element Q33’s text. Which pre-defined objects are available in JavaScript?

Two categories of entities:

The term “document” refers to the object of your Document Object Model (DOM), which is the runtime structure of an HTML page. The document object offers numerous methods to access the object of an HTML element or elements, which are represented by reusable methods or classes called APIs, or Application Programming Interfaces.

The single element can be found using document.getElementById (the id of an HTML element is unique).
This is the browser window’s object: document.getElementsByClassName returns a list of all elements by class name; document.getElementsByTagname returns a list of all elements with that tag.

Q34: What is the syntax in JavaScript for creating variables?

Question 35: What is Java Script Object Notation, or JSON?

If an array has to define more than one record, more objects must be added to the array. Java Script Object Notation, or JSON, is the idea behind fusing arrays and objects together.

var myItab = [{“prop”: val, “prop”: val}, {“prop”: val, “prop”: val}, {“prop”: val, “prop”: val}, {“prop”: val, “prop”: val}, {“prop”: val, “prop”: val}, {“prop”: val, “prop”: val}, {“prop”: val, “prop”: val}, {“prop”: val, “prop”: val}]



Q36: What kinds of JavaScript functions are there?

Two categories of JS functions

1. Anonymous functions (nameless functions)

function(argument, argument) { ^                               

2. Named functions (functions that you have defined yourself)

function functionName(argument, argument){ �                                                                                                  �

Crucial: An argument can be supplied to a function.

var = function(){ ….

Q38: Describe jQuery.

A language is not jQuery. It is a short and efficient JavaScript package that helps you avoid writing lengthy JS code. The idea behind it is “write less, do more.”

The most often used lines of code and methods can be included into application code using jQuery, enabling developers to rapidly accomplish their goals with little to no coding.

This library can be used in two ways:

Get the jQuery plugin, add it to your project, and use it locally.
Internet source cited as CDN (Content Delivery Network)
jQuery Library loading is required. ->

The syntax for using a jQuery library, which is an external JS file, is as follows:

Q39. How to Use jQuery Syntax

the action() of $(selector);

$ – instruct the browser that we’ll be using jQuery
Selector: #id, #className, tagname
Action: method, name of the event, on, css(‘prop’,’val’)
$(selector).action(callBackFunction(), parameters);

What is the Document Object Model, or DOM?

The process by which a browser transforms HTML into a tree data structure is called Document Object Model, or DOM. HTML’s runtime structure in a browser.

To access the internet developer toolbar and developer tool, press F12.

What’s Inline Styling?

All of the elements defined in the tag are styled at the element level or tag level using inline styling. Therefore, it is not possible to apply style to every element if there are several. Then, we employ Internal Style.

Could you explain internal styling?

A selector can be used to apply internal styling to a set of items at once.

One of the two ways to utilize a selector is as a unique identification of an element or elements.

#id: using a specific element’s style

.className: This class name categorizes items or groups of elements; to use it, insert the element inside a

tag.

For instance,

“your element”

tagName: each element that hast level. But wrap the element around a tag with a div tag and use class name.

Can you explain responsive web design?

Web design that automatically adjusts to the size of the screen to offer a constant user experience. Without a scroll bar at the page level, the screen adapts itself based on available space on the device.

What is the CSS box model, Q26?

The way an element appears on an HTML page with a border and the actual element is called the CSS box model. Padding (property) is the space between an element and its border; margin (property) is the space between two distinct element boxes.

In CSS, what is a pseudo class?

Pseudo classes are essentially unique IDs that allow CSS to be applied to items in response to specific user actions or events on the user interface.

choice: pseudo-class{ —CODE** list of accessible pseudo

Q30. What is the purpose of JavaScript(JS)?

Ans. JAVA Script is used for following purposes:

  1. Validate the input
  2. Perform calculations on client side: Write imperative logic – if, looping, arithmetic and logical operations
  3. Check conditions and operations
  4. Call server
  5. Manipulate DOM (html)
  6. Change CSS at runtime

(“id of control”);

2. Using View object when we use MVC architecture (XML Views)

                this.getView().byId(“id of control”);
                this keyword represents the object of current control.

In UI5, how can I construct a control?

How to write a control in syntax:

oControlName in var o = new .sId, sProperties as ControlName;

Keep in mind that the control name is usually capitalized at the beginning. A case of pure camels.

sId: The control’s distinct ID.

sProperties: the UI element’s characteristics or attributes. Every property needs to adhere to the syntax below.

{ propname: “prop val”, propname: “prop val” }

How does a SAP UI5 control define its control hierarchy?

Things to keep in mind when using the SAP UI5 hierarchy

The “extends” keyword in JavaScript is used to denote inheritance.

If a specific class’s property or event is not visible, try looking through its parent class.

How Can I Get Change/Display Functionality and Embed a Fragment Straight into the View?

Define Fragments

Create Fragment XML


What are different methods in a Controller?

The Methods Forming part of a Controller are known as HOOK Methods

onInit() – this method gets called when the object of the controller is instantiated
onExit()-
onAfterRendering()
onBeforeRendering()

What is the purpose of index.html?

index.html is used to: 1. Create object of the view & 2. Add it to the DOM

Procedures for the SAP UI5 framework’s implementation and execution

First, use getControllerName to obtain the controller name.
Step 2: Constructs the Controller’s object
Step 3: Send the Controller’s object to the content (createContent)

Q55: How can I tell the app where your view and controller are located in the root folder?

It is defined by adding the path to the data-sap-ui-resourceroots within the initialization section of the index.html header’s

data-sap-ui-resourceroots=‘{ “rootnamespace” : “./” }’

Naming view & controller

Q57: How can I verify a JSON?

jsonlint.com

In JavaScript, how can I declare distinct views?

core.mvc.sap.ui.ViewType.JS
ViewType.XML sap.ui.core.mvc
JSON-based sap.ui.core.mvc.ViewType
HTML, sap.ui.core.mvc.ViewType

How can I construct a path that connects view elements to JSON data?

For instance, the JSON data below:

{                 “empStr”: {                                 “empNo”: 100,                                 “empName”: “SAPYard”,                                 “salary”: 900,                                 “curr”: “EUR”                 },                 “empTab”: [{“empNo”: 200}, {“empNo”: 300}, {“empNo”: 400}] }

Ede in the future!

In SAP UI5, what does a TABSTRIP control mean?

ICON TAB BAR is used in UI5 to construct a TABSTRIP UI.

The following is how an ICONTAB FILTER is often implemented:

In SAP UI5, what does a TABSTRIP control mean?

In UI5, a TABSTRIP UI is implemented using ICON TAB BAR

A typical ICONTAB FILTER can be implemented as follows:

Use SAP UI5 to implement TABLE CONTROL

A table is a multi-column list control. It is a part of the sap.m library, and you can see that it “extends” the sap.m.ListBase Class in the SDK when you check sap.m.Table. And it has aggregation as “columns” to enable multi-column user interface.

Q102: Which Control endows a Text Control with properties like colors and icons?

Additionally, develop a formatter function in order to attain the “intuitiveness” in the table column:

CREATE

Similarly,

What does SAPUI5’s Fragments mean?

Reusable UI components called fragments are used to modularize user interfaces in UI5 applications. We are dividing up the UI into fragments utilizing the fragments, much like we do with custom controllers in UI5. These parts can be combined or utilized again by different controllers or views. Therefore, the matching controller of the view in which the fragment is declared defines the logic for Fragment Control components. (To hear an explanation with more examples, watch the video.)

How Can a View’s Fragment Be Declared?

Step 1: To call the pop-up fragment, provide an input field for the F4 help. applying the “valueHelpRequest” method

Thus, while integrating sap.m.Dialog into your fragment, make sure to verify the SDK: the

How can a “Page” add a footer?

create

Additionally, when the “Approve” button is clicked, a pop-up message is displayed via the message-box API.

REMEMBER!! Always realize to specify a global variable for the object in order to preserve I/O on the pop-up fragment. This will ensure that the pop-up’s properties are maintained even if user action is taken on it.

.. What is the meaning of a custom control and what does it accomplish?

*** UI Controls / Elements are reusable UI5 components that can be used to customize the UI in many ways.

To accomplish a feature that isn’t included in Standard, you can create your own reusable control by designing it in a different file that serves as a library.

sap.ui.core.Control is the Super Class for all of the controls.

It is employed to create or specify a custom control

In JS, a keyword that denotes inheritance is extends

you may be interested in this blog here:-

Just a key and two clicks for ALV consistency check

Making Your First Salesforce Appexchange: A Complete Strategy

The post 130 SAPUI5, SAP Fiori, HTML, CSS, JavaScript & jQuery, Interview Questions & Answers first appeared on TECHNICAL GYAN GURU.

]]>
https://technicalgyanguru.com/130-sapui5-sap-fiori-html-css-javascript-jquery-interview-questions-answers/feed/ 0 4860
SAPUI5 for ABAPers: Accessing OData Services from SAPUI5 Applications – CRUD Operations https://technicalgyanguru.com/sapui5-for-abapers-accessing-odata-services-from-sapui5-applications-crud-operations/?utm_source=rss&utm_medium=rss&utm_campaign=sapui5-for-abapers-accessing-odata-services-from-sapui5-applications-crud-operations https://technicalgyanguru.com/sapui5-for-abapers-accessing-odata-services-from-sapui5-applications-crud-operations/#respond Tue, 03 Sep 2024 06:07:00 +0000 https://technicalgyanguru.com/?p=5077 The ultimate fate of an OData service is to be consumed by front-end apps. SAPUI5 applications follow the Model View Controller (MVC) architecture. In MVC, View and Controller are the…

The post SAPUI5 for ABAPers: Accessing OData Services from SAPUI5 Applications – CRUD Operations first appeared on TECHNICAL GYAN GURU.

]]>
How to Consume OData Service

The ultimate fate of an OData service is to be consumed by front-end apps. SAPUI5 applications follow the Model View Controller (MVC) architecture. In MVC, View and Controller are the UI5 application’s Views (XML, HTML, JavaScript, and JSON Views) and Controllers (JavaScript Controllers). In the UI5 application, models can be OData, JSON, Resource, or XML.

This tutorial introduces the OData concept and guides you through creating a front-end application that uses it to execute CRUD operations.

You can use the OData Model to consume the OData Service. To accomplish this, establish an OData Service and implement its establish, READ, UPDATE, and DELETE functions. To use these techniques, build an OData Model Instance in the UI5 app and use the read(), create(), update(), and delete() operations from the OData model.

Let’s start…

The customer needs to display records from a custom table on a UI5 application and give end-users with read, create, update, and delete options.

Step 1: Prepare a Custom Table for us to play.

CRUD operation in SAPUI5

Creating a custom table called ‘zuserdata’ with id, name, email, and mobile fields.

Step 2: Creating an OData Service

Go to transaction SEGW and create a new OData Service named zcrud_demo.

If you’re new to OData Service, we recommend starting with the tutorial where we developed our first service.

  • Consider taking the free video course on OData Service and Netweaver Gateway.
  • Create the entity ‘userdata’ and the related entityset ‘userdataSet’.
  • Create four attributes for the ‘userdata’ entity: id, name, email, and mobile.
  • Ensure that the Properties datatype and length match those of the fields defined in the table in step 1.

Activate the OData service to generate its runtime.

How to REDEFINE the DPC Class methods

7 Write your logic (code) in each redefined method. (Redefinition code is given in the below section of the instruction)

8 Navigate to t-code /n/iwfnd/maint_service to add the service.

/n/iwfnd/maint_service
/n/iwfnd/maint_service

Configure ICF settings for the created OData service to enable Create operations using the OData model. Go to SICF transaction, open the OData service’s ICF node, and double-click on it. Click on the GUI Configuration button.

SICF in OData

Set the CHECK_CSRF_TOKEN value to zero. This will bypass the service’s CSRF protection. This is essential for the CREATE, UPDATE, and DELETE operations to function. To avoid security risks, use the READ operation to retrieve the X-CSRF-TOKEN before performing CREATE, UPDATE, or DELETE operations in the UI5 app. To keep things simple in this lesson, we’ve turned off the X-CSRF-TOKEN security feature.

OData ABAP code for the CREATE_ENTITY method.

method USERDATASET_CREATE_ENTITY.
    data : wa_userdata type zcl_zcrud_demo_mpc=>ts_userdata.
*    read data recieved from ui5
    io_data_provider->read_entry_data(
    IMPORTING
      es_data  = wa_userdata
    ).
    MODIFY zuserdata from wa_userdata.
    if sy-subrc eq 0.
      move 'success' to er_entity-name.
      else.
        move 'error' to er_entity-name.
        endif.
  endmethod.

Method name: USERDATASET_GET_ENTITY. Data: wa_userdata; type

Method: USERDATASET_GET_ENTITY. Data: wa_userdata, type ZCL_ZCRUD_DEMO_MPC=>TS_USERDATA.
SELECT A SINGLE * FROM zuserdata INTO THE CORRESPONDING FIELDS OF wa_userdata.
Move wa_userdata to er_entity. End procedure.

OData ABAP code for retrieving many records via the GET_ENTITYSET function.

Method name: USERDATASET_GET_ENTITYSET. Data: it_userdata TYPE ZCL_ZCRUD_DEMO_MPC->TT_USERDATA. Select * from zuserdata and add it to table et_entityset. Endmethod.

OData ABAP code for Update (update_entity method)

Method: USERDATASET_UPDATE_ENTITY.
data: wa_userdata type zcl_zcrud_demo_mpc->ts_userdata.

  • Read data received from UI5: io_data_provider->read_entry_data( IMPORTING es_data = wa_userdata).
  • Move’success’ to er_entity.
    UPDATE Zuserdata set email = wa_userdata-email, id = wa_userdata-id. endmethod.

OData ABAP code for the DELETE_ENTITY method.

Method: USERDATASET_DELETE_ENTITY. Data: wa_keytab, LIKE LINE OF it_keytab.
READ TABLE it_key_tab INTO wa_keytab, KEY name = 'id'.
If sy-subrc equals 0.
DELETE from zuserdata when id = wa_keytab-value. ENDIF. Endmethod.

Step 3: Create the SAPUI5 application.

Create a SAPUI5 application that consumes the OData service developed in Step 2 and calls the OData model’s CREATE, READ, UPDATE, and REMOVE methods.

Also see: An ABAPer’s First SAPUI5 App in SAP WebIDE.

  1. Create a new SAPUI5 application with the name crud_demo.
  2. Create an XML view named ‘crud_demo.view’. Write the following code in it.
  3. <core:View xmlns:core=”sap.ui.core” xmlns:mvc=”sap.ui.core.mvc” xmlns=”sap.m” controllerName=”crud_demo.crud_demo” xmlns:html=”http://www.w3.org/1999/xhtml” xmlns:l=”sap.ui.commons.layout”> <Page title=”CRUD Operations”> <content> <l:AbsoluteLayout width=”10rem” height=”10rem”></l:AbsoluteLayout> <VBox xmlns=”sap.m” id=”vboxid”> <items> <HBox xmlns=”sap.m”> <items> <l:AbsoluteLayout width=”20px” height=”20px”></l:AbsoluteLayout> <Button xmlns=”sap.m” id=”cbtn” press=”oDataCall” text=”Create”></Button> <l:AbsoluteLayout width=”20px” height=”20px”></l:AbsoluteLayout> <Button xmlns=”sap.m” id=”rbtn” press=”oDataCall” text=”Read”></Button> <l:AbsoluteLayout width=”20px” height=”20px”></l:AbsoluteLayout> <Button xmlns=”sap.m” id=”ubtn” press=”oDataCall” text=”Update”></Button> <l:AbsoluteLayout width=”20px” height=”20px”></l:AbsoluteLayout> <Button xmlns=”sap.m” id=”dbtn” press=”oDataCall” text=”Delete”></Button> </items> </HBox> <HBox xmlns=”sap.m”> <items> <l:AbsoluteLayout width=”20px” height=”20px”></l:AbsoluteLayout> <Input xmlns=”sap.m” id=”uniqueid” placeholder=”ID” value=”1″></Input> <l:AbsoluteLayout width=”20px” height=”20px”></l:AbsoluteLayout> <Input xmlns=”sap.m” id=”nameid” placeholder=”Name” value=”test”></Input> <l:AbsoluteLayout width=”20px” height=”20px”></l:AbsoluteLayout> <Input xmlns=”sap.m” id=”emailid” placeholder=”Email” value=”test@gmail.com”></Input> <l:AbsoluteLayout width=”20px” height=”20px”></l:AbsoluteLayout> <Input xmlns=”sap.m” id=”mobid” placeholder=”Mobile” value=”8888888888″></Input> </items> </HBox> <HBox xmlns=”sap.m”> <items> <l:AbsoluteLayout width=”20px” height=”20px”></l:AbsoluteLayout> <Table xmlns=”sap.m” id=”userdatatable” headerText=”User Data”> <items> <ListItemBase xmlns=”sap.m” id=”id1″></ListItemBase> </items> <columns> <!– sap.m.Column –> <Column xmlns=”sap.m”> <header> <Text xmlns=”sap.m” text=”Id” ></Text></header></Column> <Column xmlns=”sap.m”> <header> <Text xmlns=”sap.m” text=”Name” ></Text></header></Column> <Column xmlns=”sap.m”> <header> <Text xmlns=”sap.m” text=”Email” ></Text></header></Column> <Column xmlns=”sap.m”> <header> <Text xmlns=”sap.m” text=”Mobile” ></Text></header></Column> </columns> </Table> </items> </HBox> </items> <!– sap.ui.core.Control –> </VBox> </content> </Page> </core:View>3. Create crud_demo.controller.js. Write below code in it.onInit: function() { that = this; // Create Model Instance of the oData service var oModel = new sap.ui.model.odata.v2.ODataModel(“/sap/opu/odata/sap/ZCRUD_DEMO_SRV”); sap.ui.getCore().setModel(oModel, “myModel”); },
oDataCall:function(oEvent)
 	{
		// call oData service's function based on which button is clicked.
		debugger;
		var myModel = sap.ui.getCore().getModel("myModel");
		myModel.setHeaders({
			"X-Requested-With" : "X"
		});
		// CREATE******************
		if ('Create' == oEvent.oSource.mProperties.text) {
			var obj = {};
			obj.id = that.getView().byId("uniqueid").getValue();
			obj.name = that.getView().byId("nameid").getValue();
			obj.email = that.getView().byId("emailid").getValue();
			obj.mobile = that.getView().byId("mobid").getValue();
			myModel.create('/userdataSet', obj, {
				success : function(oData, oResponse) {
					debugger;
					alert('Record Created Successfully...');
				},
				error : function(err, oResponse) {
					debugger;
					alert('Error while creating record - '
							.concat(err.response.statusText));
				}
			});
		}
		// READ******************
		else if ('Read' == oEvent.oSource.mProperties.text) {
			var readurl = "/userdataSet?$filter=(id eq '')";
			myModel.read(readurl, {
				success : function(oData, oResponse) {
					debugger;
					var userdata = new sap.ui.model.json.JSONModel({
						"Result" : oData.results
					});
					var tab = that.getView().byId("userdatatable");
					tab.setModel(userdata);
					var i = 0;
					tab.bindAggregation("items", {
						path : "/Result",
						template : new sap.m.ColumnListItem({
							cells : [ new sap.ui.commons.TextView({
								text : "{id}",
								design : "H5",
								semanticColor : "Default"
							}), new sap.ui.commons.TextView({
								text : "{name}",
								design : "H5",
								semanticColor : "Positive"
							}), new sap.ui.commons.TextView({
								text : "{email}",
								design : "H5",
								semanticColor : "Positive"
							}), new sap.ui.commons.TextView({
								text : "{mobile}",
								design : "H5",
								semanticColor : "Positive"
							}), ]
						})
					});
				},
				error : function(err) {
					debugger;
				}
			});
		}		
		// UPDATE******************
		if ('Update' == oEvent.oSource.mProperties.text) {
			var obj = {};
			obj.id = that.getView().byId("uniqueid").getValue();
			obj.email = that.getView().byId("emailid").getValue();
			var updateurl = "/userdataSet(id='"
					+ that.getView().byId("uniqueid").getValue() + "')";

			myModel.update(updateurl, obj, {
				success : function(oData, oResponse) {
					debugger;
					alert('Record Updated Successfully...');
				},
				error : function(err, oResponse) {
					debugger;
					alert('Error while updating record - '
							.concat(err.response.statusText));
				}
			});
		}		
		// DELETE******************
		if ('Delete' == oEvent.oSource.mProperties.text) {
			var delurl = "/userdataSet(id='"
					+ that.getView().byId("uniqueid").getValue() + "')";
			myModel.remove(delurl, {
				success : function(oData, oResponse) {
					debugger;
					alert('Record Removed Successfully...');
				},
				error : function(err, oResponse) {
					debugger;
					alert('Error while removing record - '
							.concat(err.response.statusText));
				}
			});
		}
	}

Conserve, set up, and start the app. You should be able to execute the application using the following URL.

http://hostname:8000/sap/bc/ui5_ui5/sap/zcrud_demo/index.html

Output

CRUD Operation of ABAPers

You must be able to build the aforementioned simple application. All of the buttons should operate correctly. If you have any problems, please leave your queries in the comments area below. You may also email us at: career@technicalgyanguru.com.

you may be interested in this blog here :-

How to find BAdIs ?

Oracle database structure diagram

Boosting Customer Service with Salesforce and SharePoint Integration

The post SAPUI5 for ABAPers: Accessing OData Services from SAPUI5 Applications – CRUD Operations first appeared on TECHNICAL GYAN GURU.

]]>
https://technicalgyanguru.com/sapui5-for-abapers-accessing-odata-services-from-sapui5-applications-crud-operations/feed/ 0 5077
Mastering Modern SAPUI5 Development with SAP Build Code 2024  https://technicalgyanguru.com/mastering-modern-sapui5-development-with-sap-build-code-2024/?utm_source=rss&utm_medium=rss&utm_campaign=mastering-modern-sapui5-development-with-sap-build-code-2024 https://technicalgyanguru.com/mastering-modern-sapui5-development-with-sap-build-code-2024/#respond Fri, 15 Mar 2024 11:01:24 +0000 https://www.technicalgyanguru.com/?p=2800  Unleash the power of SAP Build Code for streamlined SAPUI5 development in 2024! This guide unveils everything you need to know… Frustrated by Lagging SAPUI5 Development? Unleash the Power of…

The post Mastering Modern SAPUI5 Development with SAP Build Code 2024  first appeared on TECHNICAL GYAN GURU.

]]>
 Unleash the power of SAP Build Code for streamlined SAPUI5 development in 2024! This guide unveils everything you need to know…

Frustrated by Lagging SAPUI5 Development? Unleash the Power of SAP Build Code in 2024!

Picture this: you’re tasked with building a stunning SAP Fiori application, but traditional SAPUI5 development feels like wading through molasses. Deadlines loom, coding complexities multiply, and frustration mounts. But what if there was a better way? Enter SAP Build Code, a revolutionary low-code/no-code development platform within SAP Business Application Studio (BAS) that’s transforming the landscape of SAPUI5 development in 2024! SAPUI5, the go-to JavaScript framework for SAP Fiori UIs, empowers you to craft user-friendly interfaces for your business applications. However, traditional development approaches can be time-consuming and require extensive coding expertise. This is where SAP Build Code swoops in as your hero, offering a streamlined approach that gets you up and running faster than ever before. With intuitive visual tools, drag-and-drop functionalities, and a focus on collaboration, SAP Build Code empowers both experienced developers and citizen developers to build feature-rich SAPUI5 applications with unprecedented efficiency. So, ditch the development delays and embrace the future! This comprehensive guide will equip you with everything you need to know to master modern SAPUI5 development with SAP Build Code in 2024. We’ll delve into getting started, explore powerful features for building robust applications, and even touch upon deployment and testing strategies. Buckle up and get ready to experience a whole new level of efficiency in your SAPUI5 development journey!

Getting Started with SAP Build Code for SAPUI5 Development: Your Fast Track to Success

Now that you’re eager to leverage the power of SAP Build Code for SAPUI5 development, let’s dive into the practical steps to get you started. Before embarking on this exciting journey, ensure you have two key prerequisites:

  • Access to an SAP Business Application Studio (BAS) Environment: SAP Build Code resides within the SAP BAS platform. If you don’t already have access, you’ll need to obtain the necessary permissions from your system administrator.
  • Basic Understanding of SAP Fiori Concepts: Familiarity with SAP Fiori design principles and functionalities will be beneficial when building user interfaces (UIs) for your SAPUI5 applications within SAP Build Code.
  • Creating a New SAPUI5 Application in SAP Build Code: The first step involves creating a new project within SAP Build Code specifically for your SAPUI5 application. This process is remarkably user-friendly. You’ll be guided through defining project details, configuring settings, and establishing the initial structure of your application. SAP Build Code provides pre-built templates to jumpstart your development, allowing you to select the most suitable template based on the type of SAPUI5 application you’re building (e.g., list report, object view). This streamlines the initial setup and ensures your project adheres to best practices.
  • Building the User Interface with Visual Tools: One of the biggest strengths of SAP Build Code for SAPUI5 development lies in its intuitive visual tools. Gone are the days of hand-coding every aspect of your UI. SAP Build Code offers a drag-and-drop interface where you can effortlessly assemble your application’s UI by selecting pre-built UI components from a comprehensive library. These components are pre-configured to align with SAP Fiori design guidelines, ensuring a consistent and user-friendly experience within your application. Additionally, SAP Build Code allows you to customize the properties and behavior of these components to perfectly match your specific requirements. This visual approach empowers both technical and non-technical users to actively participate in the UI design process, fostering greater collaboration within your development team.

Leveraging Powerful Features for Advanced SAPUI5 Development with SAP Build Code

While SAP Build Code excels in streamlining UI development with its visual tools, it doesn’t shy away from empowering you to build robust and feature-rich SAPUI5 applications. This section dives into some of the advanced functionalities that cater to more complex development needs.

  • Data Binding and Model Integration: The heart of any interactive application lies in its ability to connect with back-end data sources. SAP Build Code offers seamless data binding capabilities for your SAPUI5 applications. You can define data models within SAP Build Code, specifying the data structure and how it interacts with your UI components. This simplifies the process of fetching, displaying, and manipulating data within your application. Furthermore, SAP Build Code integrates effortlessly with various back-end data sources commonly used in SAP environments, including SAP S/4HANA and SAP Cloud Platform (SCP). This pre-built integration eliminates the need for complex coding tasks and ensures seamless data flow between your SAPUI5 application and the underlying data layer.
  • Event Handling and User Interaction: A dynamic user experience hinges on effectively handling user interactions and events within your application. SAP Build Code equips you with the tools to define event handlers for various user actions like button clicks, selection changes, and form submissions. When a user interacts with a UI element, the corresponding event handler is triggered, allowing you to execute specific logic within your application. For instance, clicking a button might trigger an event handler that retrieves data from a back-end system and populates a table within your UI. SAP Build Code’s visual interface allows you to configure event handlers and define the logic to be executed using a user-friendly approach. However, for more intricate logic, you can leverage the ability to directly edit code within SAP Build Code, integrating JavaScript code snippets to achieve advanced functionalities and event handling scenarios.

Deployment And Testing

  • Deployment Options: Beyond pre-defined development, testing, and production environments, SAP Build Code allows you to configure custom deployment targets. This caters to scenarios where you might require additional staging environments for user acceptance testing (UAT) or integration testing.
  • Security Considerations: While deploying your SAPUI5 application, SAP Build Code offers functionalities to integrate with SAP security mechanisms like user authentication and authorization. This ensures that only authorized users can access your application within the designated environments.
  • Testing Strategies: In addition to the built-in testing tools, explore integrating SAP Build Code with continuous integration/continuous delivery (CI/CD) pipelines. This automates the testing process and streamlines the deployment workflow, ensuring a more robust and efficient development lifecycle.

Conclusion

Unleash the Power of Modern SAPUI5 Development with SAP Build Code

The days of grappling with complex SAPUI5 development are over! This comprehensive guide has equipped you with the knowledge and tools to leverage the transformative power of SAP Build Code in 2024. We’ve explored how to get started, navigate the intuitive visual development tools, and leverage powerful features for building feature-rich applications (Sections I & II & III). You’ve discovered how SAP Build Code streamlines deployment across various environments and equips you with robust testing functionalities to ensure a flawless launch (Section IV). We’ve even ventured beyond the basics, delving into extending functionalities with custom code and collaborating effectively through version control (Section V).

Remember, SAP Build Code isn’t just about faster development – it’s about empowering a wider range of users to participate in the creation of exceptional SAPUI5 applications. With its intuitive interface and drag-and- drop functionalities, citizen developers and experienced developers alike can work together seamlessly (Section II). So, take action today! Explore the resources provided and delve deeper into the exciting world of SAP Build Code (Section V). Sign up for a trial version and experience firsthand how SAP Build Code can revolutionize your SAPUI5 development journey. Embrace the future of low-code/no-code development and unlock the true potential of SAPUI5 for your business applications!

As a final word of advice, remember that SAP Build Code is a powerful tool, but its true potential lies in understanding its functionalities and how they align with your specific development needs. Don’t hesitate to experiment, explore the resources, and continuously learn to become a master of SAPUI5 development with SAP Build Code!

you may be interested in this blog here

Future of GOS

Salesforce Roadmap to Success: Mapping Out Your Training Journey

Empowering Your ABAP ALV with Integrated Data Access (IDA) on HANA:…

The post Mastering Modern SAPUI5 Development with SAP Build Code 2024  first appeared on TECHNICAL GYAN GURU.

]]>
https://technicalgyanguru.com/mastering-modern-sapui5-development-with-sap-build-code-2024/feed/ 0 2800