ballerina-platform/ballerina-library

Implementation of `ballerinax/sap.jco` module

Closed this issue · 3 comments

Description:
$subject

To be based on initial research #6649

Improvements for Ballerina SAP JCo Connector

We have identified several areas for improvement in the Ballerina SAP JCo connector :

  • Writing a Specification: Develop a detailed specification for the SAP JCo connector to ensure comprehensive documentation and clearer guidelines for contributors.

  • Support for Additional Parameter Types: Extend the connector to support more parameter types in import and export.

    Currently, under version 0.1.0, we have decided to support only the basic data types string, int, float, decimal as input parameter types. In future versions, we plan to implement support for more complex data types, including char[], Date, long, double, byte[], BigInteger, JCoTable, JCoAbapObject, and other object types to enhance the versatility and functionality of our system.

  • Writing Tests: Create and implement robust test cases to ensure the connector functions as expected across various scenarios.

  • Compiler Plugin for Listener: Develop a compiler plugin to enhance the listener validation, to validate attaching multiple services to a listener and service types validation.

  • Handling Transaction for RFC Develop transaction support for RFC remote module execution.

How Does the SAP JCo Listener Work?

The first step is to set up a JCo server in Java application. This server acts as a listener for incoming IDocs. Configure the server with necessary details like the program ID, gateway host, gateway service, and the SAP system that will send the IDocs.

diagram (5)

Program ID: The SAP system uses the Program ID to identify the JCo server. This ID must be unique and configured in the SAP system's RFC destination settings.

RFC Destination: In the SAP system, an RFC destination is created that points to the JCo server using the Program ID. This RFC destination is used by SAP to send the IDocs to the JCo server. This is different from jco.client.repository_destination, which is used by the SAP JCo program to make RFC requests to the SAP system. In this case, the SAP system registers the JCo Server as the repository destination.

Implementing IDoc Listener:

IDoc Server Factory: SAP JCo provides an IDocServerFactory that allows the creation of an IDoc server instance. This server listens for incoming IDocs.

IDoc Handler Implementation: You need to define the method handleRequest(IDocDocumentList idocDocumentList). This method is invoked when an IDoc is received, allowing you to process the IDoc within it. In our case, the IDoc is converted to XML.

Starting the JCo Server: Once the configuration is complete and the IDoc handler is implemented, the JCo server can be started.

The SAP system may expect an acknowledgment after an IDoc is successfully processed. This acknowledgment can be sent back to the SAP system using the JCo server.

The 1.0.0 version of the connecter was released after testing its RFC and iDoc functions with the real system.

Closing since all mandatory requirements of the connector were fulfilled. Identified further improvements are tracked under this issue: #6973 .