Jco for data exchange between R3 and Java

Source: Internet
Author: User

 

SAP Java connector (jco)

SAP's Java middleware allows sap customers and partners to use the Java language to easily establish compatible components and applications that can communicate with the SAP system. Below are some notable features of jco:

1. Support two-way call (ABAP calls Java and Java calls ABAP)

2. Support for Unicode and non-unicode encoding Systems

3. encapsulated some difficult-to-understand and process parts for the programmer, such as the Code Page, data type conversion, and connection pool.

4. Some details of RFC and ddic are shielded, so that programmers can focus on the processing of business logic without having to ignore the underlying things.

5. Easy-to-learn and use API and Java class design

6. Dynamic Searching and caching of metadata

Java applications are connected using jco APIs. RFC middleware uses the RFC library to connect to the sap r/3 system through JNI, as shown in:

Connection process:

1. Create a connection pool addclientpool ()

2. Create a bor that contains the metadata of all function modules in the runtime environment createrepository ()

3. Create a function template getfunctiontemplate ()

4. create function getfunction ()

5. retrieve a connection instance getclient () from the connection pool ()

6. Set the input parameter getimportparameterlist () passed to the function module ()

7. Execute this function excute ()

8. Get the output parameter getexportparameterlist () after the function is executed ()

9. Destroy the removeclientpool () of the Connection Pool ()

Performance optimization considerations

1. because connections in the connection pool are reusable and retainable, the system overhead can be reduced. The maximum number of concurrent connections does not occupy too many SAP system resources. However, do not use a small maximum number of concurrent connections, which may cause the performance bottleneck of the application system. In order to accommodate the additional load caused by the application system, the SAP system must undergo some configuration.

2. when using a new function object, reusing existing function objects to improve the performance is not only more, but also dangerous, because jco's repository caches metadata for each function module, if you reuse a function that contains table parameters, and the row data in the table in this function is not cleared, more row data will be added to this table, resulting in incorrect results, note This when using a new function object.

3. you only need to use one repository object. Because the repository object can dynamically obtain the metadata in the SAP function module and re-cache it, it is enough to use one. If too many repository objects are used, will reduce the performance of the application system and SAP system

4. the application system only uses a small part of the function parameters. To improve performance, you can use the setactive () method to set the parameters that are not used by those applications to a non-active state, including table parameter, parameterlist, and jco. request object

5. When adding multiple rows of data to the table object of jco, use the appendrows (INT num_rows) method instead of the appendrow () method to improve the performance.

Synchronization problems

To improve performance, jco only synchronizes access to the connection pool and repository objects. Other operations are asynchronous. In a multi-threaded environment, objects (such as table objects) are shared between different threads) it is worth noting that, and a connection object cannot share access, which leads to exception.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.