on 08-31-2019 12:42 PM
Hi, after searching for 3 days without result, maybe someone can help me in the forum:
I want to do a BAPI MDX call with Java using the JCO3 SDK.
Connection is working, also found information to use bapi_mddataset_create_object and other functions.
But, how to build a complete code to get a result back from an MDX select?
Every hint or solution would be great!
Thx, Roland
got it... the code is fine, but I needed to find out, how to reach the data using bapi_mddataset_get_axis_data and ...get_cell_data...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
so far I got a code, which works without an error,
but does not deliver any data.
The MDX itself works fine when using another tool to select the data.
If anyone can see, what's wrong in my code, pls answer. Thx!!
JCoContext.begin(destination);
JCoFunction function_create = destination.getRepository().getFunction("BAPI_MDDATASET_CREATE_OBJECT");
JCoParameterList tableParams = function_create.getTableParameterList();try{
JCoTable table = null;
JCoFieldIterator iter = tableParams.getFieldIterator();while(iter.hasNextField())
{
JCoField f = iter.nextField();if(f.getName().equals("COMMAND_TEXT") & f.isTable() ) {
table = f.getTable();
}
}
// set mdx statementtable.appendRow();
table.setValue("LINE", "SELECT {[4F0Q0T89JPDJCFX8AUVRPFVA0].[C2RRWD6RC4GKR195AFCVHE9LQ]} ");
table.appendRow();
table.setValue("LINE","ON COLUMNS, NON EMPTY [0COMP_CODE].[LEVEL01].MEMBERS DIMENSION ");
table.appendRow();
table.setValue("LINE","PROPERTIES [0COMP_CODE].[10COMP_CODE] ON ROWS ");
table.appendRow();
table.setValue("LINE","FROM [STCO_M01/YSTFI02_BRAND_PL_COGNOS]");
// assign to objec
tableParams.setValue("COMMAND_TEXT", table);
// execute
function_create.execute(destination);
// get datasetid
Object datasetid = function_create.getExportParameterList().getValue("DATASETID");
// define next function
JCoFunction function_select = destination.getRepository().getFunction("BAPI_MDDATASET_SELECT_DATA");
// use datasetid form function_create
function_select.getImportParameterList().setValue("DATASETID", datasetid);
function_select.execute(destination);
System.out.println("executed 2");
// get exportParams
JCoParameterList selectReturnList = function_select.getExportParameterList();
JCoParameterFieldIterator paramIt = selectReturnList.getParameterFieldIterator();
JCoStructure struc = null;
// loop through params
while (paramIt.hasNextField()) {try {
JCoField field = paramIt.nextField();if (field.getName().equals("RETURN")) {
struc = field.getStructure();
System.out.println("message: " + struc.getString("MESSAGE"));
System.out.println("message type: " + struc.getString("TYPE"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
// get Axis Info
JCoFunction function_getAxisInfo = destination.getRepository().getFunction("BAPI_MDDATASET_GET_AXIS_INFO");
function_getAxisInfo.getImportParameterList().setValue("DATASETID", datasetid);
function_getAxisInfo.execute(destination);
System.out.println(function_getAxisInfo.getImportParameterList());
System.out.println(function_getAxisInfo.getExportParameterList());
System.out.println(function_getAxisInfo.getTableParameterList());
JCoContext.end(destination);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.