Debugging a RFC call using JCo API, Part-2


In my previous weblog Debugging a RFC call using JCo API I wrote about how to analyse the dump of RFC call. In case the result is not what is expected we can further drill down to debugging into the function module’s ABAP code.
In order to enable the ABAP debugging we need to call the function setAbapDebug(boolean) defined in JCO.Connection with true as parameter.
Code snippet:
This will launch the ABAP debugger in a separate window when the Java program is run.
ABAP debugger:
Further details about how to use the ABAP Debugger can be found at ABAP Debugger Documentation.
Are there any pre-requisites to be done, like starting ABAP RFC in debug mode or java program in debug mode. I tried both these options but didn’t get any result.
Your help is greatly appreciated.
The code is as follows :
try {
mConnection = JCO.createClient("005", // SAP client
"TEST_USER", // userid
"initial", // password
"en", // language
"us4456.wdf.sap.corp", // application server host name
"77"); // system number
mConnection.connect();
mRepository = new JCO.Repository("test", mConnection);
JCO.Function function1 = this.createFunction("ZSTATUS_TRANSLATE");
function1.getImportParameterList().setValue("DONE", "IV_STATUS");
mConnection.execute(function1);
mConnection.setAbapDebug(true);
String output1 = function1.getExportParameterList().getValue("EV_STATUS").toString();
System.out.println("The output of the RFC is "+output1);
mConnection.disconnect();
}
catch (Exception ex)
{
ex.printStackTrace();
System.exit(1);
}
1) There is change in the code given in the blog, the connection.setAbapDebug(true) should be given before execution of the function.
2) enabled external debugging in the backend, go to Utilities -> Settings -> Debugging and check the External Debugging check box, and enable HttpSession Debugging.
This starts Abap Debugger :))
Thanks so much 🙂
Cheers,
Devlin