Have you ever been stopped in your development because the framework did not fit all the components or libraries required? An example of this issue could be an application written in java for a WAS requiring libraries for exporting data collections to an excel format; does your WAS have these libraries from factory settings? And what about mobile environments with such limited and hard to understand frameworks they are uncommon-emerging technologies?
This blog shows you how to solve these kinds of issues, this means, how to use external libraries on your custom app. for mobile client 7.1 (handhelds and laptops).
Step by step solution:
Part I – Creating an External Library DC
1. Create am External Library DC Component
2. Fill the required fields (vendor and name) and press the Finish button.
3. The system will ask you to switch the perspective, press Yes (if the system did not ask you, switch to the Resource perspective anyway).
4. Locate the desired library (.jar file) on your hard drive and copy it (yes, like a traditional copy and paste) and past it into your project libraries folder. For this example we will use the crimson and jaxp jars files.
5. Switch the Development Infrastructure perspective, under the component browser, select your development component, after that you might see in the right side the component properties view, select the Public Parts tab.
6. Add a new public part for sharing your libs to others DCs, fill the required fields (name and purpose). Always set COMPILATION purpose.
7. Right click on your new public part and select the Manage Entities option.
8. Expand the Archive option, check the desired libraries and finish.
9. Right click on the root project folder and select the build option.
After these steps your external library will be ready to use in your DCs projects. Remember the step number 6, we chose COMPILATION purpose, this means that the public part will be used just for compilation and not for execution purposes. In our case, we will include these libs manually on the application container (SAP Mobile Client 7.1). Just copy and paste the required jars into the lib folder of your mobile client installation and reboot it (stop and start for laptop mobile clients or warn reboot in handhelds environments).
Part IU – Using external libraries in your DC application
1. Create a new DC type WebDynpro (mobile for handheld, mobile for laptop or traditional WebDynpro). For us, we will develop a handheld Mobile UI Component. Fill the required fields (Vendor and Name).
2. Next step is to add dependencies to the WebDynpro DC. Check that you are in the Development Infrastructure perspective, select the Dependencies tab under the Component Properties view and press the Add button.
4. Find and select the external library from the list of DCs to be referenced to, check it and press the Next button.
5. On the configure dependencies window, just leave checked the runtime option for the root node (external_lib [test.cts.com]) and click finish.
Now your WebDynpro project is ready to use the external libraries, just include the required imports, write your java sentences, build and deploy your DC. Remember that we just selected the COMPILATION purpouse for the external library DC, and you have to include the jar files into the lib folder.
Hope you enjoy – comments are most welcome,