Below code snip can be used to copy one KM folder and its subfolders to another location.
Note:
1. The destination folder shouldn’t exist before the copy. Otherwise the copy method will raise an exception.
2. The source folder display name are copied too. It might need to be changed if necessary.
String source = ";/documents/source";;
String destination = ";/documents/destination";;
try {
//1. Create a RID
RID aRid = RID.getRID(source);
logger.errorT(aRid.getPath());
//2. Get Resource Factory
IResourceFactory resourceFactory = ResourceFactory.getInstance();
//3. Get user and resource context
com.sapportals.portal.security.usermanagement.IUser user =
WPUMFactory.getServiceUserFactory().getServiceUser(";cmadmin_service";);
ResourceContext rContext = new ResourceContext(user);
//4. Retrieve the collection for Resource using the resource context
IResource aResource = resourceFactory.getResource(aRid, rContext);
//5. Get Destination RID
RID dRid = RID.getRID(destination);
logger.errorT(dRid.getPath());
IResource dResource = aResource.copy(dRid, new CopyParameter());
dResource.setProperty(new Property(PropertyName.createDisplayname(), ";destination";));
logger.errorT(";After Copy";);
} catch (ResourceException e) {
logger.errorT(";ResourceException INSIDE copy(): "; + e.toString());
} catch (UserManagementException e) {
logger.errorT(";UserManagementException INSIDE copy(): "; + e.toString());
}
wdControllerAPI.getComponent().getMessageManager().reportSuccess(";Files are copied successfully.";);
Debugging is the very helpful tool to allow the developer to figure out the issues. SAP NWDS provides support when debugging your Web Dynpro applications. By making special settings for the server process of the J2EE Engine and setting breakpoints, you can interrupt the execution of your application and go through it step-by-step. The following steps give your a step-by-step tutorial of Web Dynpro Java debugging.
Step 1. Enable the server node debugging using the SAP Config Tool.
Read more…
There are three UI elements about radio button in Web Dynpro – RadioButton, RadioButtonGroupByIndex and RadioButtonGroupByKey. I try to show how to use each of them in a test Web Dynpro application.
Radio Button
The RadioButton UI element is a button with two states (on/off) that enables users to select options. The RadioButton allows to spread the displayed radio buttons individually on the screen instead of grouping them in a table. You can toggle the radio button when you
bind the UI elements to the same context attribute.
There are two important properties of this UI element.
KeyToSelect
This property specifies the value of the key used to select this radio button. You can use the constant for each radio button.
SelectedKey
Specifies the path of the context attribute that stores the selected key. All the radio buttons bind to the same context attribute logically belong to the same group.
Read more…
The sorting functionality of Table in Web Dynpro Java is not enabled by default. The programmer needs to follow below procedures in order to make the table sortable. There is an onSort event of Table UI element. Event onSort is triggered if the user clicks a column header.
There are several event parameters can be mapped into action handler parameters. All these event parameters are defined as the constants in the inner class – IWDTable.IWDOnSort.
NODE_ELEMENT – Name of the implicit event parameter nodeElement
COL – Name of event parameter col. The id of the column to be sorted.
DIRECTION – The direction in which the sorting has been requested.
MUILTPLE – Indicates that the supplied column should be sorted additional to the previously existing sorting. Type boolean.
Read more…
This post will collect the popular Q&As for Web Dynpro Development. I try to update this post as frequent as possible:-)
1. How to add SAP icons in the Web Dynpro UI elements like button, image?
You can find my another post – Web Dynpro – Use Icons on how to add sap standard icons. If you can access the web application server remotely, you can find all these SAP icons gif files from file system usrsap<System ID><System No>j2eeclusterserver0tempwebdynprowebsap.comtc~wd~dispwdaglobalsapIcons’.
2. Where can I find a list Web Dynpro API?
From here, you can find the public Web Dynpro API documentation.
ABAP is a 4 generation programming language created by SAP which is used to build most of SAP business applications. In the latest Tiobe index, it is ranked as the 34th popular programming language. The ABAP development concept is slightly different than other programming language.
Below diagram shows a the typical development concept of SAP Java.
Read more…
I tried to find out the technical details of Web Dynpro framework, but I didn’t find any official documentation on it. I just write down my own understanding on Web Dynpro Framework in this post.
What the Web Dynpro Framework is?
Web Dynpro Framework is just another web framework like Struts, WebWork and other open source web framework in the Java community.

Read more…
Why need JDBC Data Source?
In the J2EE development, the application needs to persist business data into a database. In SAP world, the data can be stored in the ABAP database through RFC calls. Another data repository is the Java database through the SAP Java persistence infrastructure.
During the SAP server installation, a default datasource is set up and intended to be used by all the SAP applications. You can create a new datasource aliases for your application in order to use the default datasource. Besides, you can create a new datasource in order to have a application specific configuration.
How to Administrate JDBC Data Source?
Read more…
The JVM (Java Virtual Machine) is an abstract computing machine which is used to execute Java instruction set in the class file. Likes a real computing machine, it has an instruction set and manipulates various memory areas at run time. Generally, there two subsystems in the JVM – the class loader engine and the execution engine. This post try to explain the memory structure in the execution engine. As below figure shows there are five memory area in the runtime data area.
Read more…
The database connection for SAP J2EE engine is created during the AS Java installation. The database user SAP<SID>DB, password and db server connection string is stored in the secure storage file, located at usrsap<SID>SYSglobalsecuritydataSecStore.properties in the installation folder.
These DB information as well as the default administrator user can be maintained using Config Tool (Execute <AS_Java_install_dir>configtoolconfigtool.bat). Start the Config Tool and select secure store. The configuration for the secure storage in the file system appears.
Read more…