Skip to Content
avatar image
Former Member

RFC Destination for outbound calls (ABAP calls JAVA)

Hello,

I am going to call a java application from SAP system using SAP JCo 3.0. (Outbound call)

The link below helps a lot.

Setup and test SAP Java Connector outbound connection

I would have two questions at this moment:

1-) Our RFC destination is defined as it's explained above. When we press the Connection Test button, we are getting some error messages saying Communication_Failure.

Is this because we didn’t set Gateway Host and Gateway Service information in Gateway Options section? Do you know what can be the reason of it? (Please see below the screenshot of our RFC destination)

2-) We didn’t register our program id anywhere in SAP. (There is one comment in the link above saying “If you register the connection, it is only possible for the java program to connect. It will not start or connect the java program. So after creating the destination you actually need to start the java program – it will register itself – and then you can run the Ping.”)

What I understand is that we don’t need to register our program id anywhere in SAP. We just need to run our java application and it's going to register itself. Is this correct?

Can you please help me understand these two questions?

Thank you for your help

Regards

rfc.png

rfc.png (39.6 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Dec 27, 2016 at 11:33 AM

    Hello Baran,

    All your comments are correct :-).

    About setting the "gateway options" of the RFC destination, set them to the same values used at the JCO settings (JCO_GWHOST and JCO_GWSERV).

    Regards,

    Isaías

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 26, 2016 at 08:36 PM

    Hello Baran,

    Are you configuring a custom made application that uses the SAP JCO library?

    Or are you configuring an SAP Java system to connect to an SAP ABAP system?

    It seems that it is the first case (custom app).

    When you configure your JCO settings, you are defining a gateway host and service so your custom app registers the program at the ABAP gateway (using the JCO API).

    Your RFC destination (SM59 at the ABAP system) must have the same gateway host and service defined.

    In addition, the destination will work only while your custom app is running and registered to that gateway.

    In case you see an error like "registration not allowed" at the traces/logs from your custom app, read this WIKI page.

    Regards,

    Isaías

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 26, 2016 at 11:35 PM

    Hello Isaias,

    Thank you for your response.

    Yes, it 's the first case and I use SAP JCo 3.0. I am developing a custom Java server program that will listen SAP system and collect whatever is sent by the SAP function module. Something like below:

    https://help.sap.com/saphelp_nwpi711/helpdata/en/48/63bb85c6bf07dbe10000000a42189b/content.htm

    There are some server parameters that I should set in the Java server program like below:

    ServerDataProvider.JCO_GWHOST --> I think you are talking about this parameter when you say configuring the JCo settings. I will collect this information from SAP Basis.

    ServerDataProvider.JCO_GWSERV --> I think you are talking about this parameter when you say configuring the JCo settings. I will collect this information from SAP Basis.

    ServerDataProvider.JCO_PROGID --> This must be the same with the program id in RFC Destination. I see that program id will be registered on SAP system automatically by the help of SAP JCo 3.0. Am I correct? Therefore, I don't have to register it somewhere in SAP.

    You say that Your RFC destination (SM59 at the ABAP system) must have the same gateway host and service defined.

    This means that I had to set Gateway Host and Gateway Service information in RFC destination Gateway Options section. Am I correct?

    You say that In addition, the destination will work only while your custom app is running and registered to that gateway.

    As long as the Java server program isn't run, we will get some error messages if we hit Connection Test button. Is this correct?

    Thank you for your answers

    Regards

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 03, 2017 at 10:29 PM

    Hi Isaias,

    Thank you very much for your help.

    I am able to listen SAP system via Java application and I am able to collect whatever is sent by the SAP function module.

    At this moment, I would like to ask you another question. (Please let me know if I should create a new question thread)

    I call a SAP function module "RSB_API_OHS_DEST_READ_DATA" via Java application and I get the output. I see that I have some data coming from SAP. (30 columns)

    I would like to understand how to get this data in Java. I should be able to get the records column by column and load them into another database.

    I think the data should be in RESULTDATA table output. However, I am not able to get the records using column names like

    JCoTable dataLayout = function.getTableParameterList().getTable("RESULTDATA");

    for (int i = 0; i < dataLayout.getNumRows(); i++) {

    dataLayout.setRow(i);

    System.out.println(dataLayout.getString("COMPANY"));

    }

    Could you please help me understand how I can get the records column by column? What is the way to get the records coming with "RSB_API_OHS_DEST_READ_DATA" in Java?

    Thank you

    Regards

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 04, 2017 at 05:59 PM

    Hello Baran,

    You are welcome! Please mark the question as answered ;-).

    About the new topic, I believe it would be better to open a new question, so both topics do not get mixed up, avoiding confusions when other community members find this question.

    In any case, I do not have knowledge about programing with the JCO library, so I am not able to help you there.

    Regards,

    Isaías

    Add comment
    10|10000 characters needed characters exceeded