how to reference external jar files in web dynpro dc in sap nw
TRANSCRIPT
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 1
How to Reference External JAR
Files in Web Dynpro DC in SAP NW
Portal 7.3
Applies to:
SAP NetWeaver Portal 7.3, NWDS 7.3. For more information, visit the Portal and Collaboration homepage.
Summary
This article describes how to add external JAR files to an External Library DC and reference it in Web Dynpro DC during Compilation and Runtime.
Author: Pavithra Upadhya
Created on: 10 October 2011
Author Bio
Pavithra Upadhya is working as an SAP Enterprise Portal Consultant over the past 6 years.
How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 2
Table of Contents
Requirement ....................................................................................................................................................... 3
Pre-requisite........................................................................................................................................................ 3
Procedure ........................................................................................................................................................... 3
Create External Library DC ............................................................................................................................. 3
Create Enterprise Application DC and add External Library DC as Used DC ................................................ 5
Create Web Dynpro DC .................................................................................................................................. 8
Related Content ................................................................................................................................................ 11
Disclaimer and Liability Notice .......................................................................................................................... 12
How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 3
Requirement
This document provides a step-by-step procedure in creating an External Library DC which contains the external JAR files. This External Library DC will then be added as Used DC in Web Dynpro DC.
Pre-requisite
NWDS 7.3, NetWeaver Portal 7.3
Procedure
Create External Library DC
1. Create an External Library DC (say, sample/extlib) as follows:
How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 4
2. Once the DC is created, navigate to 'Resources' perspective and add the following JAR file to
"libraries" folder of the External Library DC created:
a. jxl.jar
3. Right click on the DC and choose Development Component -> Show In -> Component Properties.
Go to "Public Parts" tab and create 2 Public Parts of type "Compilation" and "Assembly"
4. Right click on the JAR files under libraries folder and select Development Component -> Publish as
File and add to Assembly Public Part. Similarly select Development Component -> Publish as
Archive and add to Compilation Public Part
How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 5
5. In the "Permissions" tab, select the checkbox 'Entity Forwarding allowed'
6. Build the External Library DC
Create Enterprise Application DC and add External Library DC as Used DC
1. Create an Enterprise Application DC (sample/extlibear) as follows:
How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 6
2. The DC is now available in Java EE perspective as shown below:
3. Right click on the DC and choose Development Component -> Show In -> Component
Properties. In the "Dependencies" tab, add the Assembly Public Part of External Library DC as used
DC with 'Build Time' dependency for the Public Part extlib_assembly
How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 7
4. Create Assembly Public Part for the enterprise application DC. Right click on the public parts and
select "Reference Entities" and add the assembly public part of External Library DC
5. In the "Permissions" tab, select the checkbox 'Entity Forwarding allowed'
6. Build and Deploy the Enterprise Application DC
How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 8
Create Web Dynpro DC
1. Create a Web Dynpro JAVA DC (sample/wd) as follows:
2. The DC is now available in Web Dynpro perspective as shown below:
How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 9
3. Right click on the DC and choose Development Component -> Show In -> Component
Properties. In the "Dependencies" tab, add the Compilation Public Part of External Library DC and
Assembly Public Part of Enterprise Application DC as used DCs with "Build time" dependency for the
public parts.
4. Build the Web Dynpro JAVA DC
5. In the Component Controller of WebDynpro DC, write the code to download data to excel. The
classes are recognized as shown below:
How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 10
6. Build and Deploy the Web Dynpro DC
7. On running the Web Dynpro application, the jxl jar is correctly recognized during runtime as well
How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 11
Related Content
How to use external JAR files in Web Dynpro development components?
How to use external libraries in the SAP component model (PART II)
For more information, visit the Portal and Collaboration homepage
How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 12
Disclaimer and Liability Notice
This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.