Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 

Creating External Library and Using in DC  

Version Details:

SAP Net Weaver Developer Studio (NWDS) version
7.01.00 and SAP Web Application Server (WAS) version 7.0.

Summary:

In this tutorial you learn how to use jar files in a Development Component (further referred as DC) using External Library. Since jar files added during development in class path are not deployable part of the DC so to make the jar files available at server end we are supposed to use External library.

Author: Amritesh Kumar

Company:  Tata Technologies Limited (Pune)

 

Introduction

This tutorial shows you how to use create an External Library and use it with a DC

Prerequisites 

• Basic Java Programming 

• Basic Web Dynpro Hands-On experience about DC creation & Public Part

• We are creating the External Library on DTR and steps contains DTR activities so you must be logged in to DTR

Implementation 

Create Web External Library Project

Step 1: Create a Library Project with the name “ExtLib”.

Click on next, now if you are logged in to DTR activity window will appear.

Crate a new activity and click on ok button.

Activity is created now select the activity and click on ok button.

Step 2: Adding Jar Files

Open Navigator perspective (since it will not be visible in Web Dynpro Explorer) and explore the External Library project.

Now copy all the required jar files & paste in the “libraries” folder of the “ExtLib” project.

A window will appear asking add the jar to DTR. Select All & click on ok.

Select the Activity & click on ok.

Step 3: Create Public part & adding jar files to the public part.

 

Switch to Development Configuration Perspective.

  If it is not available there open from 

                 Window -> Open Perspective -> Other…

A window will appear, select Development configurations & click on ok.

Step 3.1

Now the following screen will appear.

Explore the “ExtLib” project & select “PublicParts”.

Now right click on this and click on “New Public Part”.

Now “Add Public Part” wizard will appear on the screen:

Select the first radio button (default it is selected).

Fill the “Name” caption & description are optional & click on finish.

Now it will ask again to add the files to DTR select the activity & ok.

Repeat Step 3.1 Step again, this time select second radio button of “Add Public Part Wizard”.

Give the “Name” and then finish & add the files to DTR again in the same activity.

Now again switch to Navigator perspective.

Select a jar file and right click on it and click on and select

           Development component -> Add to Public Part

Now following window will appear in which both the “Public Parts” we have already created will appear

Select the “Compilation” & click on ok.

So now the jar file is added to Compilation public part.

Like this add all the Jar files to both Compilation & Assembly Public parts.

Step 3: Build & Check in the External Library

Now again open the “Development Configurations Perspective”.

Select the “ExtLib” Project, right click & build another Build Development component window will appear select the project & click on ok.

   

Finally check in the activity by clicking on check in and the click on ok button of the check in popup.

 

External Library Created Successfully

Create New DC & Use External Library

Step 1: Create new DC

Since we assume that you have basic idea of creating DC we will just go through

 

Create a new DC

     File -> New Development Component

Select the track on which you want to create DC.

Give the Name of DC & Select the type WebDynpro & complete the wizard.

 

We have take DC name “Candidate” Inside a view we will write some test code for accessing KM resources which requires some jar  files which are available in our “ExtLib”.

Since we have not add external lib in our DC it will give error for imports

Step 2: Add External Library to our DC

Expand “Candidate” DC

DC MetaData -> DC Definition -> Used DCs

Now right click on “Used DCs” & click on “Add Used DC”

Click on “Add Used DC” it will ask for the activity.

Select the activity which we have already created during “Candidate” DC creation & click on ok.

“Add Dependency” window will appear.

Select the “Inactive” tab since our library is now activated up till now.

Now select the “ExtLib” explore it and inside “Public Parts” select both the public part “Assembly” & “Compilation” keep the dependency type build time & click on “Finish” button.

After adding used DC it will be showing in your use DC

Now right click on “Candidate” DC -> Development Components -> Sync used DCs

Step 3: Build the DC

It is strictly compulsory to build the DC only by the option “Build” which is available in

Right Click on DC “Candidate” => Development component => Build

Now you will find that errors showing imports are resolved now.

Step 3: Deploy the DC

It is strictly compulsory to “Deploy” the DC only by the option “Deploy” which is available in

Right Click on DC “Candidate” => Development component => Deploy

Note: If you use normal build & deploy option the external
library not gets deployed on server and will not be available to your DC.

So always use DC build & Deploy option.

5 Comments
Labels in this area