cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving error information while connecting to JCO

Former Member
0 Kudos

Hello, I'm programing in Java using JCO to connect to SAP. Everything works fine when I introduce good data in the createClient method. The problem is that if I introduce a wrong user/password it do not connect but I get no error code so I don't know how can I show the scpecific error to the user.

Also if the server does not exists an exception happend, I capture the exception and I can show the message as is but, how can I know if the exception is because of the server Id or the server Ip or the client number?

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hello,

JCO exceptions are thrown using the JCO.Exception class.

When you catch the exception object you can find out the key, group and detail message. Based on the group like

JCO_ERROR_LOGON_FAILURE or JCO_ERROR_COMMUNICATION etc. you can take subsequent actions. The text gives you more details.

 try {

            client = JCO.createClient ....  
            
            } catch (JCO.Exception ex) {
              if ( ex.getGroup() == JCO.Exception.JCO_ERROR_COMMUNICATION ) {
              take some action....
              }
              
              ex.getMessage( )       

            }

Octavian