ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
136 stars 58 forks source link

Implementation of `ballerinax/sap.jco` module #6650

Closed niveathika closed 1 day ago

niveathika commented 2 months ago

Description: $subject

To be based on initial research https://github.com/ballerina-platform/ballerina-library/issues/6649

RDPerera commented 1 month ago

Improvements for Ballerina SAP JCo Connector

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

RDPerera commented 3 weeks ago

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.

RDPerera commented 1 day ago

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: https://github.com/ballerina-platform/ballerina-library/issues/6973 .