cancel
Showing results for 
Search instead for 
Did you mean: 

Getting field symbol or dynamic table/structure from ABAP

Former Member
0 Kudos

Hi,

Currently I'm using the JCO to get the table and structure from ABAP. Which is the JCO.Table and JCO.Structure. But by using this method, i will need to define the name which is hardcoded in my program as I need to map the table/structure name and also column name.

Example


public JCO.Function processFunction(JCO.Function function) {
             JCO.Table input = function.getTableParameterList().getTable("INPUT");
....
             String ID = input.getString("ID");
             String val = input.getString("VALUE");
....
}

So in my program I need to map back what is define is ABAP. This is pretty static. Is it possible to create in more dynamic way whereby the table name is not fixed in the program.

Am looking at ABAP Field Symbol, in java is there a way to get retrieve this from ABAP? So want to try using that instead of this. But i can't get a way to retrieve that from ABAP or is there a way for this.

The reason i need this as i don't want to fixed the column. I need a dynamic data which in Java i no need do a mapping to it. As ABAP will pass me a table of data. So it can work with Field Symbol then I can just use it.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi

You can use numeric indexes instead of the symbolic names:

getTable(0);
getString(0);
getString(1);
getField(0);
getField(1);

The all number of tables, fields, etc. are also can be retrieved with JCO API.

BR, Siarhei

Former Member
0 Kudos

Hi,

Thanks for your advise.

Now i came across that is it possible for Java to retrieve the ABAP table where it is not define how many column are there in ABAP. As it will be a dynamic table as I won't know how many column are there. But I can ask from ABAP part to pass me an indicator of how many column are there.

Thanks.

siarhei_pisarenka3
Active Contributor
0 Kudos
if (table.getNumRows() > 0) {
      table.firstRow();
      do {

/* Returns the number of columns in the table This is just a convenience function and returns the same value as getFieldCount().*/
JCO.Table.getNumColumns();
...
/* Returns the i'th field as an JCO.Field object.*/
JCO.Field iField = getField(int index);
...
/* Checks whether this field is a structure parameter.*/
iField.isStructure();
/* Checks whether this field is a table parameter*/
iField.isTable();

      while(table.nextRow());
  }

BR, Siarhei

siarhei_pisarenka3
Active Contributor
0 Kudos

Here is JCO API docs: http://www.huihoo.org/openweb/jco_api/

BR, Siarhei

Answers (0)