Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Filter output columns in Table in SAP application

I am working on SAP application which is returning data in the form of JCo.Table. The table consists of various columns but my requirement is to show only a set of columns which can change overtime. 

So, I have created a separate file with the list of required columns. Then, I iterate over the columns of the JCo.Table and see if they are present in the file, I select otherwise I reject the column.

I am not sure whether this is a good option or it can be done in a better way. Please suggest!


1 Answer
SAP ABAP Expert

I think there can be a better option to do this. What you can try is fetch only the fields of the table which match the fields present in the table. Do not fetch all the fields of the table but the selected fields.

// Here Table refers to the JCo.Table
for (int j = 0; j < Table.getNumRows(); j++) {
   Table.setRow(j);
   Iterator iter = displayField.iterator();
   // fetch columns present in the current record
   while(iter.hasNext()){
      String column = (String) iter.next();
      String value = Table.getString(column);
// perform your logic here
   }
}


Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.