The following example demonstrates the complete workflow for calling an ABL procedure that returns a single temp-table as an OUTPUT ProDataGraph. The Java client defines the table schema, invokes the procedure, and iterates the returned rows.

The ABL procedure GetOrdersForCustNum.p accepts an INPUT integer parameter and returns all matching orders as an OUTPUT TABLE:

/*------------------------------------------------------------------------
    File        : GetOrdersForCustNum.p
    Purpose     : Returns orders as an OUTPUT TABLE (ProDataGraph).
                  Used by SingleTable.java to demonstrate the
                  TEMP-TABLE as ProDataGraph workflow.
  ----------------------------------------------------------------------*/

DEFINE TEMP-TABLE ttOrder NO-UNDO
  FIELD CustNum   AS INTEGER
  FIELD OrderNum  AS INTEGER
  FIELD SalesRep  AS CHARACTER.

DEFINE INPUT  PARAMETER piCustNum AS INTEGER NO-UNDO.
DEFINE OUTPUT PARAMETER TABLE FOR ttOrder.

FOR EACH Order NO-LOCK WHERE Order.CustNum = piCustNum:
  CREATE ttOrder.
  ASSIGN
    ttOrder.CustNum   = Order.CustNum
    ttOrder.SalesRep  = Order.SalesRep.
END.

The Java client SingleTable.java performs the following steps:

  1. Defines the temp-table schema using a ProDataGraphMetaData object containing a single ProDataObjectMetaData that maps to the ttOrder temp-table fields.
  2. Opens a connection and creates an OpenAppObject to invoke the remote procedure.
  3. Builds a ParamArray with an INPUT integer parameter and an OUTPUT TABLE parameter, passing the schema metadata.
  4. Calls runProc() to execute the ABL procedure on the application server.
  5. Retrieves the populated ProDataGraph from the output parameter and iterates the ProDataObject rows by table name.
import com.progress.open4gl.javaproxy.OpenAppObject;
import com.progress.open4gl.javaproxy.Connection;
import com.progress.open4gl.javaproxy.ParamArray;
import com.progress.open4gl.javaproxy.ParamArrayMode;
import java.util.List;

public class SingleTable {

  private static final String URL      = "<hosturl>";
  private static final String USER     = "";
  private static final String PWD      = "";
  private static final String APPINFO  = "";
  private static final int    CUST_NUM = 1;

  public void example() throws Exception {

    // Build schema for the ttOrder OUTPUT TABLE parameter
    ProDataGraphMetaData graphMD = new ProDataGraphMetaData("dsOrder");
    ProDataObjectMetaData tableMD = new ProDataObjectMetaData(
            "ttOrder", 3, false, 0, null, null, null);
    tableMD.setFieldMetaData(1,"CustNum", 0,Parameter.PRO_INTEGER,  0,0);
    tableMD.setFieldMetaData(2,"OrderNum",0,Parameter.PRO_INTEGER,  1,0);
    tableMD.setFieldMetaData(3,"SalesRep",0,Parameter.PRO_CHARACTER,2,0);
    graphMD.addTable(tableMD);

    // Establish the connection 
    Connection connection = new Connection(URL, USER, PWD, APPINFO);

    // Instantiate the proxy-free AppObject
    OpenAppObject appObj = new OpenAppObject(connection, "");

    try {
      ParamArray params = new ParamArray(2);
      params.addInteger(0, CUST_NUM, ParamArrayMode.INPUT);
      params.addTable(1,(ProDataGraph)null,ParamArrayMode.OUTPUT,graphMD);

      appObj.runProc("GetOrdersForCustNum.p", params);
      ProDataGraph pdg = (ProDataGraph) params.getOutputParameter(1);
      List<ProDataObject> orders = pdg.getProDataObjects("ttOrder");

      System.out.printf("Orders for CustNum %d (%d row(s)):%n", 
        CUST_NUM, orders.size());
      for (ProDataObject row : orders) {
        int    custNum = (Integer) row.get("CustNum");
        int    orderNum = (Integer) row.get("OrderNum");
        String salesRep = (String)  row.get("SalesRep");
        System.out.printf("CustNum=%-4d  OrderNum=%-6d  SalesRep=%s%n",
                          custNum, orderNum, salesRep);
      }
    } 
    finally {
      appObj._release();
    }
  }
}

Note that for a single temp-table ProDataGraph, you use ParamArray.addTable() rather than addDataset(). The ProDataGraphMetaData contains exactly one ProDataObjectMetaData and no ProDataRelationMetaData, since there is no parent–child relationship in a single-table graph.