Start of Content Area

Procedure documentation Table Manipulation  Locate the document in its SAP Library structure

Use

In many applications it is not sufficient to be able to access table fields or navigate through a table, you also often need to add or delete rows. SAP JCo provides methods that enable you to do this. Normally, you add rows for table parameters that are sent to the SAP server (for example, adding items to a customer order). This example uses the table returned by the BAPI CompanyCode.GetList.

 

               Table Manipulation

 

codes.setRow(2);

codes.deleteRow();

codes.deleteRow(5);

codes.appendRow();

codes.setValue("COMP_CODE" , "XXXX",);

codes.setValue("COMP_NAME", "Does not exist");

codes.appendRows(2);

codes.setValue("COMP_CODE", "YYYY");

codes.setValue("COMP_NAME", "Does not exist either");

codes.nextRow();

codes.setValue("COMP_CODE", "ZZZZ");

codes.setValue("COMP_NAME", "Nor does this");

 

      If the method deleteRow() is called without parameters, it deletes the current row. If you define a row number, the corresponding row is deleted.

      The method appendRow() adds a row at the end of the table. If you want to append multiple rows simultaneously, you can specify an integer argument. This leads to better performance than with adding rows individually.

      The method insertRow(int) inserts a row at any position in the table.

      The method deleteAllRows() deletes all rows of a table.

 

The following table summarizes the JCoTable methods that are not contained in JCoStructure.

 

                   JCoTable Methods 
This graphic is explained in the accompanying text

 

 

 

End of Content Area