Top Banner
How to Create an Online Mobile Application with SAP Web Dynpro
35

How to Create an Online Mobile Application with SAP Web Dynpro

Feb 03, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: How to Create an Online Mobile Application with SAP Web Dynpro

How to Create an OnlineMobile Application with

SAP Web Dynpro

Page 2: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 2

Introduction

In this tutorial, an online application using SAP Web Dynpro iscreated.

First, a simple web application is created and shown on a browser,either on a laptop or a mobile device.

This application is then extended so that it connects to a backendSAP R/3 system.

The application compiles a list of contact names from partnerorganisations. This is displayed in the top part of the browser.

On clicking on a partner or a contact name, the contact details areshown in the bottom half of the table.

Let‘s start with the first part of the application ....

.... a simple web application.

Page 3: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 3

Simple Web Application

Create a new WebDynpro Projectfirst.

Page 4: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 4

and give it a name.

Page 5: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 5

Web Dynprocreates the projectand some newnodes in theproject explorer.

Page 6: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 6

Create a newcomponent with aright mouse click.

Page 7: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 7

and give it a name.

Page 8: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 8

Web Dynpro automatically creates some more nodes and adefault view.

Page 9: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 9

A default View was created with a UI element (user Interfaceelement) showing a title. The text can be edited in the lowerproperties panel.

Page 10: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 10

With a right mouse click on the applicationnode. The application is deployed to the SAPWeb Application Server. A PC browser or asimulator can be used to test the application.

Copy the url into a mobile device browser tosee your first mobile application.

You have just created your first Web Dynproapplication.

Page 11: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 11

Extend the application to connect to backend SAP R/3

You can develop the application youhave just created to access data froma backend SAP R/3 system

Start by adding a new View. Add anOutbound Plug to the view of the mainmenu and an Inbound Plug to the newview using drag and drop.

Page 12: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 12

Right mouse click on theoutbound plug to show acontext menu. Create anavigation link and choose theinbound plug of the new viewas the target.

The navigation is showngraphically.

Page 13: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 13

The Views are linked. But we need a button for the user fornavigation. A right mouse click gives you the option to apply atemplate to the view.

Page 14: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 14

Choose an Actionbutton.

Page 15: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 15

Give it a label and fire the Plug forthe new view.

Page 16: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 16

The button is displayed in the view.

Page 17: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 17

The user gets abutton and is ableto navigate.

Please note thatyou have notentered one line ofjava code so far.

Page 18: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 18

Now it is time to create a connectionto the backend R/3 system to requestdata.

Create a new model with a RFC(Remote function call to a SAPsystem) or choose a connection viaWeb Services to any other backendsystem.

Page 19: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 19

In the next step, enter theconnection information, andconnect to the backendsystem.

Page 20: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 20

Search for theremote functionmodule you want tocall ...

Page 21: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 21

and select it. All the neededjava classes and dictionaryentries are created by WebDynpro, and this give you aframeset to work with thedata.

Page 22: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 22

Use the new model in the component.

Page 23: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 23

Request

Response

As a reminder …. Model View Controller (MVC)

Controller

Model

View

Defines application dataUsually connected tobusiness functionality

Defines application dataUsually connected tobusiness functionality

Visualizes the applicationdataVisualizes the applicationdata

Handles eventsUpdates application dataDefines control flow

Handles eventsUpdates application dataDefines control flow

Page 24: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 24

Double clicking on the component you will seethis MVC-concept for your application

Page 25: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 25

Drag and drop a connection between the ComponentController and the model.

Page 26: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 26

This opens a wizardshowing parts of the rfcwhich can be used.

Page 27: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 27

including the fields.

Page 28: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 28

On completing the wizard, a connection between thecomponent controller and the model is shows graphically

Page 29: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 29

Proceed in the same manner to connect the view,which will show the data, and the ComponentController.

Page 30: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 30

Jump to the view which willshow the data and apply atemplate to display the data asa table.

Page 31: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 31

In the wizard, mark the fieldsto be displayed. Finishing thewizard creates a table in theview.

Page 32: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 32

Proceed in a similarmanner to add somefields for a detailview of the selectedbusiness partner inthe table.

Page 33: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 33

Now a little bit of java code is required to initialize the function call, to bindthe data and to catch exceptions. Place the code shown below in the wdInitmethod of the controller.

Alm_Merep_070_Getlist_Input materialInput = new Alm_Merep_070_Getlist_Input();wdContext.nodeAlm_Merep_070_Getlist_Input().bind(materialInput);

try {materialInput.setUser("AHLAND");materialInput.execute();wdContext.nodeOutput().invalidate();

}catch (Exception e) {

wdComponentAPI.getMessageManager().raiseException("BAPI Call failed "+e.toString(),false);

}

Page 34: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 34

Deploying the application shows youa list of business partners. Clickingon a row automatically changes thedetail view in the lower part of thepage.

What is going on? Clicking on a newrow fires a round trip to the serverand changes the current selection.The detail view shows the currentselection which is updatedautomatically.

Page 35: How to Create an Online Mobile Application with SAP Web Dynpro

SAP AG 2004, SAP NetWeaver Mobile, Karin Schattka / 35

On a Blackberry it could look like this.