on 07-26-2011 10:52 AM
Hello experts,
I try to use this BAPI so:
private static void bapi(JCoDestination jcoDestination) throws JCoException{
JCoFunction function1 = jcoDestination.getRepository().getFunction("RFC_READ_TABLE");
if(function1 != null){
System.out.println("ok");
}
function1.getImportParameterList().setValue("EKKO", "QUERY_TABLE");
function1.getImportParameterList().setValue("-", "DELIMITER");
function1.execute(jcoDestination);
JCoTable codes1 = function1.getTableParameterList().getTable("DATA");
JCoTable codes2 = function1.getTableParameterList().getTable("FIELDS");
for (int i = 0; i < 100; i++){
System.out.println("gut3");
codes1.setRow(i);
System.out.println(codes1.getString("WA"));
}
}
if I do it like this, I get nothing, no error, just nothing. And I'm sure the table is not empty. Also I try it with EKPO, EKBE.
Futhermore I try in the gui and I get also empty tables DATA, just the table FIELD is not empty???
Does anyone know the reason, or has the same problem??
regard
Igor
> Futhermore I try in the gui and I get also empty tables DATA, just the table FIELD is not empty???
You are saying that DATA is empty
but
FIELD is not empty...right ??
well in your code you are trying to fetch data from DATA infact...!
JCoTable codes1 = function1.getTableParameterList().getTable("DATA");
JCoTable codes2 = function1.getTableParameterList().getTable("FIELDS");
for (int i = 0; i < 100; i++){
System.out.println("gut3");
codes1.setRow(i);
System.out.println(codes1.getString("WA"));
}
}
replace
codes1.setRow(i);
with
codes2.setRow(i);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm sorry, forget it with: JCo Table codes2 = function1.getTableParameterList().getTable("FIELDS");
I would like to get information from DATA
private static void bapi(JCoDestination jcoDestination) throws JCoException{
JCoFunction function1 = jcoDestination.getRepository().getFunction("RFC_READ_TABLE");
if(function1 != null){
System.out.println("ok");
}
function1.getImportParameterList().setValue("EKKO", "QUERY_TABLE");
function1.getImportParameterList().setValue("-", "DELIMITER");
function1.execute(jcoDestination);
JCoTable codes1 = function1.getTableParameterList().getTable("DATA");
for (int i = 0; i < 100; i++){
System.out.println("gut3");
codes1.setRow(i);
System.out.println(codes1.getString("WA"));
}
}
Now, you can see my code)
I tryed it with data browser and it's work fine, the tables ekko, ekpo of course have entries.
But RFC_READ_TABLE is yet empty in the code and also in the gui, in function builder with transaction se37..
How can I handle it?
regard
Igor
Use below code :
JCO.Table tableList = function.getTableParameterList().getTable("DATA");
if (tableList.getNumRows() > 0) {
do {
for (JCO.FieldIterator fI = tableList.fields();
fI.hasMoreElements();)
{
JCO.Field tabField = fI.nextField();
System.out.println(tabField.getName()
+ ":t" +
tabField.getString());
}
System.out.println("n");
}
while (tableList.nextRow() == true);
}
I use now that
private static void bapi(JCoDestination jcoDestination) throws JCoException{
JCoFunction function1 = jcoDestination.getRepository().getFunction("RFC_READ_TABLE");
System.out.println("ok");
if(function1 != null){
System.out.println("fk");
}
function1.getImportParameterList().setValue("EKKO", "QUERY_TABLE");
function1.getImportParameterList().setValue("-", "DELIMITER");
function1.execute(jcoDestination);
System.out.println("ok1");
JCoTable codes1 = function1.getTableParameterList().getTable("DATA");
System.out.println("ok2");
System.out.println("ok3");
if (codes1.getNumRows() > 0) {
do {
for (JCoFieldIterator fi = codes1.getFieldIterator(); fi.hasNextField();)
{
JCoField tabField = fi.nextField();
System.out.println(tabField.getName()
+ ":t" +
tabField.getString());
}
System.out.println("n");
}
while (codes1.nextRow() == true);
}
}
I get yet output from System.out... "fk", that's all what I get. I don't understand, why I don't get "ok1". It's incredible!
regard
Igor
when I debug I get execptionlist, but I don't understand what is the error now:
0: com.sap.conn.jco.AbapException: (126) DATA_BUFFER_EXCEEDED: Selected fields do not fit into structure DATA
1: com.sap.conn.jco.AbapException: (126) FIELD_NOT_VALID: Field to be read not in table
2:com.sap.conn.jco.AbapException: (126) NOT_AUTHORIZED: User not authorized to access QUERY_TABLE
3:com.sap.conn.jco.AbapException: (126) OPTION_NOT_VALID: Selection entries (e.g. syntax) incorrect
4:com.sap.conn.jco.AbapException: (126) TABLE_NOT_AVAILABLE: QUERY_TABLE not active in Dictionary
5:com.sap.conn.jco.AbapException: (126) TABLE_WITHOUT_DATA: QUERY_TABLE is name of structure
what is now the error?
I think I have a little bit another problem. Here the problem is, the limitation of tables output. But in my case, I can't make any output, with Java. Like I said, in the gui, I can get output from table cdhdr with rfc_read_table and with TABLE_ENTRIES_GET_VIA_RFC I get the output from cdhdr and cdpos. From another three tables, ekko, ekpo and ekbe I get nothing.
Furthermore I checked, whether both function modules are remote able and they are.
I think the problem is, that both fm are in the general data not freed. I would like to know, when this the problem is, why would anybody locking this fm.
regard
Igor
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.