cancel
Showing results for 
Search instead for 
Did you mean: 

HOW to handle JCO connection failure

Former Member
0 Kudos

if i have a JCO connection.....to process the RFC function...

when i call the function...the job leave to R3 to do the rest...

yet ..the connection broken..at this time..

the is no result return..and consequency receive the

RFC_ERROR_COMMUNICATION exception...

how do i handle this kind of situation....

what should R3 SHOULD DO..

.........................................................

let's say i have a jco connection

the connection broken during processing...how do i return the error message to the java program

the error include....RFC_SYSTEM_FAILURE ,RFC_ERROR_COMMUNICATION

Message was edited by:

yzme yzme

Accepted Solutions (1)

Accepted Solutions (1)

former_member189631
Active Contributor
0 Kudos

Hi Yzme,

try {

write code to execute ur BAPI here.

}

catch (WDDynamicRFCExecuteException e)

{

wdComponentAPI.getMessageManager().reportException(e.toString(),false);

}

Regards,

Ramganesan K.

Answers (2)

Answers (2)

Former Member
0 Kudos

Yzme,

You have already got answers how to catch this exception.

Next processing depends on application-specific nature of RFC: whether or not call is idempotent, in simple words -- submitting same request doesn't hurt.

This comes from the fact that network failure may occurs when transferring request (hence no background processing performed) or when returning response (hence function already executed).

For idempotent calls there is also an option for automatic re-tries finite number of times. For non-idempotent calls the only option is to display error to user in friendly format.

An idempotent call is a call that can be executed more than once on the server without undesirable side effects. Take for example Create / Read / Update / Delete operations. Obviously, read is idempotent while it doesn't alter data at all. You may treat Delete as idempotent up to certain extent -- just handle "record not exists" gracefully. Create and Update are not good candidates -- re-submitting same request typically leads to serious problems like duplicate entries or data inconsistency.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hi Yzme,

You can write the following code in your Catch block of execute_RFC(Where you are executing the RFC) method.

catch (WDDynamicRFCExecuteException e){

wdComponentAPI.getMessageManager().reportException(e.getMessage(),false);

}

or

catch (WDDynamicRFCExecuteException e) {

final Writer wr = new StringWriter();

final PrintWriter pw = new PrintWriter(wr);

e.printStackTrace(pw);

wdComponentAPI.getMessageManager().reportException(wr.toString(),false);

}

Regards,

Jhansi