You are on page 1of 15

How to use Web Dynpro Suspend Resume Plugs to

integrate with non-Web Dynpro web applications


Applies to:
Web Dynpro NW7.0 SP6 and above.
Note : The code samples will only work with Web Dynpro version NW7.0 SP6 and above with the
latest patch of the respective SP applied. The latest patch of all the NW7.0 SPs contains some
fixes for this functionality.

Summary
This article and sample applications demonstrates the usage of Web Dynpro Suspend Resume
functionality that comes with SAP NetWeaver 7.0.
You will learn how to suspend Web Dynpro Application, go to web application (JSP), and resume
the suspended Web Dynpro Application.
There are two sample applications, one is Web Dynpro and other is JSP. The Web Dynpro
application suspends itself and launches the web application. The web application then resumes
the suspended Web Dynpro application.

Sample Applications
You can download the ready-to-use applications here:
Serviceapp
Webclient
Webclientapp
Author: Rohit Jaiswal
Company: SAP Labs India

Author Bio
Rohit Jaiswal works at SAP Labs in the Web Dynpro Development area. His main work is
supporting the NW04 and NW7.0 releases for Web Dynpro topics like Session Management and
Value Services.

Table of Contents
Applies to: ...................................................................................................................................1
Summary ....................................................................................................................................1
Author Bio ...................................................................................................................................1
Introduction .................................................................................................................................2
Inspecting Application Properties, Suspend and Resume Plugs...................................................4
Inspecting Web Dynpro Project ................................................................................................4
Inspecting Application Properties .............................................................................................5
Inspect Suspend and Resume Plugs in Interface View .............................................................6
Inspecting the View Layout..........................................................................................................8
Inspecting Event Handlers and JSP code ....................................................................................9
Inspect Event Handler Code ....................................................................................................9
Inspect JSP Code ..................................................................................................................10
Deploying and Running Applications..........................................................................................11
Related Content ........................................................................................................................14
Copyright ..................................................................................................................................15
Copyright ..................................................................................................................................15

Introduction
The Suspend Resume functionality was implemented mainly for the use case in which the
applications needed to go to another application (not necessarily Web Dynpro) and return back to
the application resuming it, the state of the application is not lost in the sense there will be no
need for initialization, invoking back end queries for data population and so on. Prior to NW04s
there was no way to do it, that is once the application was exited through exit plug the application
state is lost and if you need to come back to the application you need to start it again.
In NW04s, there is new type of Outbound Plug called Suspend and new type of Inbound Plug
called Resume for the purpose of Suspending and Resuming Web Dynpro applications. The
Suspend and Resume functionality provides way to integrate Web Dynpro with web applications
of other technologies like JSP, Struts etc.

Web Dynpro and JSP Sample Applications.


Figure 1: Application Scenario

Start Service App

Suspend Plug with Client JSP App URL

Service App

Resume Plug
Client JSP App
3
Client JSP App invokes Resume URL

1. The Service App is launched through browser.


2. The Service App fires its suspend plug providing link to Client JSP App.
3. The Client JSP invokes the Resume URL (the resume URL is passed as HttpRequest
parameter sap-wd-resumeurl).

Fehler! Formatvorlage nicht definiert.

Figure 2: Screenshots of applications demonstrating Suspend Resume functionality


Step

Screen Shot

Start Service App and enter some


data to persist some state. Click on
Suspend and Go To WebApp
button

The Client JSP Application is


launched. Observe the Service
App URL which is passed as
HttpRequest parameter sap-wdresumeurl
Click on Go To Service App
button.

The Service App is invoked and


the state is not lost

Inspecting Application Properties, Suspend and Resume Plugs


Inspecting Web Dynpro Project
Import the Web Dynpro project Service App into your NWDS IDE workspace.
SAP DEVELOPER NETWORK | sdn.sap.com
2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com


4

Fehler! Formatvorlage nicht definiert.

Service App is simple Web Dynpro Project and contains only one Component with default View as
shown in the structure below.

Inspecting Application Properties


Select the application ServiceApp and go to the Application Properties Tab. Observe the property
sap.suspendable.application application property is set to true. By default all the application are nonsuspendable and this property need to be set true to make the application be suspendable

SAP DEVELOPER NETWORK | sdn.sap.com


2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com


5

Fehler! Formatvorlage nicht definiert.

Inspect Suspend and Resume Plugs in Interface View


Select ServiceAppInterfaceView as shown below

SAP DEVELOPER NETWORK | sdn.sap.com


2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com


6

Fehler! Formatvorlage nicht definiert.

Inspect the Resume and Suspend plugs which are of types Resume and Suspend type. See that the
Suspend Plug has parameter Url, it is created by default by the NWDS IDE when you create the
Suspend Plug. Both the plugs need to be created if you want to use the Suspend Resume
functionality.

SAP DEVELOPER NETWORK | sdn.sap.com


2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com


7

Fehler! Formatvorlage nicht definiert.

Inspecting the View Layout


Select the view ServiceCompView and inspect, the Text input field is binded to context attribute Text
of type String.

SAP DEVELOPER NETWORK | sdn.sap.com


2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com


8

Fehler! Formatvorlage nicht definiert.

Inspect the button is linked to Action SuspendAndGoToWebApp

Inspecting Event Handlers and JSP code


The next step is to inspect the application logic to suspend and go to Web Application.
Inspect Event Handler Code
The following code blocks comprise the implementation of the action event handler
SuspendAndGoToWebApp in View Controller ServiceCompView.java of Component ServiceComp.
//@@begin javadoc:onActionSuspendAndGoToWebApp(ServerEvent)
/** Declared validating event handler. */
//@@end
public void
onActionSuspendAndGoToWebApp(com.sap.tc.webdynpro.progmodel.api.IWDCustomEve
nt wdEvent )
{
//@@begin onActionSuspendAndGoToWebApp(ServerEvent)
//the URL for ClientApplication
String clientAppUrl = "/WebClient/WebClient.jsp";

// Fire the Suspend Plug of the InterfaceViewController


wdThis.wdGetServiceCompInterfaceViewController().wdFirePlugSuspend(clientA
ppUrl);
//@@end
}

SAP DEVELOPER NETWORK | sdn.sap.com


2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com


9

Fehler! Formatvorlage nicht definiert.

The above code fires the Suspend Plug passing the URL of Client JSP application.
Inspect JSP Code
Import the WebClient and WebClientApp projects into the NWDS IDE. Open the J2EE Perspective, you will
see the project structure as shown.

Select the WebClient.jsp and inspect the code


<%@ page language="java" %>
<html>
<head>
<title>
Client JSP Application
</title>
</head>
<body>
<h1>
Client JSP Application
SAP DEVELOPER NETWORK | sdn.sap.com
2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com


10

Fehler! Formatvorlage nicht definiert.

</h1>

<% String serviceAppUrl = request.getParameter("sap-wd-resumeurl");


%>
<b>Service App URL : </b><%=serviceAppUrl%>
<br>
<input type=button value="Go To Service App"
onclick="location.href='<%=serviceAppUrl%>'">
</form>
</body>
</html>
The code prints the HttpRequest parameter sap-wd-resumeurl. On click of action the ResumeURL is
invoked.

Deploying and Running Applications


Before starting deploying, your IDE should be configured to SAP J2EE Engine which you want to deploy.
In the Web Dynpro perspective, right click the Service App and select Deploy New Archive And Run as
shown below.

SAP DEVELOPER NETWORK | sdn.sap.com


2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com


11

Fehler! Formatvorlage nicht definiert.

In the J2EE Perspective, Select the WebClient Web Module, click right mouse button and select Build Web
Archive as shown below

SAP DEVELOPER NETWORK | sdn.sap.com


2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com


12

Fehler! Formatvorlage nicht definiert.

The WebClient is packaged into WebClientApp. Select WebClientApp, click right mouse button and select
Build Application Archive

SAP DEVELOPER NETWORK | sdn.sap.com


2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com


13

Fehler! Formatvorlage nicht definiert.

Expand the WebClientApp, select WebClientApp.ear click right mouse button and select Deploy to J2EE
Engine

Now you can run the Web Dynpro application and test the Suspend Resume functionality as described in the
Introduction section.

Related Content
Note: The Suspend Resume functionality should not be used inside Enterprise Portal environment,
this is only applicable for applications which run stand alone. Please refer Portal Navigation
The Suspend Resume Plugs are included in New Features in NW04s
Suspend & Resume Plugs on SAP Help Portal
Developing J2EE Applications

SAP DEVELOPER NETWORK | sdn.sap.com


2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com


14

Fehler! Formatvorlage nicht definiert.

Copyright
Copyright 2006 SAP AG. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG.
The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries,
zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix, i5/OS, POWER, POWER5, OpenPower and PowerPC are
trademarks or registered trademarks of IBM Corporation.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems
Incorporated in the United States and/or other countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of
Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts
Institute of Technology.
Java is a registered trademark of Sun Microsystems, Inc.
JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by
Netscape.
MaxDB is a trademark of MySQL AB, Sweden.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, 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 in several other countries all over the world. 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.
These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, the implied
warranties of merchantability, fitness for a particular purpose, or non-infringement.
SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may
result from the use of these materials.
SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within these
materials. SAP has no control over the information that you may access through the use of hot links contained in these materials and
does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages.
Any software coding and/or code lines/strings (Code) included in this documentation are only examples and are not intended to be
used in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules of
certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors
or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent.

SAP DEVELOPER NETWORK | sdn.sap.com


2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com


15

You might also like