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

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
Conclusion and more resources

SAP Java / J2EE
The difference between an SAP system and a non-SAP system
Is C, C++ and Java knowledge required when learning SAP?
Getting started with a NetWeaver career
How to be a self-taught NetWeaver and ABAP expert
An ABAP user wants to learn XI
Select Text fields: Case-insensitive
Finding BADIs you can use
Quiz: SAP ABAP development
Is this the quickest way to find a BADI?
Easily debug error messages in SAP processes

SAP Web Applications
The difference between an SAP system and a non-SAP system
Is C, C++ and Java knowledge required when learning SAP?
An ABAP user wants to learn XI
Select Text fields: Case-insensitive
Finding BADIs you can use
Quiz: SAP ABAP development
SAP exec discusses Imagineering, the future of development
Is there a 'load of program' option in report generation?
Deleting entries from a dynamic table
Defining a structure in a report

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


HomeNewsTopicsBlogsTipsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2000 - 2008, 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