Skip to Content
0
Jun 11, 2020 at 10:57 AM

ABAP to JAVA remote call failing with CALL_FUNCTION_REMOTE_ERROR

117 Views Last edit Jun 11, 2020 at 10:58 AM 2 rev

Hi I am working on an Integration and using SAP Jco, I have created a Jco server which is up and running, Configured the RFC for this Jco server and tested the connection it works fine. now I am invoking a function from ABAP code using this RFC but it fails with CALL_FUNCTION_REMOTE_ERROR.

I am referring this blog for my Jco server https://blogs.sap.com/2017/08/25/sap-jco-server-example/

Abap code-

*&---------------------------------------------------------------------*
*& Report Z_TEST_JCO_SERVER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT Z_TEST_JCO_SERVER.
DATA: rfc_destination LIKE rfcdes-rfcdest VALUE 'NONE',
lv_uri TYPE string,
lv_payload TYPE string.

* Set the RFC destination name. It corresponds to the destination
* defined in SM59.
rfc_destination = 'MY_JCO_SRV'.

* Define the URI that should be called from the JCo server. So
* to say this is just some data that is handed to the FM.
lv_uri = |https://server/path/to/resource'|.

* Call the FM remotely and hand the data (iv_uri), but
* also retrieve the result (ev_response_payload).
CALL FUNCTION 'Z_SAMPLE_ABAP_CONNECTOR_CALL'
DESTINATION rfc_destination
EXPORTING
iv_uri = lv_uri
IMPORTING
ev_response_payload = lv_payload.

* Check for errors.
IF sy-subrc NE 0.
WRITE: / 'Call Z_SAMPLE_ABAP_CONNECTOR_CALL SY-SUBRC = ', sy-subrc.
ELSE.
* Display the result. In the exmaple we are expecting that the HTTP-get
* call - done by the JCo server - results in a XML response. We retrieved it from
* the JCo server (via ev_response_payload) and want to display it here in the ABAP backend.
cl_abap_browser=>show_xml(
EXPORTING xml_string = lv_payload
size = cl_abap_browser=>xlarge ).
ENDIF.

Please check the error log attached as png.

sap.png

Attachments

sap.png (27.5 kB)