cancel
Showing results for 
Search instead for 
Did you mean: 

RFC_READ_TABLE

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

> 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);

Former Member
0 Kudos

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

Former Member
0 Kudos

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);
  }

Former Member
0 Kudos

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

Former Member
0 Kudos

If you are not getting ok1...

then your code is throwing some exception on line

function1.execute(jcoDestination);

Check logs.....

and paste the error detail here....

or debug your code and see what exception you get here on this line...............

Former Member
0 Kudos

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?

Former Member
0 Kudos

I think I have no rights to access via this BAPI. But I don't understand why I can read info in the gui via this BAPI only for cdhdr from this five tables. For another tables it's also no problem. but not this tables and not via code..

Mystery for me..

Former Member
0 Kudos

I believe there are few limitations with this RFC............

/people/piers.harding/blog/2004/11/10/rfcreadtable--my-old-faithful--what-has-happened-to-you

Former Member
0 Kudos

thank you, I will first read this!

Former Member
0 Kudos

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

Former Member
0 Kudos

Now I know the solution. I must set up the FIELDS that I want to have, because of the problem with the length.

ragard

Igor

Answers (0)