The JCo Migration Helper Plugin is an Eclipse plugin to help applications to migrate to the JCo 3 API
APACHE-2.0 License
The plugin JCo 3 Migration Helper Plugin is an eclipse/NetWeaver Studio plugin which helps developers to adapt the API changes from the Java Connector.
Use the update site from https://github.com/SAP/jcomigrationhelperplugin/wiki/latest_release/ to install the plugin.
Right click on the Java Project/Package/File and choose JCo Migration Helper --> Generate Markers
The plugin will go through your Java Classes and search for all variables using the setValue calls of JCo and mark them as a Migration Candidate. Open the Markers view to see the list of generated markers.
Right click on the variable and choose Switch Parameters.
The plugin will search for all occurrences of the variable, where the setValue method is invoked and switch the parameters. The marker will be deleted additionally after a successful switch.
The process for this is the following:
You can also go into every class manually and switch the parameters by clicking on the variable and select Swtich JCo Parameters It will add a marker that the switch was done for this variable.
The current logic for the candidates is:
Then this a candidate for the switch.
Right click on the Java Project/Package/File and choose JCo Migration Helper --> Organize JCo Imports
It will go through your Java Classes and
A class which could look like this:
package com.sap.ims.isa.tests.jcomigration.imports;
import com.sap.mw.jco.JCO;
public class OldJCoAllInOne {
private com.sap.mw.jco.JCO.Function variantReadData;
private JCO.Table table;
public static void simpleCall(com.sap.mw.jco.JCO.Function func, JCO.Table table) throws Exception {
try {
JCO.Function funcInst = new JCO.Function();
// now get repository infos about the function
JCO.Function variantReadData = connection.getJCoFunction("CRM_ISA_PCAT_VARIANT_DATA_GET");
// getting import parameter
com.sap.mw.jco.JCO.ParameterList importParams = variantReadData.getImportParameterList();
// setting the id of the attribute set
importParams.setValue("valueCatalog", "CATALOG");
importParams.setValue("valueVariant", "VARIANT");
// call the function
connection.execute(variantReadData);
// get the output parameter
JCO.ParameterList exportParams = variantReadData.getExportParameterList();
String returnCode = exportParams.getString("RETURNCODE");
} catch (JCO.Exception | JCO.Exception ex) {
ex.printStacktrace();
}
try {
throw new JCO.Exception();
} catch (com.sap.mw.jco.JCO.Exception ex) {
ex.printStacktrace();
}
}
public JCO.ParameterList simpleCall(JCO.Function func) throws JCO.Exception {
return (JCO.ParameterList) null;
}
public com.sap.mw.jco.JCO.ParameterList simpleCallFqn(com.sap.mw.jco.JCO.Function func) throws JCO.Exception {
return (com.sap.mw.jco.JCO.ParameterList) null;
}
public com.sap.mw.jco.JCO.ParameterList simpleCallNoException(com.sap.mw.jco.JCO.Function func) {
return (com.sap.mw.jco.JCO.ParameterList) null;
}
}
would look after migration like this:
package com.sap.ims.isa.tests.jcomigration.imports;
import com.sap.conn.jco.*;
public class OldJCoAllInOne {
private com.sap.conn.jco.JCoFunction variantReadData;
private JCoTable table;
public static void simpleCall(com.sap.conn.jco.JCoFunction func, JCoTable table) throws Exception {
try {
JCoFunction funcInst = new JCoFunction();
// now get repository infos about the function
JCoFunction variantReadData = connection.getJCoFunction("SOME_FM");
// getting import parameter
com.sap.conn.jco.JCoParameterList importParams = variantReadData.getImportParameterList();
// setting the id of the attribute set
importParams.setValue("value_1", "NAME_1");
importParams.setValue("value_2", "NAME_2");
// call the function
connection.execute(variantReadData);
// get the output parameter
JCoParameterList exportParams = variantReadData.getExportParameterList();
String returnCode = exportParams.getString("RETURNCODE");
} catch (JCoException | JCoException ex) {
ex.printStacktrace();
}
try {
throw new JCoException();
} catch (com.sap.conn.jco.JCoException ex) {
ex.printStacktrace();
}
}
public JCoParameterList simpleCall(JCoFunction func) throws JCoException {
return (JCoParameterList) null;
}
public com.sap.conn.jco.JCoParameterList simpleCallFqn(com.sap.conn.jco.JCoFunction func) throws JCoException {
return (com.sap.conn.jco.JCoParameterList) null;
}
public com.sap.conn.jco.JCoParameterList simpleCallNoException(com.sap.conn.jco.JCoFunction func) {
return (com.sap.conn.jco.JCoParameterList) null;
}
}