Blog

  • How to Upport and Down Port in SAP using TCode UDO

    Transporting changes between systems is crucial for maintaining consistency across your SAP landscape. Below are the steps to perform this operation:

    How to Upport and Down Port in SAP using TCode UDO

    1. Initiate the Process in the Source System:
    – Go to the system from which you want to port changes to other systems. [or you can also do from the target system where you are actually porting] – Open the SAP GUI and access the `UDO` transaction.
    – You will need the following parameters:
    – Source System Transport Request (TR)
    – Source System Name
    – Target System Name

    2. Execute in the Target System:
    – Log into the target system where you want the changes to be imported.
    – Open TCode `UDO`.
    – Input the following details:
    – Transport Request (TR) from the source system.
    – Source System Name accompanied by the client number.
    – Target System Name.

    3. Allocate a New Transport Request (TR):
    – Once the above details are provided, the system may prompt you to assign a new TR for this transport. This is to ensure that the changes are tracked and can be rolled back if needed.
    – Input or create a new TR as instructed.

    4. Confirm and Execute:
    – After all details are in place, review and confirm.
    – Execute the transport. The system will begin the process of porting the changes from the source to the target system.

    5. Monitor & Verify:
    – Upon completion, ensure that the transport has been successful.
    – Verify in the target system to ensure all ported changes are reflecting correctly.

  • Download excel in SAP UI5 using XLSX JS

    Introduction

    Discover the seamless integration of ‘Download Excel in SAP UI5 using XLSX JS.’ Dive into this comprehensive guide that unveils the step-by-step process to harness the power of XLSX JS, optimizing SAP UI5 applications. Ideal for developers and SAP enthusiasts, this tutorial not only simplifies data exportation into Excel format but also boosts the functionality of your UI5 projects. Stay ahead in the evolving landscape of SAP and enhance your skills with this essential technique.

    What is XLSX/Sheet.js?

    XLSX.js is a JavaScript library that facilitates reading and writing various spreadsheet file formats, including XLSX, which is the format used by modern versions of Microsoft Excel. In essence, it allows developers to handle Excel files (both reading and creating them) directly in JavaScript, making it easier to integrate spreadsheet functionalities in web applications.

    For instance, in the context of SAP UI5 or other web frameworks, XLSX.js can be used to provide users with the ability to download data from the application in Excel format or upload Excel files for processing in the application, all without requiring server-side processing or additional software installations.

    How to Download excel in SAP UI5 using XLSX JS?

    index.html

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>My Project Ideas</title>
            <link rel="icon" type="image/x-icon" href="https://myprojectideas.com/wp-content/uploads/2021/08/cropped-Screenshot-2021-07-26-at-1.39.04-PM.png"/>
            <script id="sap-ui-bootstrap"
                src="resources/sap-ui-core.js"
                data-sap-ui-theme="sap_fiori_3"
                data-sap-ui-resourceroots='{"excelProject.excelProject": "./"}'
                data-sap-ui-compatVersion="edge"
                data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"
                data-sap-ui-async="true"
                data-sap-ui-frameOptions="trusted">
            </script>
            <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js"></script>
        </head>
        <body class="sapUiBody">
            <div data-sap-ui-component data-name="excelProject.excelProject" data-id="container" data-settings='{"id" : "excelProject"}'></div>
        </body>
    </html>

     

    View.XML

    <mvc:View controllerName="excelProject.excelProject.controller.Main" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m">
        <Shell id="shell">
            <App id="app">
                <pages>
                    <Page id="page" title="My Project Ideas: Download Table in Excel">
                        <content>
                        <Button text="Export to Excel" press="onExportToExcel"/>
            <Table id="idProducts">
            <columns>
                <Column
                    width="12em">
                    <Text text="Name" />
                </Column>
                <Column
                    minScreenWidth="Tablet"
                    demandPopin="true">
                    <Text text="City" />
                </Column>
            </columns>
            <items>
                <ColumnListItem vAlign="Middle">
                    <cells>
                        <Text	text="Rudra" />
                        <Text	text="Mughalsarai" />
                    </cells>
                </ColumnListItem>
                <ColumnListItem vAlign="Middle">
                    <cells>
                        <Text	text="Deepak" />
                        <Text	text="Kolkata" />
                    </cells>
                </ColumnListItem>
            </items>
                </Table>
                        </content>
                    </Page>
                </pages>
            </App>
        </Shell>
    </mvc:View>

     

    Controller.Js

    sap.ui.define([
        "sap/ui/core/mvc/Controller"
    ], function (Controller) {
        "use strict";
    
        return Controller.extend("excelProject.excelProject.controller.Main", {
            onInit: function () {
    
            },
    
            onExportToExcel: function () {
                // Get the JSON data
                var rows = [];
            var selection = this.getView().byId('idProducts').getSelectedItems();
            selection.forEach(val => {
            var data = val.getBindingContext().getObject();
            rows.push(data);
            });
    
                // Convert JSON to Excel workbook
                var workbook = XLSX.utils.book_new();
                var worksheet = XLSX.utils.json_to_sheet(rows);
                XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1");
    
                // Save the workbook as an Excel file
                XLSX.writeFile(workbook, "data.xlsx");
            }
    
        });
    });

     

    Output

    Download excel in SAP UI5 using XLSX JS

  • Planning Calendar in SAP UI5

    Introduction

    The SAP UI5 Planning Calendar is a powerful, feature-rich tool that aids in visualizing, scheduling, and managing appointments or tasks efficiently. Designed to be user-friendly and intuitive, the Planning Calendar offers an overview of appointments or tasks over various views, including hours, days, 1 week, 1 month, or even a custom-defined timeline.

    Key features of the Planning Calendar include the ability to display appointments over different intervals, support for both single and multiple row layouts, various appointment types, and built-in controls for navigating between different intervals. It is designed with flexibility in mind and can be adapted to handle a variety of use cases. Appointments can be selected, resized, or moved according to your needs, and the overall look and feel of the calendar can be customized as well.

    In addition to these, the Planning Calendar also offers built-in support for handling different time zones, special dates like holidays or non-working days, and it even supports screen readers for accessibility.

    Whether you’re developing an employee scheduling app, a project management tool, a room booking system, or any other application where time-bound events need to be visualized and managed, the SAP UI5 Planning Calendar can be a great asset. It simplifies complex scheduling tasks, improves productivity, and delivers a superior user experience, aligning perfectly with SAP’s philosophy of helping the world run better.

    In the next sections, we will delve deeper into how to use and customize the SAP UI5 Planning Calendar, enriching it with our application-specific data and functionality.

    Why we need Planning Calendar in SAP UI5

    In any organization or business application, managing time and events efficiently is crucial to achieving goals and maintaining order. This is where the SAP UI5 Planning Calendar comes into play. Here are a few reasons why it’s needed:

    1. Ease of use: With its user-friendly interface, the SAP UI5 Planning Calendar simplifies the task of creating, viewing, and managing appointments. It provides an intuitive visualization of events, which allows users to grasp their schedules quickly.

    2. Flexibility: The SAP UI5 Planning Calendar is flexible and can be adapted to a variety of use cases. Whether it’s managing employee schedules, tracking project timelines, or scheduling room bookings, the Planning Calendar can be customized to fit your needs.

    3. Rich Feature Set: The SAP UI5 Planning Calendar comes packed with features such as support for different intervals (hours, days, 1 week, 1 month), different appointment types, and multiple row layouts. This allows the calendar to cater to a wide range of scheduling requirements.

    4. Efficiency: It improves efficiency by reducing the time and effort needed to schedule and reschedule appointments or tasks. Users can easily select, resize, or move appointments according to their needs.

    5. Consistency: By using the Planning Calendar in SAP UI5, you maintain consistency with other SAP applications. This allows for a seamless user experience across all your business applications.

    6. Accessibility: The Planning Calendar in SAP UI5 is designed with accessibility in mind, with built-in support for screen readers. This ensures that the tool can be used by people with diverse abilities, adhering to inclusivity standards.

    7. Customization: The look and feel of the calendar can be tailored according to your needs, enabling you to maintain the branding and aesthetics of your application.

    8. Integration: It seamlessly integrates with other SAP UI5 controls and services, making it a robust choice for applications built on the SAP platform.

    In summary, the SAP UI5 Planning Calendar provides a robust, user-friendly, and efficient way to handle scheduling tasks in your applications.

    How to develop Planning Calendar in SAP UI5

    View

    <mvc:View controllerName="PlanningCalendar.PlanningCalendar.controller.Main" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m"
        xmlns:unified="sap.ui.unified">
        <Shell id="shell">
            <App id="app">
                <pages>
                    <Page id="page" title="My Project Ideas: Planning Calendar in SAP UI5">
                        <content>
                            <Button text="Block for Next Meeting" press="onPressBlock"/>
                            <PlanningCalendar id="planningCalendar" startDate="{path: '/startDate'}" rows="{path: '/rows'}" appointmentsVisualization="Filled"
                                appointmentSelect="handleAppointmentSelect" showEmptyIntervalHeaders="false" showWeekNumbers="true">
                                <rows>
                                    <PlanningCalendarRow startDate="{startDate}" appointments="{appointments}">
                                        <appointments>
                                            <unified:CalendarAppointment resizable="true" startDate="{startDate}" endDate="{endDate}" title="{title}" text="{text}" type="{type}"
                                                resize="handleAppointmentResize"/>
                                        </appointments>
                                    </PlanningCalendarRow>
                                </rows>
                            </PlanningCalendar>
                        </content>
                    </Page>
                </pages>
            </App>
        </Shell>
    </mvc:View>

     

    Controller

    sap.ui.define([
        "sap/ui/core/mvc/Controller",
        "sap/ui/model/json/JSONModel",
        'sap/m/MessageBox',
        'sap/ui/core/date/UI5Date'
    ], function (Controller, JSONModel, MessageBox, UI5Date) {
        "use strict";
    
        return Controller.extend("PlanningCalendar.PlanningCalendar.controller.Main", {
            onInit: function () {
                var currentDate = new Date();
                var oData = {
                    startDate: new Date(),
                    rows: [{
                        startDate: new Date(),
                        appointments: [{
                            startDate: new Date(),
                            endDate: new Date(currentDate.getTime() + (3 * 60 * 60 * 1000)),
                            title: "Meeting with SAP",
                            text: "Discuss project status",
                            type: "Type01",
                            pic: "sap-icon://sap-ui5",
                        }]
                    }]
                };
    
                var oModel = new JSONModel(oData);
                this.getView().setModel(oModel);
            },
    
            handleAppointmentSelect: function (oEvent) {
                var oAppointment = oEvent.getParameter("appointment"),
                    sSelected;
                if (oAppointment) {
                    sSelected = oAppointment.getSelected() ? "selected" : "deselected";
                    MessageBox.show("'" + oAppointment.getTitle() + "' " + sSelected);
                } else {
                    var aAppointments = oEvent.getParameter("appointments");
                    var sValue = aAppointments.length + " Appointments selected";
                    MessageBox.show(sValue);
                }
            },
    
            onPressBlock: function (oEvent) {
                var currentDate = new Date();
                var oData = {
                    startDate: new Date(),
                    rows: [{
                        startDate: new Date(),
                        appointments: [{
                            startDate: new Date(),
                            endDate: new Date(currentDate.getTime() + (3 * 60 * 60 * 1000)),
                            title: "Meeting with SAP",
                            text: "Discuss project status",
                            type: "Type01",
                            pic: "sap-icon://sap-ui5",
                        }, {
                            startDate: new Date(currentDate.getTime() + (3 * 60 * 60 * 1000)),
                            endDate: new Date(currentDate.getTime() + (6 * 60 * 60 * 1000)),
                            title: "Next Meeting with SAP",
                            text: "Discuss Next Meeting",
                            type: "Type02",
                            pic: "sap-icon://sap-ui5",
                            tentative: false
                        }]
                    }]
                };
    
                var oModel = new JSONModel(oData);
                this.getView().setModel(oModel);
            }
        });
    });

     

    Output

    Planning Calendar in SAP UI5

  • Developing Analytic Map using SAP UI5

    Introduction

    Discover the world of data visualization in an engaging and interactive way with our comprehensive guide on “Developing Analytic Map using SAP UI5”. Explore how to harness the power of SAP UI5, a highly efficient JavaScript framework, to create visually striking and informative analytic maps that transform raw data into meaningful insights.

    In this article, we delve into the step-by-step process of creating analytic maps, providing clear instructions and expert tips to help you effectively illustrate complex data sets. Whether you’re monitoring logistics, tracking global sales, or studying demographic trends, analytic maps present data in a geographic context, allowing for a more intuitive understanding and smarter decision-making process.

    Unlock the potential of geo-spatial data visualization and learn how to create dynamic, interactive maps with SAP UI5. This guide is perfect for developers seeking to enhance their skills, as well as businesses striving for a data-driven approach to achieve their goals. Let’s chart your path to successful data visualization.

    What is an Analytic Map?

    An Analytic Map is a type of data visualization that combines geographical data with quantitative data to provide insights in a visually compelling way. The primary goal of analytic maps is to help interpret and analyze patterns, trends, and correlations in data that may otherwise go unnoticed in a standard table or chart.

    In an analytic map, data is typically represented through various colors, symbols, or sizes of specific regions or points on the map. For instance, in a global sales report, the sales volume for each country can be represented by different colors, with darker shades indicating higher sales.

    These maps can be interactive, allowing users to zoom in and out, hover over specific regions to get more details, and even click on parts of the map to navigate to other reports or sections of the data.

    Analytic maps are particularly useful in a wide range of fields including business intelligence, public health, environmental studies, transportation planning, and many more. They help in understanding spatial relationships and geographic patterns in data, thereby aiding in more informed decision-making.

    Uses of Analytic Map in SAP UI5

    Analytic Maps in SAP UI5 open up a whole world of possibilities when it comes to data visualization and analysis. They can be used in various ways to provide spatial context to data, and deliver insights in an engaging and interactive way. Here are some of the primary uses:

    1. **Geospatial Data Visualization**: With SAP UI5, you can present your data in a geographical context, such as sales performance across different regions or tracking shipments in real-time.

    2. **Business Intelligence**: Analytic maps are a powerful tool in business intelligence, allowing businesses to visually compare data across different locations, track changes over time, and identify patterns and trends.

    3. **Interactive User Experience**: SAP UI5 analytic maps are interactive, enabling users to zoom in and out, hover over regions to get more details, and click on map points to navigate to other reports or sections of the data. This enriches the user experience, making data exploration more intuitive and engaging.

    4. **Real-Time Tracking**: For industries that rely on real-time location data, such as logistics, transportation, and supply chain management, SAP UI5 analytic maps can provide live updates and visual tracking.

    5. **Customization**: SAP UI5 provides the flexibility to customize the appearance and functionality of your maps according to your specific requirements. You can alter colors, shapes, sizes, and labels to best represent your data.

    6. **Integration with SAP Systems**: Given that SAP UI5 is a part of the larger SAP ecosystem, analytic maps can easily be integrated with other SAP applications and tools, allowing for seamless data flow and advanced analytics.

    Remember, the key to successfully leveraging analytic maps lies in understanding your data and knowing what story you want to tell. With SAP UI5, you’re equipped with a powerful tool that can transform your data into meaningful, actionable insights.

    Developing Analytic Map using SAP UI5

    View

    <mvc:View controllerName="geoMap.geoMap.controller.Main" xmlns:mvc="sap.ui.core.mvc" xmlns:l="sap.ui.layout" displayBlock="true"
        xmlns="sap.m">
        <Shell id="shell">
            <App id="app">
                <pages>
                    <Page id="page" title="{i18n>title}">
                        <content>
                            <l:VerticalLayout id="mapContainer" width="100%"/>
                        </content>
                    </Page>
                </pages>
            </App>
        </Shell>
    </mvc:View>

     

    Controller

    sap.ui.define([
        "sap/ui/core/mvc/Controller",
        "sap/ui/vbm/AnalyticMap",
        "sap/ui/vbm/Spot",
    ], function (Controller, AnalyticMap, Spot) {
        "use strict";
    
        return Controller.extend("geoMap.geoMap.controller.Main", {
            onInit: function () {
                var oMapView = new AnalyticMap({
                    width: "100%"
                });
                this.getView().byId("mapContainer").addContent(oMapView);
                var oSpot = new Spot({
                    "position": "77.1024902;28.7040592;0", // Replace with actual coordinates
                    "tooltip": "Delhi",
                    "type": "Success",
                    "text": "Delhi"
                });
    
                var oSpot2 = new Spot({
                    "position": "-74.013327;40.705395;0", // Replace with actual coordinates
                    "tooltip": "New York",
                    "type": "Inactive",
                    "text": "New York"
                });
    
                var oSpots = new sap.ui.vbm.Spots({
                    items: [oSpot, oSpot2]
                });
    
                oMapView.addVo(oSpots);
    
            }
        });
    });

     

    Output

    Developing Analytic Map using SAP UI5

  • VizFrame Chart in UI5 using local JSON or OData

    Introduction

    Introduction to VizFrame Chart in SAP UI5 using Local JSON or OData:

    VizFrame is a powerful data visualization control in SAP UI5 that empowers developers to create stunning charts and graphs for displaying data in a user-friendly and interactive manner. With VizFrame, you can visualize data from various sources, including local JSON and OData services. This introduction will explore how VizFrame can be leveraged to create dynamic and visually appealing charts using data from local JSON or OData services.

    1. Local JSON Data Source:
    Local JSON serves as an ideal data source for small to medium-sized datasets that are readily available within the application without the need for server-side communication. By utilizing the JSONModel in SAP UI5, developers can easily bind the local JSON data to the VizFrame control, allowing seamless data visualization directly within the application.

    2. OData Service Data Source:
    For larger datasets or real-time data, SAP UI5 offers integration with OData services. OData provides a standardized way to interact with remote data sources, enabling the VizFrame chart to visualize live data fetched from an external service. Leveraging the ODataModel, developers can efficiently connect the VizFrame chart to the OData service and automatically update the visualization as the data changes in the backend.

    Key Features of VizFrame Chart:
    – **Rich Chart Types:** VizFrame offers a wide range of chart types, including column charts, line charts, pie charts, bar charts, and more. You can select the most suitable chart type to present your data effectively.

    – **Interactive and Responsive:** VizFrame charts come with interactive features such as zooming, panning, and tooltips, providing users with a dynamic and engaging experience. The charts are responsive and adapt gracefully to various screen sizes and devices.

    – **Data Binding and Aggregation:** Whether using local JSON or OData services, VizFrame seamlessly binds data to the chart, allowing you to leverage data aggregation to summarize and group information for a clearer presentation.

    – **Customization and Theming:** Developers can easily customize the appearance of VizFrame charts by adjusting colors, labels, axis properties, and more. SAP UI5’s theming capabilities enable charts to harmonize with the overall application design.

    – **Integration with Other UI5 Controls:** VizFrame can be seamlessly integrated with other UI5 controls to build comprehensive and feature-rich analytical dashboards and applications.

    In conclusion, VizFrame in SAP UI5 is a versatile and user-friendly charting solution that enables developers to create visually compelling data visualizations using local JSON or OData services. By leveraging the power of VizFrame, developers can transform raw data into meaningful insights, empowering users to make informed decisions and gain valuable insights from their data.

    Important Terms to Understand

    In SAP UI5, the concept of Model, FlattenedDataset, and FeedItem is related to data visualization using VizFrame controls. VizFrame is a versatile UI5 control that allows you to create various types of charts and graphs for data representation.

    1. Model:
    A Model in SAP UI5 is an abstraction of data that allows you to access and manipulate data in a consistent way. It is a data binding concept that separates the control logic from the data. The Model provides a standard API to interact with the data, irrespective of the data source. There are various types of models, such as JSONModel, ODataModel, etc., which can be used based on the data source and requirements.

    2. FlattenedDataset:
    The FlattenedDataset is a specialized dataset used by VizFrame controls to represent data in a flattened format suitable for visualization. It takes tabular data and converts it into a format that can be easily understood by charts and graphs. The FlattenedDataset provides configuration options for defining dimensions (e.g., categories, groups) and measures (e.g., values, quantities) of the chart.

    3. FeedItem:
    The FeedItem is used in conjunction with the FlattenedDataset to define the mapping between the dimensions and measures of the FlattenedDataset and the corresponding axes of the chart. It defines which dimensions should be represented on which axis and which measures should be used for different aspects of the chart (e.g., axis values, colors, sizes).

    4. addFeed:
    In the context of VizFrame, addFeed is a method used to associate FeedItems with the FlattenedDataset. By adding FeedItems to the FlattenedDataset, you define how the data should be visualized in the chart. For example, you can specify that a particular dimension should be shown on the X-axis, or a certain measure should be used to determine the color of the chart elements.

    In summary, when using VizFrame for data visualization in SAP UI5, you create a FlattenedDataset to convert your tabular data into a suitable format for charting. You then use FeedItems to map dimensions and measures from the FlattenedDataset to specific aspects of the chart. Finally, you add these FeedItems to the FlattenedDataset using the addFeed method, allowing you to visualize the data in a meaningful and informative way.

    VizFrame Chart in UI5 using local JSON or OData

    View

    <mvc:View controllerName="vizChartJSON.vizChartJSON.controller.Main" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m"
        xmlns:viz="sap.viz.ui5.controls" xmlns:viz.feeds="sap.viz.ui5.controls.common.feeds">
        <Shell id="shell">
            <App id="app">
                <pages>
                    <Page id="page" title="My Project Ideas: VizFrame Chart in UI5 using local JSON or OData">
                        <content>
                            <RadioButtonGroup id='datasetRadioGroup'>
                                <buttons>
                                    <RadioButton class='settingsRadio' text="Line" select="onDatasetSelectedLine"/>
                                    <RadioButton class='settingsRadio' text="Column" select="onDatasetSelecteColumn"/>
                                    <RadioButton class='settingsRadio' text="Bullet" select="onDatasetSelecteBullet"/>
                                    <RadioButton class='settingsRadio' text="Area" select="onDatasetSelecteArea"/>
                                </buttons>
                            </RadioButtonGroup>
                            <viz:VizFrame id="chartContainer" vizType="line" width="600px" height="400px"/>
                        </content>
                    </Page>
                </pages>
            </App>
        </Shell>
    </mvc:View>

     

    Controller

    sap.ui.define([
        "sap/ui/core/mvc/Controller",
        "sap/viz/ui5/data/FlattenedDataset",
        "sap/viz/ui5/controls/common/feeds/FeedItem"
    ], function (Controller, FlattenedDataset, FeedItem) {
        "use strict";
    
        return Controller.extend("vizChartJSON.vizChartJSON.controller.Main", {
            onInit: function () {
                var data = [{
                    "Category": "Category 1",
                    "Revenue": 100
                }, {
                    "Category": "Category 2",
                    "Revenue": 200
                }, {
                    "Category": "Category 3",
                    "Revenue": 300
                }, {
                    "Category": "Category 4",
                    "Revenue": 400
                }, {
                    "Category": "Category 5",
                    "Revenue": 500
                }];
                // Load local JSON data
                var oDataModel = new sap.ui.model.json.JSONModel(data);
                // Use this line in case you are loading from external OData url
                // oDataModel.loadData(data);
    
                // Get the VizFrame control
                var oChartContainer = this.getView().byId("chartContainer");
    
                // Set the data model to the VizFrame
                oChartContainer.setModel(oDataModel);
    
                // Create a FlattenedDataset
                var oDataset = new FlattenedDataset({
                    dimensions: [{
                        name: "Category",
                        value: "{Category}"
                    }],
                    measures: [{
                        name: "Revenue",
                        value: "{Revenue}"
                    }],
                    data: {
                        path: "/"
                    }
                });
    
                // Add the dataset to the VizFrame
                oChartContainer.setDataset(oDataset);
    
                // Create a FeedItem for Category dimension
                var oCategoryFeed = new FeedItem({
                    uid: "categoryAxis",
                    type: "Dimension",
                    values: ["Category"]
                });
    
                // Create a FeedItem for Revenue measure
                var oRevenueFeed = new FeedItem({
                    uid: "valueAxis",
                    type: "Measure",
                    values: ["Revenue"]
                });
    
                // Add the FeedItems to the VizFrame
                oChartContainer.addFeed(oCategoryFeed);
                oChartContainer.addFeed(oRevenueFeed);
            },
            
            onDatasetSelectedLine: function(oEvent){
                this.byId("chartContainer").setVizType('line');
            },
            
            onDatasetSelecteColumn: function(oEvent){
                this.byId("chartContainer").setVizType('column');
            },
            
            onDatasetSelecteBullet: function(oEvent){
                this.byId("chartContainer").setVizType('bullet');
            },
            
            onDatasetSelecteArea: function(oEvent){
                this.byId("chartContainer").setVizType('area');
            }
        });
    });

     

    Output

    VizFrame Chart in UI5 using local JSON or OData

  • Convert PDF to Text in SAP UI5 using PDF.js

    Introduction

    Discover the power of PDF.js in our comprehensive guide to transforming PDF files into readable text within the SAP UI5 framework. As digital data continues to proliferate, the need for seamless data conversion and extraction increases. Leveraging the power of PDF.js, we will unravel the process of converting complex PDF files into simple text directly in your SAP UI5 applications. This powerful JavaScript library brings PDF rendering capabilities to your browser, making it easier than ever to parse and extract data from PDF files.

    Whether you’re a seasoned SAP UI5 developer or just beginning your journey, this guide offers a practical, step-by-step process for implementing PDF.js in your applications. From installation to implementation, we’ve got you covered. Improve your SAP UI5 skill set, enhance your applications, and unlock new possibilities with PDF.js today. Let’s dive into the world of PDF to text conversion in SAP UI5 with PDF.js.

    What is PDF.js

    PDF.js is a robust, open-source JavaScript library developed by Mozilla. It is used to parse and render PDF files directly in a web browser. One of its primary features is its ability to maintain the high fidelity of the original PDF file, including its fonts, vector graphics, and images.

    CDN for PDF.js: cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf.min.js

    The library offers a wide range of functionalities. For instance, it allows developers to highlight text within the PDF, search for specific text, and zoom in or out of the document. PDF.js can also be used to convert PDF files into other formats such as text or images, which is especially useful when you need to extract or manipulate the content of PDF files programmatically.

    By leveraging the power of modern web standards like HTML5 and JavaScript, PDF.js ensures a seamless, platform-independent solution that works across various devices and operating systems. As a result, it’s used in numerous applications and projects around the world, including the Firefox browser, where it’s used as the default PDF viewer.

    How to convert PDF to Text using PDF.js using JavaScript

    To convert PDF to Text using PDF.js with JavaScript, you can follow these steps:

    1. First, you need to include the PDF.js library in your project. You can download it from the official GitHub repository and include it in your HTML file.

    2. Load your PDF file using the ‘getDocument’ function. This function returns a promise that is resolved with a PDFDocumentProxy object.

    3. Once you have the PDFDocumentProxy object, you can call the ‘getPage’ function to get a particular page (let’s assume the first page). This function also returns a promise that is resolved with a PDFPageProxy object.

    4. Now, you can call the ‘getTextContent’ function on the PDFPageProxy object. This function returns a promise that is resolved with a TextContent object.

    5. The TextContent object has an array called ‘items’ which contains the individual text items of the page. You can loop through this array and concatenate all the strings to get the full text of the page.

    6. Repeat steps 3 to 5 for all pages in the PDF document.

    Please note that these are the general steps. Depending on your specific project and setup, there might be some variations in how you apply them. You will need to have a good understanding of JavaScript and Promises to work with PDF.js effectively.

    Also note that text extraction with PDF.js might not always be perfect. Due to the way PDF files are structured, sometimes the order of the text can get mixed up, or some characters might not get extracted correctly.

    Convert PDF to Text in SAP UI5 using PDF.js

    Index.html

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>My Project Ideas</title>
            <link rel="icon" type="image/x-icon" href="https://myprojectideas.com/wp-content/uploads/2021/08/cropped-Screenshot-2021-07-26-at-1.39.04-PM.png"/>
            <script id="sap-ui-bootstrap"
                src="resources/sap-ui-core.js"
                data-sap-ui-theme="sap_fiori_3"
                data-sap-ui-resourceroots='{"pdfUploader.pdfUploader": "./"}'
                data-sap-ui-compatVersion="edge"
                data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"
                data-sap-ui-async="true"
                data-sap-ui-frameOptions="trusted">
            </script>
                <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf.min.js"></script>
        </head>
        <body class="sapUiBody">
            <div data-sap-ui-component data-name="pdfUploader.pdfUploader" data-id="container" data-settings='{"id" : "pdfUploader"}'></div>
        </body>
    </html>

    View

    <mvc:View controllerName="pdfUploader.pdfUploader.controller.Main" xmlns:mvc="sap.ui.core.mvc" xmlns:u="sap.ui.unified" displayBlock="true"
        xmlns="sap.m">
        <Shell id="shell">
            <App id="app">
                <pages>
                    <Page id="page" title="My Project Ideas: Convert PDF to Text in SAP UI5 using PDF.js">
                        <content>
                            <VBox alignItems="Center" justifyContent="Center">
                                <u:FileUploader name="pdfUploader" buttonText="Upload PDF" fileType="pdf" change="onFileUpload"/>
                                <TextArea id="textArea" rows="10" width="100%" editable="false"/>
                            </VBox>
                        </content>
                    </Page>
                </pages>
            </App>
        </Shell>
    </mvc:View>

     

    Controller

    sap.ui.define([
        "sap/ui/core/mvc/Controller"
    ], function (Controller) {
        "use strict";
    
        return Controller.extend("pdfUploader.pdfUploader.controller.Main", {
            onInit: function () {
    
            },
    
            onFileUpload: function (event) {
                var that = this;
                var file = event.getParameter("files")[0];
                var reader = new FileReader();
    
                reader.onload = function (event) {
                    var pdfData = new Uint8Array(event.target.result);
    
                    // Load the PDF data using PDF.js
                    pdfjsLib.getDocument(pdfData).promise.then(function (pdf) {
                        // Access the first page of the PDF
                        pdf.getPage(1).then(function (page) {
                            // Extract the text content from the page
                            page.getTextContent().then(function (textContent) {
                                var extractedText = "";
    
                                // Concatenate the text content from all items
                                textContent.items.forEach(function (item) {
                                    extractedText += item.str + " ";
                                });
    
                                // Bind the extracted text to the TextArea control
                                var textArea = that.getView().byId("textArea");
                                textArea.setValue(extractedText);
                            }.bind(this));
                        });
                    });
                }.bind(this);
    
                reader.readAsArrayBuffer(file);
            },
        });
    });

     

    Output

    Sample PDF:

    Sample PDF

    After Upload:

    Convert PDF to Text in SAP UI5 using PDF.js

     

  • Download PDF in SAP UI5

    Introduction

    Welcome to a comprehensive guide on “Downloading PDFs in SAP UI5”. If you’ve ever grappled with the task of managing PDF files within your SAP UI5 applications, you’re in the right place. This tutorial will break down the process, providing you with an easy-to-follow method to implement this feature. Learn how to facilitate seamless PDF downloads, enhancing the user experience and functionality of your SAP UI5 application. So, whether you’re a seasoned developer or just starting out, this guide will help you master the process of PDF downloads in SAP UI5.

    How to Download PDF using JavaScript

    If you want to download a PDF file using JavaScript, you can use the built-in fetch API to retrieve the file from the server and then create a Blob from the response. After that, you can create a link element and simulate a click on it to start the download. Here are the steps:

    1. Make an HTTP request for the file: You can use the fetch API, which returns a promise that resolves to the Response to that request, whether it is successful or not.

    2. Read the response as a Blob: The response object resulting from the fetch request contains several methods to read the body in various formats. You can use `response.blob()` to read the response as a Blob which represents the PDF file.

    3. Create an object URL representing the Blob: Once you have the Blob, you can create an object URL for it using `URL.createObjectURL(blob)`. This will return a URL representing the blob, which you can use to link to the file.

    4. Simulate a link click to download the file: Now you can create a new link element, set its `href` attribute to the object URL, and simulate a click on it. This will start the download of the file.

    5. Revoke the object URL: After starting the download, it’s a good practice to revoke the object URL with `URL.revokeObjectURL(objectUrl)` to free up memory.

    Please note, if you’re going to implement it on a webpage, make sure the server is configured to allow such downloads, the correct CORS headers are set, and the file is available to be fetched and downloaded. This method should work in most modern browsers.

    Download PDF in SAP UI5

    View

    <mvc:View controllerName="pdfDownload.pdfDownload.controller.Main" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m">
        <Shell id="shell">
            <App id="app">
                <pages>
                    <Page id="page" title="My Project Ideas: Download PDF in UI5">
                        <content>
                            <Link id="downloadLink" text="Download PDF" press="onDownloadPDF"/>
                            <PDFViewer id="pdfViewer" source="https://www.africau.edu/images/default/sample.pdf" width="100%" height="600px"/>
                        </content>
                    </Page>
                </pages>
            </App>
        </Shell>
    </mvc:View>

     

    Controller

    sap.ui.define([
        "sap/ui/core/mvc/Controller"
    ], function (Controller) {
        "use strict";
    
        return Controller.extend("pdfDownload.pdfDownload.controller.Main", {
            onInit: function () {
    
            },
    
            onDownloadPDF: function () {
                // Replace with the actual URL of the PDF file or get it from OData
                var pdfURL = "https://www.africau.edu/images/default/sample.pdf";
                var link = document.createElement("a");
                link.href = pdfURL;
                link.target = "_blank";
                link.download = "document.pdf";
                link.click();
            }
        });
    });

     

    Output

    Download PDF in SAP UI5

  • Convert Excel data to JSON Data in SAP UI5

    Introduction

    Welcome to our comprehensive guide on ‘Converting Excel Data to JSON Data in SAP UI5.’ This practical approach simplifies the way we manage and interpret large Excel data sets, translating them into compact, easy-to-handle JSON files within the SAP UI5 framework. With this strategy, we aim to improve your data integration processes and quicken application development, allowing for more efficient and streamlined operations. We will learn how to Upload an excel file and convert it into JSON and bind it to the table or any other component.

    Excel to JSON in JavaScript

    Converting Excel data to JSON format in JavaScript typically involves parsing the Excel file, reading its data, and then transforming it into JSON format. Here is a simple step-by-step process using the ‘xlsx’ library, a popular JavaScript library to read, write and parse various spreadsheet formats.

    1. Create an HTML input element of type ‘file’ that accepts Excel files, allowing the user to select an Excel file from their device.

    2. Use the FileReader API to read the content of the selected file. The FileReader API is part of the web API and allows you to read file content in JavaScript.

    3. Use a library like `xlsx` to parse the Excel data. The parsing process converts the raw file data into a format that the library can work with.

    4. Extract a specific worksheet from the workbook. If you’re unsure, you can simply extract the first sheet.

    5. Use a function provided by the `xlsx` library to convert the worksheet data into JSON format.

    6. At this point, the Excel data has been converted into an array of JavaScript objects (JSON format). You can now use this data in your application.

    xlsx.js library

    The xlsx.js library is a robust and comprehensive JavaScript library that is designed to simplify the process of parsing and manipulating Excel files within the browser and Node.js. The library provides the capability to read and write various spreadsheet formats such as XLSX, XLSM, XLSB, and ODS.

    Convert Excel data to JSON Data in SAP UI5

    Index.html

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>My Project Ideas</title>
            <link rel="icon" type="image/x-icon" href="https://myprojectideas.com/wp-content/uploads/2021/08/cropped-Screenshot-2021-07-26-at-1.39.04-PM.png"/>
            <script id="sap-ui-bootstrap"
                src="resources/sap-ui-core.js"
                data-sap-ui-theme="sap_fiori_3"
                data-sap-ui-resourceroots='{"exceltoJson.exceltoJson": "./"}'
                data-sap-ui-compatVersion="edge"
                data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"
                data-sap-ui-async="true"
                data-sap-ui-frameOptions="trusted">
            </script>
            <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js"></script>
        </head>
        <body class="sapUiBody">
            <div data-sap-ui-component data-name="exceltoJson.exceltoJson" data-id="container" data-settings='{"id" : "exceltoJson"}'></div>
        </body>
    </html>

     

    View

    <mvc:View controllerName="exceltoJson.exceltoJson.controller.Main" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m"
        xmlns:u="sap.ui.unified">
        <Shell id="shell">
            <App id="app">
                <pages>
                    <Page id="page" title="My Project Ideas: Converting Excel data to JSON Data in UI5">
                        <content>
                            <u:FileUploader id="fileUploader" change="onFileUpload"/>
                            <TextArea id="textArea" rows="10" width="100%" editable="false"/>
                        </content>
                    </Page>
                </pages>
            </App>
        </Shell>
    </mvc:View>

     

    Controller

    sap.ui.define([
        "sap/ui/core/mvc/Controller"
    ], function (Controller) {
        "use strict";
    
        return Controller.extend("exceltoJson.exceltoJson.controller.Main", {
            onInit: function () {
    
            },
    
            onFileUpload: function (event) {
                var that = this;
                var file = event.getParameter("files")[0];
                var reader = new FileReader();
    
                reader.onload = function (e) {
                    var data = new Uint8Array(e.target.result);
                    var workbook = XLSX.read(data, {
                        type: 'array'
                    });
    
                    // Extract data from the first sheet
                    var worksheet = workbook.Sheets[workbook.SheetNames[0]];
                    var jsonData = XLSX.utils.sheet_to_json(worksheet);
    
                    // Use the jsonData as desired (e.g., display in a table, perform operations, etc.)
                    console.log(jsonData);
                    that.byId("textArea").setValue(JSON.stringify(jsonData));
                };
    
                reader.readAsArrayBuffer(file);
            }
    
        });
    });

     

    Input

    Output

  • Convert a JSON to Excel in SAP UI5

    Introduction

    Looking to seamlessly convert JSON data to Excel format within your SAP UI5 application? Look no further! In this comprehensive guide, we’ll walk you through a step-by-step process to effortlessly convert JSON data to Excel spreadsheets using SAP UI5. This powerful integration allows you to efficiently export and share your data in a user-friendly Excel format, enabling better data analysis and collaboration across your organization. Follow along to unlock the full potential of your SAP UI5 application by mastering the art of JSON to Excel conversion. Let’s dive in and learn How can we export JSON data to EXCEL in SAPUI5.

    JSON to Excel in JavaScript

    JSON (JavaScript Object Notation) is a lightweight data-interchange format that is widely used for storing and exchanging data. It is easy for humans to read and write, and also easy for machines to parse and generate. On the other hand, Excel is a popular spreadsheet program that allows users to store, organize, and analyze data in a tabular format.

    Converting JSON to Excel in JavaScript involves the process of transforming JSON data into a format compatible with Excel. This transformation is typically done using JavaScript libraries or functions that facilitate data manipulation and export capabilities.

    The steps involved in the JSON to Excel conversion process using JavaScript are as follows:

    1. Parsing JSON Data: The first step is to parse the JSON data and convert it into a JavaScript object, which allows for easy access and manipulation of the data.

    2. Creating Excel-Compatible Data: Next, JavaScript functions or libraries are used to structure the JSON data into a format that can be interpreted by Excel. This may involve converting the JSON object into an array of arrays or other Excel-friendly data structures.

    3. Generating Excel File: Once the data is prepared in a compatible format, JavaScript can be used to generate an Excel file. This process involves creating the appropriate Excel file format, populating it with the converted JSON data, and configuring any necessary settings, such as cell formatting and sheet names.

    4. Download or Display: Finally, the generated Excel file can be made available to the user for download or displayed directly within the web application, depending on the desired functionality.

    By leveraging the power of JavaScript and its libraries, developers can seamlessly convert JSON data to Excel format, enabling efficient data handling and analysis in Excel spreadsheets. This capability is valuable for web applications that need to export data for reporting, sharing, or further analysis in the familiar Excel environment.

    xlsx.js library

    xlsx.js is a powerful JavaScript library that enables seamless manipulation and generation of Microsoft Excel files (XLSX format) directly within web applications. With xlsx.js, developers can create, read, modify, and export Excel spreadsheets using pure JavaScript code, eliminating the need for server-side processing or browser plugins.

    Convert a JSON to Excel in SAP UI5

    Index.html

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>My Project Ideas</title>
            <link rel="icon" type="image/x-icon" href="https://myprojectideas.com/wp-content/uploads/2021/08/cropped-Screenshot-2021-07-26-at-1.39.04-PM.png"/>
            <script id="sap-ui-bootstrap"
                src="resources/sap-ui-core.js"
                data-sap-ui-theme="sap_fiori_3"
                data-sap-ui-resourceroots='{"excelProject.excelProject": "./"}'
                data-sap-ui-compatVersion="edge"
                data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"
                data-sap-ui-async="true"
                data-sap-ui-frameOptions="trusted">
            </script>
            <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js"></script>
        </head>
        <body class="sapUiBody">
            <div data-sap-ui-component data-name="excelProject.excelProject" data-id="container" data-settings='{"id" : "excelProject"}'></div>
        </body>
    </html>

     

    View

    <mvc:View controllerName="excelProject.excelProject.controller.Main" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m">
        <Shell id="shell">
            <App id="app">
                <pages>
                    <Page id="page" title="My Project Ideas: Convert a JSON to Excel in UI5">
                        <content>
                            <Button text="Export to Excel" press="onExportToExcel"/>
                        </content>
                    </Page>
                </pages>
            </App>
        </Shell>
    </mvc:View>

     

    Controller

    sap.ui.define([
        "sap/ui/core/mvc/Controller"
    ], function (Controller) {
        "use strict";
    
        return Controller.extend("excelProject.excelProject.controller.Main", {
            onInit: function () {
    
            },
    
            onExportToExcel: function () {
                // Get the JSON data
                var jsonData = [{
                    Name: "John",
                    Age: 25,
                    City: "New York"
                }, {
                    Name: "Alice",
                    Age: 30,
                    City: "London"
                }, {
                    Name: "Bob",
                    Age: 35,
                    City: "Paris"
                }];
    
                // Convert JSON to Excel workbook
                var workbook = XLSX.utils.book_new();
                var worksheet = XLSX.utils.json_to_sheet(jsonData);
                XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1");
    
                // Save the workbook as an Excel file
                XLSX.writeFile(workbook, "data.xlsx");
            }
    
        });
    });

     

    Output

    Convert a JSON to Excel in SAP UI5

  • Multiupload multiple files one by one in SAP UI5 (Sync Multiple Files Upload)

    Introduction

    Boost your productivity with the power of synchronous multiple file upload in SAP UI5. With our innovative solution, you can easily and efficiently upload multiple files one by one, simplifying your workflow and saving valuable time. Say goodbye to the hassle of uploading files individually and embrace the convenience of synchronous file uploads. Streamline your processes, enhance collaboration, and improve efficiency with Sync Multiple Files Upload in SAP UI5. Experience a seamless and optimized file uploading experience like never before.

    Difference between Sync and Async File Uploads in JavaScript

    Synchronous (Sync) and asynchronous (Async) file uploads in JavaScript refer to two different approaches for handling file upload operations. Here’s a breakdown of the key differences between the two:

    1. Execution Flow:
    – Sync: In synchronous file uploads, the execution of code pauses until the file upload operation is complete. It means that other code or operations won’t execute until the upload is finished.
    – Async: Asynchronous file uploads, on the other hand, allow the execution of code to continue while the file upload operation is in progress. The code doesn’t block and waits for the upload to complete.

    2. User Experience:
    – Sync: Synchronous file uploads can potentially cause the user interface to freeze or become unresponsive during the upload process. This is because the entire upload operation blocks the execution of other code or user interactions until it finishes.
    – Async: Asynchronous file uploads provide a better user experience as they allow the user interface to remain responsive while the upload is happening. Users can continue interacting with the application without any interruptions.

    3. Code Structure:
    – Sync: Synchronous file upload code is typically written in a linear and sequential manner. The code execution waits for the upload to complete before proceeding to the next line of code.
    – Async: Asynchronous file upload code is structured using callbacks, promises, or async/await syntax. It allows for non-blocking execution, enabling other code or operations to run concurrently while the upload progresses.

    4. Scalability and Performance:
    – Sync: Synchronous file uploads may not be suitable for large file uploads or scenarios with high concurrency. They can impact the scalability and performance of the application, especially if multiple users are uploading files simultaneously.
    – Async: Asynchronous file uploads are more scalable and performant as they allow for concurrent execution of multiple operations. This is particularly beneficial when dealing with large file uploads or multiple users uploading files concurrently.

    5. Error Handling:
    – Sync: Synchronous file uploads often handle errors using exception handling mechanisms. If an error occurs during the upload process, it can lead to program crashes or disruptions in the code flow.
    – Async: Asynchronous file uploads provide better error handling capabilities. They allow for the use of error callbacks, rejection handling in promises, or try-catch blocks with async/await, enabling more graceful error handling and recovery options.

    In summary, synchronous file uploads block the execution of other code until the upload is complete, while asynchronous file uploads allow concurrent execution, providing a better user experience, scalability, and performance. Asynchronous approaches are typically preferred for modern web applications where responsiveness and efficiency are crucial.

    When to choose Sync File Upload?

    Synchronous file uploads can be appropriate in certain scenarios where the following conditions are met:

    1. Simplicity: If the file upload operation is simple and doesn’t involve complex processing or interactions with other parts of the application, synchronous file uploads can be a straightforward solution. They have a linear code structure, making it easier to understand and implement.

    2. Small File Sizes: Synchronous file uploads can be suitable for small file sizes that can be uploaded quickly without causing significant delays or freezing the user interface. If the file sizes are small and the upload process is expected to complete rapidly, synchronous uploads may be sufficient.

    3. Sequential Dependencies: If the file upload operation depends on the completion of other synchronous tasks or operations in your application, a synchronous approach can simplify the coordination between these steps. For example, if the file upload is tightly linked with specific data processing or validation steps that must occur sequentially, synchronous file uploads can ensure the proper order of execution.

    4. Simultaneous Blocking: In some cases, blocking the user interface during the file upload might be desired. For instance, in certain security-conscious applications where it is crucial to ensure that no other actions can be performed while the file is being uploaded, synchronous file uploads can be employed.

    It’s important to note that synchronous file uploads may not be suitable for scenarios involving large file sizes, complex operations, or situations where multiple users are simultaneously uploading files. In such cases, asynchronous file uploads are generally preferred to maintain a responsive user interface and better scalability.

    Multiupload multiple files one by one in SAP UI5 (Sync Multiple Files Upload)

    View Code

    <mvc:View controllerName="TestProject.TestProject.controller.Main" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m">
    <Shell id="shell">
    <App id="app">
    <pages>
    <Page id="page" title="My Project Ideas: Multiupload multiple files one by one in UI5 (Sync Multiple Upload files)">
    <content>
    <UploadCollection id="idMultiUploader" maximumFilenameLength="55" maximumFileSize="3" multiple="true" sameFilenameAllowed="false"
    instantUpload="false" noDataDescription="{i18n>noDataDescriptiont}" change="onChangeEmailUpload" fileDeleted="onFileDeleted"
    filenameLengthExceed="onFilenameLengthExceed" fileSizeExceed="onFileSizeExceed" typeMissmatch="onTypeMissmatchMultiUpload"
    uploadComplete="onUploadComplete" beforeUploadStarts="onBeforeUploadStarts"/>
    <Button text="{i18n>Upload}" press="onMultiUploadSubmit"/>
    <Button id="messagePopoverBtn" icon="sap-icon://message-popup" type="{popoverModel>/type}" text="{popoverModel>/messagesLength}"
    press="handleMessagePopoverPress"/>
    </content>
    </Page>
    </pages>
    </App>
    </Shell>
    </mvc:View>

     

    Controller Code

    sap.ui.define([
        "sap/ui/core/mvc/Controller",
        "sap/ui/core/BusyIndicator",
        "sap/m/MessageBox",
        "sap/m/MessagePopover",
        "sap/m/MessagePopoverItem",
        "sap/m/Button"
    ], function (Controller, BusyIndicator, MessageBox, MessagePopover, MessagePopoverItem, Button) {
        "use strict";
        var oMessageTemplate;
        var oMessagePopover;
        return Controller.extend("TestProject.TestProject.controller.Main", {
            onInit: function () {
                var headerButton = new sap.m.Button({
                    text: "Clear",
                    type: sap.m.ButtonType.Reject,
                    press: function () {
                        that.onClearNotification();
                    }
                });
                oMessageTemplate = new MessagePopoverItem({
                    type: '{T}',
                    title: '{S}',
                });
                oMessagePopover = new MessagePopover({
                    items: {
                        path: '/',
                        template: oMessageTemplate
                    },
                    headerButton: headerButton
                });
                var pop_msgModel = new sap.ui.model.json.JSONModel({
                    "messagesLength": "",
                    "type": "Default"
                });
                this.getView().setModel(pop_msgModel, "popoverModel");
                var popModel = new sap.ui.model.json.JSONModel({});
                oMessagePopover.setModel(popModel);
                // Uploader Files
                this.contentFiles = [];
                this.contentSize = 0;
            },
    
            /**
             * onUploadContentTable is invoked on click from UI. 
             * Input: Excel Data
             * Output: Excel Preview
             * Excel upload is implemented in BaseController.js
             */
    
            onUploadContentTable: function (oEvent) {
                BusyIndicator.show();
                this.file = oEvent.getParameter("files")[0];
                this.UploadUrl = "/DataManager/masterData/contentTable";
                this.getExcelPreview(this.file, oEvent);
                this.byId("uploadContentTableTemplate").setValue("");
                BusyIndicator.hide();
            },
    
            /**
             * onMultiUploadCancel is invoked on click from UI. 
             * Input: oEvent
             * Output: Deletion of all Items of Dialog Box and Dialog Box closes
             */
    
            onMultiUploadCancel: function (oEvent) {},
    
            /**
             * onChangeEmailUpload is invoked on drag and drop of files. 
             * Input: Single or Multiple Excel Data
             * Output: All files are added within an array and used during submit
             */
    
            onChangeEmailUpload: function (oEvent) {
                var that = this;
                if (oEvent.getParameters("files").files[0]) {
                    // if files added via add button
                    var allData = Object.values(oEvent.getParameters("files").files);
                    allData.forEach(function (data) {
                        that.contentFiles = that.contentFiles.concat(data);
                    });
                } else {
                    // if files added via drag and drop
                    this.contentFiles = this.contentFiles.concat(oEvent.getParameter("files"));
                }
            },
    
            /**
             * onMultiUploadSubmit is invoked on click from UI. 
             * Input: Single or Multiple Excel Data
             * Output: Messages in Popover
             * Table rebind is implemented in BaseController.js
             * It is a recurring function that uploads file on every succcess of previous one
             */
    
            onMultiUploadSubmit: function (oEvent, index) {
                var that = this;
                var formData;
                var sPercentage;
                this.UploadUrl = "/DataManager/masterData/contentTable";
                BusyIndicator.show(0);
                if (!index) {
                    index = 0;
                    // Progress Bar to show upload in percentage
                    if (!that._oProgressDialog) {
                        that._oProgressDialog = sap.ui.xmlfragment("TestProject.TestProject.fragment.progressIndicator", that);
                        that.getView().addDependent(that._oProgressDialog);
                    }
                    that._oProgressDialog.open();
                }
                if (that.contentFiles.length > 0 && index < that.contentFiles.length) {
                    formData = that.contentFiles[index];
                    var form = new FormData();
                    form.append("file", formData);
                    return $.ajax({
                        method: "PUT",
                        url: "/DataManager/masterData/contentTable",
                        data: form,
                        async: true,
                        processData: false,
                        mimeType: "multipart/form-data",
                        headers: {
                            "X-Csrf-Token": "<Get token from Data Model>"
                        },
                        contentType: false,
                    }).done((response) => {
                        var successData = [];
                        successData.push({
                            T: "Success",
                            S: that.contentFiles[index].name + " : " + response
                        });
                        // Updating the Message Popover
                        var previous = oMessagePopover.getModel().getData();
                        if (previous.length === undefined)
                            previous = [];
                        var updated = previous != "" ? previous.concat(successData) : successData;
                        oMessagePopover.getModel().setData(updated);
                        oMessagePopover.getModel().refresh(true);
                        that.getView().getModel("popoverModel").getData().messagesLength = updated.length;
                        that.getView().getModel("popoverModel").getData().type = "Emphasized";
                        that.getView().getModel("popoverModel").refresh(true);
                        // Updating the progress Indicator
                        sPercentage = parseInt(((index + 1) / that.contentFiles.length) * 100, 0);
                        that.getOwnerComponent().getModel("appConfigModel").setProperty("/uploadPercentage", sPercentage);
                        that.onMultiUploadSubmit(oEvent, index + 1);
                    }).fail(function (XMLHttpRequest, textStatus, errorThrown) {
                        // Updating the Message Popover
                        var sErrorMsg = that.getErrorMsg(XMLHttpRequest, textStatus, errorThrown);
                        if (sErrorMsg) {
                            var errorData = [];
                            errorData.push({
                                T: "Error",
                                S: that.contentFiles[index].name + " : " + sErrorMsg
                            });
                            var previous = oMessagePopover.getModel().getData();
                            if (previous.length === undefined)
                                previous = [];
                            var updated = previous != "" ? previous.concat(errorData) : errorData;
                            oMessagePopover.getModel().setData(updated);
                            oMessagePopover.getModel().refresh(true);
                            that.getView().getModel("popoverModel").getData().messagesLength = updated.length;
                            that.getView().getModel("popoverModel").getData().type = "Emphasized";
                            that.getView().getModel("popoverModel").refresh(true);
                            // Updating the progress Indicator
                            sPercentage = parseInt(((index + 1) / that.contentFiles.length) * 100, 0);
                            that.getOwnerComponent().getModel("appConfigModel").setProperty("/uploadPercentage", sPercentage);
                            that.onMultiUploadSubmit(oEvent, index + 1);
                        }
                    });
                } else {
                    that.contentFiles = [];
                    BusyIndicator.hide();
                    // Updating the progress Indicator
                    sPercentage = parseInt(((index + 1) / that.contentFiles.length) * 100, 0);
                    that.getOwnerComponent().getModel("appConfigModel").setProperty("/uploadPercentage", sPercentage);
                    that._oProgressDialog.close();
                }
            },
    
            /**
             * handleMessagePopoverPress is invoked on click from UI. 
             * Input: oEvent
             * Output: Message Popover opens up or closes
             */
    
            handleMessagePopoverPress: function (oEvent) {
                oMessagePopover.toggle(oEvent.getSource());
            },
    
            /**
             * onFileSizeExceed is invoked on click of Upload in UI. 
             * Input: Size of file
             * Output: Error Message
             */
    
            onFileSizeExceed: function (oEvent) {
                // read msg from i18n model
                var sMsg = this.oBundle.getText("MultiUploadCondition");
                MessageBox.error(sMsg);
            },
    
            /**
             * onTypeMissmatchMultiUpload is invoked click of Upload in UI. 
             * Input: Type of file
             * Output: Error Message
             * The type miss match generic function is available in base controller
             */
    
            onTypeMissmatchMultiUpload: function (oEvent) {
                // this.onTypeMissmatch();
            },
    
            /**
             * onClearNotification is invoked on click of Clear from UI. 
             * Input: Message Model
             * Output: Empty Message Model
             */
    
            onClearNotification: function (oEvent) {
                // Clear Popover Messages
                this.getView().getModel("popoverModel").setData({
                    "messagesLength": "",
                    "type": "Default"
                });
                this.getView().getModel("popoverModel").refresh(true);
                oMessagePopover.getModel().setData("");
                oMessagePopover.getModel().refresh(true);
            },
    
            /**
             * onResetForms is invoked from a function. 
             * Input: array, object or string
             * Output: Input field value is cleared
             */
    
            getErrorMsg: function (XMLHttpRequest, textStatus, errorThrown) {
                var sCommonErrorMsg = "An error caught";
                var sTimeOutErrorMsg = "Time out";
                var sErrorMsg;
                if (XMLHttpRequest.responseJSON) {
                    if (XMLHttpRequest.responseJSON.message) {
                        if (Array.isArray(XMLHttpRequest.responseJSON.message)) {
                            sErrorMsg = XMLHttpRequest.responseJSON.message.join("\n");
                        } else {
                            sErrorMsg = XMLHttpRequest.responseJSON.message;
                        }
                    } else {
                        sErrorMsg = XMLHttpRequest.responseJSON.error;
                    }
                } else if (XMLHttpRequest.responseText) {
                    if (XMLHttpRequest.responseText == "Unauthorized") {
                        sErrorMsg = sTimeOutErrorMsg;
                        window.location.href = '../logout';
                    } else {
                        sErrorMsg = XMLHttpRequest.responseText;
                    }
                } else {
                    sErrorMsg = sCommonErrorMsg;
                }
                return sErrorMsg;
            }
        });
    });

     

    progressIndicator.fragment.xml Code

    <core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:html="http://www.w3.org/1999/xhtml">
        <Dialog id="idProgresIndicatorDialog" title="{i18n>UploadinProgress}" titleAlignment="Center" showHeader="true"
            class="sapUiResponsivePadding">
            <ProgressIndicator id="idProgresIndicator" class="sapUiSmallMarginBottom" displayValue="{appConfigModel>/uploadPercentage}%"
                percentValue="{appConfigModel>/uploadPercentage}" state="Information" displayOnly="true"/>
        </Dialog>
    </core:FragmentDefinition>

     

    Model Code

    sap.ui.define([
        "sap/ui/model/json/JSONModel",
        "sap/ui/Device"
    ], function (JSONModel, Device) {
        "use strict";
    
        return {
    
            createDeviceModel: function () {
                var oModel = new JSONModel(Device);
                oModel.setDefaultBindingMode("OneWay");
                return oModel;
            },
            
            createAppConfigData: function () {
                var oAppConfigModel = {
                    "uploadPercentage": 0
                };
                return oAppConfigModel;
            }
    
        };
    });

     

    Component.js Code

    sap.ui.define([
        "sap/ui/core/UIComponent",
        "sap/ui/Device",
        "TestProject/TestProject/model/models",
        "sap/ui/model/json/JSONModel",
    ], function (UIComponent, Device, models, JSONModel) {
        "use strict";
    
        return UIComponent.extend("TestProject.TestProject.Component", {
    
            metadata: {
                manifest: "json"
            },
    
            /**
             * The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
             * @public
             * @override
             */
            init: function () {
                // call the base component's init function
                UIComponent.prototype.init.apply(this, arguments);
    
                // enable routing
                this.getRouter().initialize();
    
                // set the device model
                this.setModel(models.createDeviceModel(), "device");
                
                            //set AppConfigModel
                this.setModel(new JSONModel(models.createAppConfigData()), "appConfigModel");
            }
        });
    });

     

    Output

    Before Upload

    Multiupload multiple files one by one in SAP UI5 Before Upload

    Progress Indicator

    Progress Indicator

    After Upload

    Sync Multiple Files Upload

     

    Note: Update i18n wherever you see the wrong texts, they are intended to be shown like that in the absence of i18n files