Show TOC Start of Content Area

Procedure documentation Accessing Tables  Locate the document in its SAP Library structure

Activities

If the BAPI call is successful, it outputs a table containing all the company codes.

...

       1.      First, get the table by accessing the table parameter list (getTableParameterList()).

       2.      Within this list, access the actual table (getTable()). The class JCO.Table contains all methods that are available for JCO.Structure, together with additional methods for navigation in a table. A table can have any number of rows, or can also have no rows. The diagram below shows navigation with the method setRow(), in which the current row pointer is moved to every row in the table in turn. The method getNumRows() specifies how many rows exist in total. Instead of setRow(), you can also use the method nextRow(), as displayed in the lower section of the diagram.

Syntax documentation

Accessing a Table

 

JCO.Table codes = null;

codes =

   function.getTableParameterList ().getTable(“COMPANYCODE_LIST“);

for (int i = 0; i < codes.getNumRows(); i++)   {

   codes.setRow(i);

   System.out.println(codes.getString(“COMP_CODE“)  +  ‚\t‘  +

                                codes.getString(“COMP_NAME“));

}

 

 JCO.Table codes = null;

codes =

   function.getTableParameterList ().getTable(“COMPANYCODE_LIST“);

for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow() ) {

   System.out.println(codes.getString(“COMP_CODE“)  +  ‚\t‘  +

                                codes.getString(“COMP_NAME“));

}

 

 

End of Content Area