Using JSDOs to create mobile and web clients : Accessing custom Invoke operations : Invoke operation example : An OpenEdge ABL implementation for an Invoke operation
  
An OpenEdge ABL implementation for an Invoke operation
The following example shows an ABL method that might implement an Invoke operation in any Business Entity that accesses the sports2000 database, such as Customer (see Accessing standard CRUD and Submit operations):
DEFINE PRIVATE TEMP-TABLE poCustomer
FIELD CustNum LIKE Customer.CustNum
FIELD Name LIKE Customer.Name
FIELD CreditLimit LIKE Customer.CreditLimit
INDEX idxCust UNIQUE PRIMARY poCustNum ASCENDING
.

METHOD PUBLIC DECIMAL GetCreditInfo ( INPUT piCustNum AS INT, OUTPUT
TABLE poCustomer):

EMPTY TEMP-TABLE poCustomer NO-ERROR.
FOR EACH Customer WHERE CustNum = piCustNum:
CREATE poCustomer.
ASSIGN
poCustomer.CustNum = CustNum
poCustomer.Name = Name
poCustomer.CreditLimit = CreditLimit
.
END.

RETURN poCustomer.CreditLimit.

END METHOD.
This method loops through Customer records, and returns, as an output parameter, a temp-table with a single record containing three fields (CustNum, Name, and CreditLimit) that are set from three corresponding fields of the unique Customer record with its CustNum field matching the value of the input parameter, piCustNum. The method also returns, as its value, the CreditLimit field value from the same Customer record. This allows CreditLimit to be more easily referenced on the client as the method return value in an expression if desired.