cancel
Showing results for 
Search instead for 
Did you mean: 

Only can use JCo to access default BAPIs but can't access developed BAPIs

Former Member
0 Kudos

Hi,

My problem is I can't use JCo to access the BAPI developed by myself, but can access the default BAPI like BAPI_COMPANY_GETLIST.

These BAPIs developed by myself can be tested in BAPI Explore correctly.

But It can't work in java program using JCo. (can't work means it can run without any bug and I can set values into ImportParameters, but I can't get ExportParameters and Table Parameters)

It sounds like the BAPI can't access remotly but I'm sure that I set the "remote enabled" in attribute tab.

I really don't know what's the problem, and spent many hours try to solve it but it still can't work.

Is there anything I should check? I really need some help.

Here is some part of my source code. The biggest problem is I can't retrieve the returned internal table, but if I change the function module from BAPI_ZAB02_TH2 to any other default function module (like BAPI_COMPANY_GETLIST) and I can retreive the returned internal table....

Thanks in advance.

createConnection();

IFunctionTemplate functionTemplate =

mRepository.getFunctionTemplate("BAPI_ZAB02_TH2");

JCO.Function function = new JCO.Function(functionTemplate);

JCO.ParameterList Input = function.getImportParameterList();

Input.setValue("80013145","VBELN");

mConnection.execute(function);

JCO.ParameterList outnput = function.getExportParameterList();

JCO.Structure returnStructure = function.getExportParameterList().getStructure("RETURN");

JCO.Table ODTable = null;

//retrieve table

ODTable =function.getTableParameterList().getTable("ITAB2");

System.out.println(ODTable.getNumRows());

for (JCO.FieldIterator e = ODTable.fields(); e.hasMoreElements(); )

{

JCO.Field field = e.nextField();

if (field.getName().equals("VBELN"))

Ship_to_party = field.getString();

}

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I find the answer of this problem.

I forget the leading spaces. Need to add some "0".