Hi Akrem,
Please find the code below, this is just for your reference and based on JCO 2.*. On the basis of below you can build your code.
import com.sap.mw.jco.*;
public class callBapi {
JCO.Client mConnection;
JCO.Repository mRepository;
public callBapi() {
try {
// Change the logon information to your own system/user
mConnection =
JCO.createClient("001", // SAP client
"<userid>", // userid
"****", // password
null, // language
"<hostname>", // application server host name
"00"); // system number
mConnection.connect();
mRepository = new JCO.Repository("SAPJCo", mConnection);
}catch (Exception ex) {
ex.printStackTrace();
}
JCO.Function function = null;
JCO.Table codes = null;
try {
function = this.createFunction("BAPI_SYSTEM_MTE_GETPERFCURVAL");
if (function == null) {
System.out.println("Please check your BAPI Name");
}
mConnection.execute(function);
JCO.Structure returnStructure =
function.getExportParameterList().getStructure("<Structure Name>");
}
codes =
function.getTableParameterList().getTable("<TableName>");
for (int i = 0; i < codes.getNumRows(); i++) {
codes.setRow(i);
System.out.println(codes.getString("<FieldName>") + '\t' +
codes.getString("<FieldName>"));
}
}
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
}
Thanks,
Hamendra