Entering content frame

Procedure documentation Utilizing the IWDCachedWebResource-API Locate the document in its SAP Library structure

How can we provide the Web Dynpro application UI with a dynamically generated XML file? The solution is based on the Web Dynpro Binary Cache service which can be used for storing dynamically created binary data of various MIME types and for addressing it via a unique, automatically generated URL. The Web Dynpro programming model API provides the following related classes and interfaces:

...

       1.      WDWebResource: Web Dynpro service class for accessing instances of the type IWDWebResource or IWDCachedWebResource. It provides methods for accessing deployed Web resources of the type IWDWebResource (applications, MIME files) and for creating cached Web resources of the type IWDCachedWebResource. A Web resource belongs to a deployable object part, like Web Dynpro components and applications.

       2.      IWDWebResource: Interface representing a deployed Web resource used by a Web Dynpro application. A Web resource belongs to a specified deployable object part and has a specific name and MIME type (for example, a Web Dynpro application or an image, which is stored in the src/MIMEs/Components/<a component> folder and is deployed with the project archive). It is possible to associate name/value pairs with the Web resource and generate the URL that points to it. The generated URL then contains the specified name/value pairs as URL parameters.

       3.      IWDCachedWebResource: Extends the interface IWDWebResource. Cached Web resources are stored in the Web Dynpro Binary Cache. They can be created at runtime by calling the method WDWebResource.getWebResource().
In this article, we store the generated Excel file within the Web Dynpro Binary Cache as a cached Web resource.

This graphic is explained in the accompanying text

The private method getCachedWebResource() returns a cached Web resource for the given byte array, name, and MIME type (WDWebResourceType). It uses the WDWebResource service class for storing the Excel resource in the Web Dynpro Binary Cache and automatically generates a unique URL for it. The resource name must be set using the IWDCachedWebResource API.

 

Component Controller ExcelExportComp.java in Component ExcelComp

//@@begin others

/**

 * Create cached Web Dynpro resource for given byte array, file name, and

 * Web resource type.

 * @return Excel file as cached Web Dynpro Web resource. 

 */

private IWDCachedWebResource getCachedWebResource(byte[] file, String name,

  WDWebResourceType type) {

  IWDCachedWebResource cachedWebResource = null;

  if (file != null) {

    cachedWebResource = WDWebResource.getWebResource(file, type);

    cachedWebResource.setResourceName(name);

  }

  return cachedWebResource;

}

//@@end

Next Step …

Managing the ExcelLinkPopup Window

 

Leaving content frame