on 08-15-2005 7:13 PM
Hi - I'm new to SAP and have just installed 6.4 Sneak Preview and JCo. I'm trying to call the example BAPI BAPI_FLBOOKING_GETLIST but am getting nothing returned. There is data in the system as I can view it through the SAP GUI. The ExportParameterList on the returned function is always null. No errors are thrown. Any ideas - I seem to be connecting successfully and can query the metadata.
Below is my the code I'm using.
TIA
Ian
import com.sap.mw.jco.IFunctionTemplate;
import com.sap.mw.jco.JCO;
public class SAP_Test_1 {
JCO.Repository repository;
/** Creates a new instance of SAP_Test */
public SAP_Test_1() {
JCO.Client connection = null;
try {
connection = JCO.createClient("000", "BCUSER", "minisap", "EN", "developer", "NSP"); // system number
repository = new JCO.Repository("MyRepository", connection);
IFunctionTemplate ft = repository.getFunctionTemplate("BAPI_FLBOOKING_GETLIST");
JCO.Function function = ft.getFunction();
connection.execute(function);
if (function.getExportParameterList() == null) {
// ***************** THIS ALWAYS HAPPENS *****************
System.out.println("No data returned");
} else {
JCO.Structure returnStructure = function.getExportParameterList().getStructure("RETURN");
if (! (returnStructure.getString("TYPE").equals("") ||
returnStructure.getString("TYPE").equals("S")) ) {
System.out.println(returnStructure.getString("MESSAGE"));
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (connection != null) {
connection.disconnect();
}
}
}
public static void main( String[] args ) {
new SAP_Test_1();
}
}
Hi Ian,
Did u get all your system.out.println getting printed on your console?
What does "Message" contains in your back end.I am guessing it is a structure of Data.
Did you bind your context attribute properly I mean your input and output parameters.
Rdgs,
G
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Ian,
what is retured from this BAPI when you run it in Test mode in Transaction SE37?
Regards
Gregor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems that all the results are returned in the table parameter list. So I needed to call function.getTableParameterList() instead of function.getExportParameterList().
Is their any standard with BAPIs about how you can check for successful completion of a call? It seems in other examples I've looked at the RESULT has been part of the Export parameter list?
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.