Home > Part 2: Specifying parameters using a String array
Checklist:
EMAIL THIS

Part 2: Specifying parameters using a String array

15 Jul 2005

Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   

You may have noticed that the number of system parameters that can be passed as single String values to the createClient() method is somewhat limited. Largely, these connections are limited to specifying user ID, password, and the basic parameters to connect to an SAP application server. However, the JCo API allows you to pass over 30 additional system parameters to SAP! So how can you utilize these additional parameters? The simplest mechanism provided by JCo is to create a two dimensional String array and store a name/value pair as the second dimension. Through this technique, you can effectively specify any and all of the available system parameters directly within the application. Here is the code to call createClient() with a String array:
import com.sap.mw.jco.*;
...
String[][] sapParams = { {"client", "000"}, {"user", "userid"}, {"passwd", "password"},
     {"lang", "en"}, {"ashost", "mysaphost"}, {"sysnr", "00"} };

JCO.Client connection = JCO.createClient(sapParams);
...
connection.disconnect();
This is an effective method for passing dynamic values as system parameters to JCo and also allows you to use some of the more advanced user identification techniques (X509 certificates and SAP logon tickets). However, you are still faced with the challenge of maintaining hardcoded system parameters repeatedly throughout your application. A slightly better technique would be to specify these values as public final class variables then construct your String array with both those global values and any dynamic parameters you might require (see Part 1.)

GETTING CONNECTED WITH JCO

 Home: Introduction
 Part 1: Specifying parameters as single String values
 Part 2: Specifying parameters using a String array
 Part 3: Specifying parameters using an external properties file
 Part 4: Specifying parameters with a custom properties file
 Review: Conclusion and more resources


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
IT Checklists
Capacity planning checklist
How to build a business case for RFID
Part 1: Specifying parameters as single String values
Part 3: Specifying parameters using an external properties file
Part 4: Specifying parameters with a custom properties file
Integrating Java apps and SAP with the JCo API -- resources

SAP Java and J2EE
SAP CTO Sikka: SAP's innovation gets overlooked
SAP CTO expects today's SAP applications to be running in 2020
Tips on SAP ABAP
How to provide an SAP R/3 4.5B application server with a Web service interface
Consuming a Web service from an SAP 4.6c R/3 application server
SAP NetWeaver Configuration and Customization
Is C, C++ and Java knowledge required when learning SAP?
How to be a self-taught NetWeaver and ABAP expert
Getting started with a NetWeaver career
An ABAP user wants to learn XI

SAP Web applications
SAP talent management FAQ: Fresh answers to frequently asked questions
How to do additional dialog processing after SAP COMMIT WORK statement
SAP TechEd Demo Jam 2009: Winners use beer keg in demo
SAP CTO expects today's SAP applications to be running in 2020
SAP TechEd 09 keynoters: Managing change today like trying to board a speeding train
How can I get an ABAP program displaying Excel data to wrap text?
An ABAP user wants to learn XI
SAP exec discusses Imagineering, the future of development
The stars of TechEd: SAP application demos
Validating table fields

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Application Link Enabling  (SearchSAP.com)
R/2  (SearchSAP.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary




SAP Exchange Infrastructure (XI) Research Papers
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
SearchSAP.com is a search service provided by TechTarget and is completely
independent of and not affiliated with SAP AG.
  TechTarget - The IT Media ROI Experts