Hello SAP experts,
I´m a student from Germany. I have a Problem with die Exportparameter of a SAP Function in a JAVA
Application.
The Function in the SAP System works. Ihe Importparameter and the Exportparameter of the Funktion also.
I tested it in the SAP System. But the Exportparamter in my JAVA Application in the Form of a String
unfortunately has the Value of null.
Here ist my Coding:
import com.sap.mw.jco.*;
import com.sap.mw.jco.JCO.ParameterList;
import java.util.*;
import java.io.*;
public class JCOTestString {
public static JCO.Client client;
public static final String SID = "SAP System";
public static IRepository repository;
public static void main(String[] args){
try {
JCO.Pool pool = JCO.getClientPoolManager().getPool(SID);
if (pool == null) {
int maxConnections = 1;
JCO.addClientPool(SID, maxConnections,
"00",
"RFC",
"password",
"DE",
"sapserver",
"00");
}
repository = JCO.createRepository("Repository", SID);
IFunctionTemplate ftemplate = repository
.getFunctionTemplate("Z_TEST");
JCO.Function function = new JCO.Function(ftemplate);
function.getImportParameterList().setValue("KEY", "TEST1");
String g = function.getExportParameterList().getString("RESULT");
System.out.print(g); //---> unfortunately NULL
} catch (Exception e) {
JCO.releaseClient(client);
// Fehler falls catch ausgeführt wird.
System.out.println("Fehler abgefangen:
" + e);
}
JCO.releaseClient(client);
}
}
Is anyone able to help me and to solve the Problem?
Regards
Marc