cancel
Showing results for 
Search instead for 
Did you mean: 

Set Input parameter for table

Former Member
0 Kudos

Dear All,

I am using this code to get data from the table.I am passing the part no to INPUT_TAB and fetching the values from OUTPUT_TAB. If I call the below function, I get an error message saying "Trying to access row values in a table which does not have any rows yet".Requesting you to let me is there any error in the code and Whether the execute function should come before/after setting input values.

public static void getTableData() throws JCoException

     {

         JCoDestination destination = JCoDestinationManager.getDestination(DESTINATION_NAME2);

         JCoFunction function = destination.getRepository().getFunction("ZRFC_MES_PART_QTY_01");

         if (function == null)

             throw new RuntimeException("BAPI_COMPANYCODE_GETLIST not found in SAP.");

        

         JCoTable codes1 = function.getTableParameterList().getTable("INPUT_TAB");

        

         codes1.setValue("PARTNO","592032/A");

      

       

         try

         {

             function.execute(destination);

         }

         catch(AbapException e)

         {

             System.out.println(e.toString());

             return;

         }

         JCoTable codes2 = function.getTableParameterList().getTable("OUTPUT_TAB");

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

         {

             codes2.setRow(i);

           //  System.out.println(codes2.getString("QUANTITY"));

         }

        

     }

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Just a comment not strictly related to the original topic:

If your code is running on JAVA AS don't use System.out.prinln().

If you use SAP NetWeaver you should use the satandard Logging and Tracing API.

http://scn.sap.com/community/java/blog/2014/12/16/implementation-of-logging-and-tracing

But I know this is just an example.

BR

Szabolcs

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ashwin,

call

codes1.appendRow();

before codes1.setValue(...).

And by the way, the exception call stack shows you at which statement the error occurred.

Best regards,

Stefan