KM(Knowledge Management) provides a central, role-specific point of entry to unstructured information from various data sources in the portal. It also provides a set of API to allow other applications to use KM functions.
Below are the steps on how to use KM API in web dynpro application.
Step 1. Go to web dynpro project properties and select ‘Java Build Path’.
Read more…
The Javamail API provides a platform-independent and protocol-independent framework to build mail and messaging applications. The JavaMail API is available as an optional package for use with Java SE platform and is also included in the Java EE platform.
Below two JAR file is needed to send emails in the web dynpro application:
mail.jar – 1.2
activation.jar – 1.0
You can download these jar files in oracle web site – www.oracle.com. For how to use the external library, please refer to Web Dynpro Java – use external library.
Below codesnip shows how to send email using JavaMail API. This logical can be called in any place of web dynpro application to send email notification. In the intranet environment, the SMTP server doesn’t require the authentication, but in the internet, the authentication is required. You need to add the authentication check logic according to your SMTP setting. The default SMTP port is 25.
Read more…
Download business data as a excel file is critical for business users to view,modify and manipulate the data freely. In this example, I use Apache POI to generate the excel file in web dynpro application.
The Apache POI Project’s mission is to create and maintain Java APIs for manipulating various file formats based upon the Office Open XML standards (OOXML) and Microsoft’s OLE 2 Compound Document format (OLE2). In short, you can read and write MS Excel files using Java. In addition, you can read and write MS Word and MS PowerPoint files using Java. For more information, please visit the official home page – http://poi.apache.org/.
Current stable version of POI is 3.6, but it requires JDK 1.5 and higher version to use it. Because NW7.0 is based on JDK 1.4.2, I have to choose POI version 3.2.
For more information on how to use external library, please refer to my another post – Web Dynpro Java – use external library.
Read more…
During the web dynpro development, the developer might need to utilize external libraries to realize some specific activities, such as generating excel files, sending emails. Generally there are two methods to adding the external library into the web dynpro application.
1. Package the external libraries into the web dynpro application
Below steps works well in NW7.0. I didn’t test it in NW CE7.1 and not sure whether it works or not in NW CE7.1.
Read more…
I have been working in SAP Java world for several years. As per my experience, it is difficult for newcomers to start working on SAP Java field. There are many new terminologies and technologies that always freak out people at the beginning especially those aren’t familiar with Java language. I would like to share my limited experience with everyone on how to go through this tough period and become a senior developer.
1. Java Language
Before you begin to study any SAP specific Java technologies/tools, Java language is a fundamental thing that you must have a good command of. This not only means Java syntax and grammar, it also contains other aspects you need to know in order write a high quality codes. Below is a check list.
a. Java Syntax and Grammar
b. Java programming standards
c. J2SE API – I/O, Email, JDBC, etc.
d. J2EE programming – JSP/Servlet, EJB, Web Service, etc.
e. Write, compile, deploy and run Java application using an IDE like eclipse/netbeans.
Read more…
I didn’t maintain my SAP blog since I was assigned to a SAP NetWeaver Project. My previous SAP projects are all about the SAP Business Suite implementation such as ERP, CRM, SRM, etc. Although I learned Java in university and implemented a couple of web tools using Web Dynpro for Java, this project was a big challenge to me. After several months hard-working, the project goes on very well and aims to go-live next month. Finally I get some free time to update my blog and will share my experience on SAP NetWeaver development.
In my opinion, this is not a typical SAP implementation project. It’s more like a Java project which utilizes SAP NetWeaver platform. Because of this, the development strategy is different from SAP ERP implementation project. Below diagram shows the difference between the traditional SAP implementation project and the NetWeaver project which try to build the custom solution from scratch.
Read more…
There are many web applications delivered by SAP for solution manager. These applications can be easily integrated into the Enterprise portal and provide web base access for all the business users. I summaries these applications into below three categories according the technologies it uses.
ITS based web applications
The ITS (Internet Transaction Server) is the essential link between SAP systems and the Internet. It is the first generation web technology of SAP.ITS translates the dialog protocol of SAPGUI into the internet protocol like HTTP.
You can access the default SAP WebGUI use below URL pattern: http://solutionmanagerhost /sap/bc/gui/sap/its/webgui?sap-client=XXX.All the transactions can that marks SAPGUI for HTML can be viewed in the browser.

If you want to adapt the default web UI, please follow my another blog SAP WebGUI Introduction.
Read more…
Download file is a common requirement in custom web dynpro application. As we all know, in web dynpro we cannnot direct enter html code. Everything is hidden behind the model which designed using NWDS. Web dynpro provides an UI element named ‘FileDownload‘. Below is the steps for how to use FileDownload in web dynpro.
Step 1. Create needed value node and value attribute.
Create a new value node named ‘Resource’ and an value attribute named ‘resource’. The value attribute has the type of ‘com.sap.ide.webdynpro.uielementdefinitions.Resource‘. Then bind this attribute to the FileDownload UI element.

Step 2. Initialize the the value attribute.
You need to initialize the resource attribute before showing the FileDownload element. In a common case, the file content is read from the SAP backend system, like ERP, Solution Manager, etc. A function module should be created in the backend system. The remote function module stores the file content in an internal table with type RAW. The ABAP dictionary type RAW will be mapped to java build-in type binary when import the RFC into a web dynpro model.
Below code is used to initialize the resource attribute.
//get the file content from backend system
wdThis.wdGetProj_evalController().executeZ_Get_Doc_Content_Input(classID , objID);
//put all the file content in a byte array.
byte[] binFile = new byte[0];
for(int n = 0; n <; wdContext.nodeFile_Content_Binary().size(); n++){
binFile = concat(binFile, wdContext.nodeFile_Content_Binary().getFile_Content_BinaryElementAt(n).getLine());
}
//initialize the resource attribute
if(wdContext.nodeE_File_Attr().size() >; 0){
String filename = wdContext.nodeE_File_Attr().currentE_File_AttrElement().getFile_Name();
String fileext = "";
if(filename.lastIndexOf(".") >; 0){
fileext = filename.substring(filename.lastIndexOf(".") + 1 , filename.length());
fileext = fileext.toUpperCase();
}
//reset the file name
filename = wdContext.nodeEt_Saeval_Str().currentEt_Saeval_StrElement().getTitle_Dbl() + "." + fileext.toLowerCase();
wdContext.nodeGlobal_Variant().currentGlobal_VariantElement().setFilename(filename);
ByteArrayInputStream bais = new ByteArrayInputStream(binFile);
WDWebResourceType resourceType = WDWebResourceType.getWebResourceTypeForFileExtension(
fileext);
if(resourceType != null){
wdContext.nodeResource().currentResourceElement().setResource(
WDResourceFactory.createResource(
bais,
filename,
WDWebResourceType.getWebResourceTypeForFileExtension(
fileext),
false));
}
After completing above code, the FileDownload can be used to download file.
In the ABAP program, we can use ABAP statement to show the error, warning or information message to the user. In Web dynpro for Java, It is also very convenience to handle the message.
Step 1. Add the message in the message pool under your component.
There are for message types: standard, warning, error, text. If you want to add the parameter in the message text, you should put parameter holder like {0},{1}. After add the message to the message pool. The NWDS will automatic generate a java class like ‘IMessage<component name>’.

Step2. After add message, you can report the message using below Java code in the method.
IWDMessageManager manager = wdComponentAPI.getMessageManager();
//if some condition meets
if(...){
manager.reportMessage(IMessageProj_eval.MISS_PARAMETER,
new Object[]{"Project Id"},
true);
return false;
}
You can also create corresponding properties files for other language. The web dynpro will automatic choose the language according to the language setting in your browser.
In some case, we need to pop up a new window to show some more data. Here, I will introduce how to pop up a new window using web dynpro Java.
Step 1. Create a new window in your WD component.

Step 2. Embeded a view or viewset in the widow.
Step 3. Create a new value node and value attribute.
This value node is used to store the reference to the window instance. The value attribute should be the type of ‘com.sap.tc.webdynpro.services.session.api.IWDWindow‘.
Step 4. Add code to pop up a new window in an action.
Add below code to your action to show your pop up window.
//show the pop up window
IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("Download");
IWDWindow myWindow = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
wdContext.currentPopUpElement().setDownLoadWindow(myWindow);
myWindow.setWindowSize(300 , 80);
myWindow.setWindowPosition(WDWindowPos.CENTER);
myWindow.show();
In the pop up window, there is a close button to close current pop up window. You should add below code to the close action.
wdContext.nodePopUp().currentPopUpElement().getDownLoadWindow().destroyInstance();
Now everything is ready. You can use the pop up screen in your own web dynpro applicaiton. Enjoy it:-)