SAP Java Connector (JCo)
SAP's Java middleware, which enables SAP customers and partners to easily build compatible components and applications that can communicate with SAP systems using the Java language below are some notable features of Jco:
1. Support bidirectional invocation (ABAP calls Java and Java call ABAP)
2. Support for Unicode and non-Unicode encoded systems
3. The programmer encapsulates some parts that are difficult to understand and handle, such as code pages, data type conversions, connection pooling, and so on.
4. Blocking some of the details of RFC and Ddic, which allows programmers to focus on the processing of business logic without having to ignore things that are too underlying
5. Easy to learn and use the design of APIs and Java classes
6. Dynamically locating and caching metadata
Java applications use the JCO API to connect, and the RFC middleware uses the RFC library to connect to SAP's R/3 system using JNI, as shown in:
Connection process:
1. Create a connection pool Addclientpool ()
2. Create a Bor that contains metadata for all function modules in the runtime Environment Createrepository ()
3. Create a function template Getfunctiontemplate ()
4. Create function GetFunction ()
5. Remove an instance of a connection from the connection pool getclient ()
6. Set the input parameters passed to the Function module getimportparameterlist ()
7. Perform this function excute ()
8. Output parameters obtained after function execution getexportparameterlist ()
9. Destroy connection Pool Removeclientpool ()
Performance Tuning Considerations
1. Because the connections in the connection pool are reusable and can be persisted, the system overhead can be reduced, the maximum number of concurrent connections is limited to avoid excessive consumption of resources of the SAP system, however, do not use too small maximum number of concurrent connections resulting in application system performance bottlenecks, in order to accommodate the additional load caused by the application system, The SAP system has to undergo some configuration.
2. When using a new function object, it is not only more than, but also dangerous, to reuse existing function objects in order to improve performance, because JCO's repository caches metadata for each function module. If you reuse a function that contains a table parameter, and the row data in the table in the function is not cleared, more rows of data are added to the table, which can result in incorrect results, which you should be aware of when using a new function object.
3. Just use one repository object, because the repository object can dynamically re-get the metadata in the SAP function module and re-cache it, so using one is enough, if you use too many repository objects, Reduces the performance of applications and SAP systems
4. The application system only uses a small subset of the parameters in the function, in order to improve performance, you can use the SetActive () method to set the parameters that are not used by those applications to inactive, including table Parameter, Parameterlist and Jco.request objects
5. When adding multiple rows of data to a Table object in Jco, use the appendrows (int num_rows) method instead of the Appendrow () method to improve performance
Synchronization issues
To improve performance, JCO only synchronizes when accessing connection pools and repository objects, while others are asynchronous, and in multi-threaded environments, sharing objects (such as table objects) between different threads is a precaution, and a connection object cannot be shared. This causes an exception to occur exception
Reprint to http://blog.csdn.net/w5q7c3/article/details/8988982
Jco of SAP R3 and Java Exchange data