on 07-31-2006 9:14 PM
Hello,
I have problems to store information in a table of a bapi.
The bapi works in the following way:
You define one import parameter.
You store ranges for certain values in some of the tables of the bapi (selection criterias).
You execute the bapi and it stores the result in the "EMMA_HDR_TAB" table according to your selection.
Defining the import values works and getting the result table works as well. But, the bapi does not take the selection critierias into account. The result is as if the tables (i.e. BUSINESSPROCESSCODE table) were empty.
If I insert the values and execute it in the se80, everything works fine.
So the problem must be that the bapi does not get the selection criterias. But the table BUSIESSPROCESSCODE has one row with correct values.
Does anybody know this problem and can help me with it?
Any help highly appreciated!
Daniel
ps:
The table with the selection criteria is "BUSINESSPROCESSCODE".
The result table is "EMMA_HDR_TAB".
Here is my code and the output in the console:
import com.sap.mw.jco.IFunctionTemplate;
import com.sap.mw.jco.JCO;
import com.sap.mw.jco.JCO.ParameterList;
public class SapPlug2 extends Object {
JCO.Client mConnection;
JCO.Repository mRepository;
public SapPlug2() {
try {
mConnection =
JCO.createClient(
"***",
"*****",
"*****",
null,
"*****",
"**");
mConnection.connect();
mRepository = new JCO.Repository("mRepo", mConnection);
JCO.Function function = null;
function = this.createFunction("BAPI_EMMA_HDR_READ");
// Import Parameters
JCO.ParameterList input = function.getImportParameterList();
input.setValue("1", "XPREP");
ParameterList tables = function.getTableParameterList();
//Inserting the selection criteria in the table
JCO.Table bpcode = tables.getTable("BUSINESSPROCESSCODE");
bpcode.appendRow();
bpcode.setValue("I", "SIGN");
bpcode.setValue("EQ", "OPTION");
bpcode.setValue("EBI00001", "LOW");
//Check whether one row has been appended
System.out.println(
"The table BUSINESSPROCESSCODE has:"
+ bpcode.getNumRows()
+ " row(s)");
JCO.Table emma_tab = function.getTableParameterList().getTable("EMMA_HDR_TAB");
mConnection.execute(function);
//Check how many rows are in the result table
//I expect about 390 if the selection has been taken into account and around 4300 if the selection tables are empty
System.out.println("Number of rows in the table EMMA_HDR_TAB:"+ emma_tab.getNumRows());
mConnection.disconnect();
} catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
}
}
public JCO.Function createFunction(String name) throws Exception {
try {
IFunctionTemplate ft =
mRepository.getFunctionTemplate(name.toUpperCase());
if (ft == null)
return null;
return ft.getFunction();
} catch (Exception ex) {
throw new Exception("Problem retrieving JCO.Function object.");
}
}
public static void main(String args[]) {
SapPlug2 app = new SapPlug2();
}
}
The console:
The table BUSINESSPROCESSCODE has:1 row(s)
Number of rows in the table EMMA_HDR_TAB:0
Number of rows in the table EMMA_HDR_TAB:4341
Hi Daniel,
Try to call JCO.Table emma_tab = function.getTableParameterList().getTable("EMMA_HDR_TAB");
after mConnection.execute(function);.
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Maksim,
thank you for your reply.
However, I tried it, but it does not work.
...
System.out.println("Number of rows in the table EMMA_HDR_TAB:" + emma_tab.getNumRows());
mConnection.execute(function);
System.out.println("Number of rows in the table EMMA_HDR_TAB:" + emma_tab.getNumRows());
...
result on the console:
Number of rows in the table EMMA_HDR_TAB:0
Number of rows in the table EMMA_HDR_TAB:4341
I expect about 390 rows with the selection and these 4341 if no selection is taken into account.
Any other ideas?
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.