ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference...

19
ABAP for SAP HANA Reference Scenario: Implementing Open Items Analysis Using SAP UI5 and SAP Gateway Foundation Component Applicable Releases: SAP NetWeaver 7.4 SP02 Version 1.0 August 2013

Transcript of ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference...

Page 1: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Reference Scenario: Implementing Open Items Analysis Using SAP UI5 and SAP Gateway Foundation Component

Applicable Releases:

SAP NetWeaver 7.4 SP02

Version 1.0

August 2013

Page 2: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts
Page 3: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ii

Document History

Document Version Description

1.00 First official release of this guide

Page 4: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

iii

Typographic Conventions

Type Style Description

Example Text Words or characters quoted from the screen. These include field names, screen titles, pushbuttons labels, menu names, menu paths, and menu options.

Cross-references to other documentation

Example text Emphasized words or phrases in body text, graphic titles, and table titles

Example text File and directory names and their paths, messages, names of variables and parameters, source text, and names of installation, upgrade and database tools.

Example text User entry texts. These are words or characters that you enter in the system exactly as they appear in the documentation.

<Example

text> Variable user entry. Angle brackets indicate that you replace these words and characters with appropriate entries to make entries in the system.

EXAMPLE TEXT Keys on the keyboard, for

example, F2 or ENTER.

Icons

Icon Description

Caution

Important

Note

Recommendation or Tip

Example

Page 5: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

1

Table of Contents

1. Remarks before you start ................................................................................................... 2

2. Business Scenario ............................................................................................................... 2

3. Application Overview .......................................................................................................... 3

3.1 Dunning Report............................................................................................................. 3 3.2 Open Sales Orders ....................................................................................................... 4

4. Architecture .......................................................................................................................... 7

5. Data Model and Package Structure ................................................................................... 8

5.1 Data Model ................................................................................................................... 8 5.2 Package Structure ........................................................................................................ 8

6. Development Objects .......................................................................................................... 9

6.1 HANA Artifacts .............................................................................................................. 9 6.2 ABAP Artifacts - External View ................................................................................... 10 6.3 ABAP Artifacts – Gateway Services ........................................................................... 10 6.4 ABAP Artifacts – SAP UI5 .......................................................................................... 11

7. Appendix ............................................................................................................................ 14

Page 6: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

2

1. Remarks before you start

This demo can be found on an SAP NetWeaver AS ABAP 7.4 running on a SAP HANA database SPS5 or higher. For more details, information and guides based on SAP NetWeaver AS ABAP and SAP HANA please visit our SCN Page: http://scn.sap.com/docs/DOC-35518

2. Business Scenario

For the purpose of setting the whole business context, it is relevant to mention that Open Items Analysis (OIA) based on Dunning Levels represents a supplement to the NetWeaver (NW) Enterprise Procurement Model (EPM) demo application—covering procurement and sales business scenarios—and enriches OIA with analytical use cases. In the best interests of a company, it is necessary to collect all outstanding receivables as quickly as possible because of the great importance of ready cash in running a business. A company has the chance to put the cash to use again by quickly turning sales into cash, reinvest, and increase sales. The Accounts Receivable accountant, responsible for cash management, analyzes the dunning levels of the overdue orders and orders that exceed a predefined and customizable amount. Based on this analysis, the Accounts Receivable accountant searches for specific orders and initiates relevant actions—send reminder e-mail, initiate legal notice—against business partners. As an Accounts Receivable accountant, you use the OIA application on your phone/tablet to perform the following tasks: ...

1. Analyze the dunning levels for the open orders

2. Filter the number of orders based on number of days the order is open

3. Check the details—amount, number of orders and so on—for a certain dunning level

4. Check the order details for a certain dunning level

5. Filter the list of orders based on company name

6. Initiate appropriate action–send reminder e-mail or initiate legal notice—for selected orders

The image below provides an overview of the OIA reference scenario. Only the sales scenario—and not the procurement scenario—is illustrated below for reasons of simplification:

Page 7: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

3

3. Application Overview

SAP UI5 and SAP Gateway Foundation Component has been used to build the Open Item Analysis (OIA) based on Dunning Levels or in short the Dunning Report application. The Dunning Report application interface appears as in the screenshot below. The sections below explain the functionalities of the Dunning Report application.

3.1 Dunning Report

Dunning Report is the initial view. The chart has number of open sales orders as dimension and dunning level as measure. The filter varies from 0 to 180 open days. The filter interval is set to 30 days. Dunning Report displays sales order greater than 0 open days as default. As an Account Responsible accountant, you can filter out the open sales order based on number of open days. For example, you can filter open sales order greater than 90 open days. The chart displays sales orders that are open for more than 90 days. The chart also has dunning level as legend, which indicates the number of open sales orders of the dunning level.

This view has two details list:

one for overdue amount of selected dunning level from the chart

one for overdue amount of all dunning levels (all open sales orders overdue amount)

Click “Details” after selecting a certain dunning level, to display the Open Sales Order screen. This screen contains details of all the open sales orders for the selected dunning level and open days filter.

Page 8: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

4

3.2 Open Sales Orders

The Open Sales Orders screen contains the list of open sales orders of the selected dunning level and the selected days open filter. Each item in the list has the sales order ID, Buyer Name, Overdue Amount of the sales order items in the converted currency EUR.

As an Account Manager, you can search by company name of open sales order. OIA enables fuzzy search with multiple columns such as Company Name and Address Attributes.

You can sort the open sales order list according to:

overdue amount in descending order or

company name in ascending order

The default sort option is overdue amount in descending order.

As an Account Manager, you can select one or more sales orders to send e-mails to the buyers associated with the selected sales orders. The image of all the selected sales orders changes to the e-mail icon and a confirmation message appears after successfully performing the send e-mail action.

Page 9: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

5

You can also select one or more sales orders to initiate legal notice to the buyers associated with the selected sales orders. The image of all the selected sales orders changes to the legal notice icon and a confirmation message appears after successfully performing the initiate legal action.

Page 10: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

6

The block diagram below displays the key ABAP for SAP HANA features covered in the Dunning Report application:

You can access the Dunning Report application from the Web browser available on tablets like iPad using the following URL- https://<server>:<port>/sap/bc/ui5_ui5/sap/sepm_oia_ui5_m/index.html?sap-client=000&sap-ui-language=EN. From NW 7.4 SP3 onwards, Dunning Report is supported on smart phones and tablets containing iOS or Android.

Page 11: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

7

4. Architecture

The architecture diagram provided below defines the interactions that occur between components of Dunning Report application. The application uses the external view—Open Sales Orders—representing the Open Sales Order calculation view in SAP HANA, to display all the Open Sales Orders grouped by dunning level in the Dunning Report screen. The external view is used, when open sales order details are displayed in a common currency for a selected dunning level and selected days open filter, in the Open Sales Orders screen.

The Open Sales Invoices calculation view is built using the Sales Order, Sales Order Invoice Header, Sales Order Invoice Items and Buyer[=Business Partner] tables. You can find more details on the artifacts and development objects forming the application in the chapters below.

Page 12: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

8

5. Data Model and Package Structure

5.1 Data Model

The Dunning Report is based on the EPM demo model and mainly uses three of the EPM business entities: business partner or buyer, sales order invoice (which maintains a header and items), and product. The image below shows graphical overview of the 3 interrelated fact tables that make up the data model:

1. SNWD_BPA contains all the information about the business partner, representing the buyer, for this scenario.

2. SNWD_SO_INV_HEAD is the invoice table containing all items of an invoice in different currencies. The PARENT_KEY contains the SNWD_INV_HEAD-NODE_KEY connecting the item and header table with a n:1 relation.

3. SNWD_SO is the sales orders table containing all the information about sales orders. The NODE_KEY contains the SNWD_SO_INV_HEAD-SO_GUID connecting the sales order and invoice table with a 1:1 relation.

5.2 Package Structure

The Dunning Report and the HANA artifacts that this SAP UI5 application consumes are available in the packages - S_EPM_OIA_APPS_UI5 and sap.bc.epm.oia.apps [HANA Package] respectively. The following screenshot displays the package structure of the application:

Page 13: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

9

6. Development Objects

6.1 HANA Artifacts

This section briefly explains the HANA artifacts used in the OIA application.

Calculation Views Description

sap.bc.epm.oia.app::CA_GET_INPUT_PARAMETERS

This is the script based calculation view used to retrieve current ABAP client, target currency and conversion date which is set by the ABAP session context. These retrieved values are later used by the sap.bc.epm.oia.app::CA_OPEN_INVOICES calculation view.

sap.bc.epm.oia.app::CA_OPEN_INVOICES This is the script based calculation view used to retrieve all the open sales order details along with the open days, buyer classification and dunning level. It invokes another calculation view sap.bc.epm.oia.app::CA_GET_INPUT_PARAMETERS.

Business logic is achieved using Calculation Engine plan operator and uses the following EPM tables:

snwd_so_inv_head Contains header data for sales order invoices

snwd_so Contains sales order header data

snwd_so_inv_item Contains header data for sales order invoice items

snwd_bpa Contains business partner header data

Page 14: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

10

6.2 ABAP Artifacts - External View

This view represents SAP HANA artifact in ABAP. As a developer, you can access SAP HANA artifacts using open SQL via this external view.

External Views Description

SEPMAPPS_OPENINV This external view is the ABAP DDIC representation of the corresponding SAP HANA artifacts (sap.bc.epm.oia.app::CA_OPEN_INVOICES) in the ABAP layer. As a developer, you can now access SAP HANA artifacts using open SQL in this external view.

6.3 ABAP Artifacts – Gateway Services

SAP NetWeaver Gateway foundation component available with 7.4 SP2 onwards allows the creation of OData services using the Service Builder (transaction "SEGW"). Service Builder accelerates the OData service development process as you might have to write minimal ABAP code, only if needed. It is not mandatory to have an understanding of ABAP OO skills while using Service Builder. For more details on SAP NetWeaver Gateway, see the document on SCN.

In Service Builder you need to do 3 main steps to build an OData service:

1. Define or import the data model

2. Implement or generate the runtime logic for the service operations

3. Activate and run the service

The following diagram depicts the Gateway service created for Dunning Report. The service EPM_OIA_APPS_GW_SERVICE retrieves data in OData format from the calculation view. This Gateway Service has two model entities – DunningLevelDetail, OpenSalesItem - for the corresponding views, described in section 2.1 and 2.2 in the view topic above. The Gateway Service also has one function trigger – TriggerReminder - for the actions in open sales order list view.

Page 15: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

11

Gateway Service Endpoint Description

DunningLevelDetails The service endpoint accessible via https://<service>:<port>/sap/opu/odata/sap/EPM_OIA_APPS_GW_SERVICE_SRV/DunningLevelDetails gives all the open sales orders grouped by dunning levels.

OpenSalesItems The service endpoint accessible via https://<service>:<port>/sap/opu/odata/sap/EPM_OIA_APPS_GW_SERVICE_SRV/OpenSalesItems gives all the open sales orders in common currency.

Gateway Association Description

DunningLevel_OpenSalesItems

The association helps get all the open sales orders in a common currency for a given dunning level. An example service call for all the open sales orders for a given dunning level 4 looks as follows - https://<service>:<port>/sap/opu/odata/sap/EPM_OIA_APPS_GW_SERVICE_SRV/DunningLevelDetails.

6.4 ABAP Artifacts – SAP UI5

SAPUI5 contains a dedicated control library for mobile devices such as tablets and smartphones with

the technical name sap.m. Both sap.m and the control libraries for desktop contain the same runtime

which provides a common infrastructure for Data Binding, Model-View-Controller concepts. In addition, both desktop and mobile devices have a harmonized API for common parts. This makes it easy for application developers to build efficient applications for both scenarios. As SAPUI5 is based on Web standards like HTML, CSS, and JavaScript, as an Account Manager, you can run the application on

multiple platforms. The Mobile Visual Identity theme provides comfortable user experience on

both Android and Apple devices. For more details on SAP NetWeaver Gateway, see the document on SCN.

Page 16: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

12

Resources Description

index.html The entry page that embeds the view/content for the UI of the application. In the Dunning Report application, it embeds the view represented by App.view.xml.

DunningReport.view.js Displays the chart which has number of open sales orders as dimension and dunning level as measure. By selecting a certain dunning level the details of the number of sales orders and the total amount for these open sales orders for the selected dunning level is displayed. The view has a chart and an area to display the details for a selected dunning level and a filter to filter out the sales orders for analysis.

DunningReport.controller.js Controllers are used for business logics and communication channel between Views and the AS ABAP Server. Dunning Report controller has the required logic to fetch the dunning details and to calculate the total overdue amount.

OpenSalesOrders.view.js Displays the list of Open Sales Order for a given dunning level. This view allows you to perform the following activities in the Open Sales Order list:

Sorting the Open Sales Order list by amount or company name

Searching the Open Sales Order list by company name

Sending reminder e-mails or initiating legal notice for selected sales orders

Page 17: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

13

OpenSalesOrders.controller.js Controllers are used for business logics and communication channel between Views and the AS ABAP Server. Open Sales Order Controller has the required business logic to populate the list of open sales order for a given dunning level and take action—send reminder e-mail or initiate legal notice—for selected sales orders. It has the required logic to navigate to Dunning Report screen.

SortByPopover.view.js Displays the sort options - By Amount, By Company Name - for the Open Sales Order View.

SortByPopover.controller.js Has the required business logic to trigger sort either by amount or by company name.

App.view.xml Has a list of views forming the main screens of the application using which the controller can manage the navigation across these views.

App.controller.js The Application View the required logic to specify the initial view and manages communication to other views. Also loads the required resources on boot-up.

Page 18: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component

14

7. Appendix

The table below describes the various Dunning Levels:

Dunning Level Description

0/<initial> Do not remind yet

1 Send first reminder

2 Send second reminder

3 Send third/final reminder

4 Forwarded to collection agency

5 Action for payment

Page 19: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

www.sap.com

© 2013 SAP AG. All rights reserved.

SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP

BusinessObjects Explorer, StreamWork, SAP HANA, and other SAP

products and services mentioned herein as well as their respective

logos are trademarks or registered trademarks of SAP AG in Germany

and other countries.

Business Objects and the Business Objects logo, BusinessObjects,

Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and

other Business Objects products and services mentioned herein as

well as their respective logos are trademarks or registered trademarks

of Business Objects Software Ltd. Business Objects is an SAP

company.

Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL

Anywhere, and other Sybase products and services mentioned herein

as well as their respective logos are trademarks or registered

trademarks of Sybase Inc. Sybase is an SAP company.

Crossgate, m@gic EDDY, B2B 360°, and B2B 360° Services are

registered trademarks of Crossgate AG in Germany and other

countries. Crossgate is an SAP company.

All other product and service names mentioned are the trademarks of

their respective companies. Data contained in this document serves

informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials

are provided by SAP AG and its affiliated companies ("SAP Group")

for informational purposes only, without representation or warranty of

any kind, and SAP Group shall not be liable for errors or omissions

with respect to the materials. The only warranties for SAP Group

products and services are those that are set forth in the express

warranty statements accompanying such products and services, if

any. Nothing herein should be construed as constituting an additional

warranty. .

Page 20: ABAP for SAP HANA Reference Scenario: Implementing Mobile ... · ABAP for SAP HANA Mobile Reference Application Using SAP UI5 and Gateway Foundation Component 10 6.2 ABAP Artifacts

www.sap.com

© 2013 SAP AG. All rights reserved.

SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP

BusinessObjects Explorer, StreamWork, SAP HANA, and other SAP

products and services mentioned herein as well as their respective

logos are trademarks or registered trademarks of SAP AG in Germany

and other countries.

Business Objects and the Business Objects logo, BusinessObjects,

Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and

other Business Objects products and services mentioned herein as

well as their respective logos are trademarks or registered trademarks

of Business Objects Software Ltd. Business Objects is an SAP

company.

Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL

Anywhere, and other Sybase products and services mentioned herein

as well as their respective logos are trademarks or registered

trademarks of Sybase Inc. Sybase is an SAP company.

Crossgate, m@gic EDDY, B2B 360°, and B2B 360° Services are

registered trademarks of Crossgate AG in Germany and other

countries. Crossgate is an SAP company.

All other product and service names mentioned are the trademarks of

their respective companies. Data contained in this document serves

informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials

are provided by SAP AG and its affiliated companies ("SAP Group")

for informational purposes only, without representation or warranty of

any kind, and SAP Group shall not be liable for errors or omissions

with respect to the materials. The only warranties for SAP Group

products and services are those that are set forth in the express

warranty statements accompanying such products and services, if

any. Nothing herein should be construed as constituting an additional

warranty. .