Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This example of an invokable method expects the PutCustomerOnHoldParameter class as a paramterparameter. The dataset dsCustomer is not used for input. It's INPUT-OUTPUT definition is just to justify the requirement for an invokable method. In the first phase of the method, the input object and the properties of the object instance are validated. The second phase reads the customer with the given customer number. This is performed by calling into the Business Entities FetchData method. To process the data some fields of the temp-table record are updated and in the last phase those changes are saved using the SaveChanges method (leveraging all validation in the Business Entity or Data Access class).

Note that when returning from the method, the Business Entities dsCustomer DATASET is returned to the caller. So the caller will receive the updated eCustomer record.

Invoking the method from the Service Adapter

Code Block
titleSample of invoking the method through the Service Adapter (client)
linenumberstrue
{Demo/Customer/dsCustomer.i}

DEFINE VARIABLE oParameter AS PutOnHoldParameter NO-UNDO . 

oParameter = NEW PutOnHoldParameter (42, "We need to talk to this customer") .


FrameworkSettings:ServiceAdapter:InvokeMethod ("":U,                                     /* default partition */
                                               "Demo.Customer.CustomerBusinessEntity":U, /* Business Entity name */
                                               "PutCustomerOnHold":U,                    /* method name */
                                               INPUT-OUTPUT DATASET dsCustomer,
                                               oParameter) .

Invoking the method from the Service Interface

Code Block
titleSample of invoking the method through the Service Interface (business logic)
{Demo/Customer/dsCustomer.i}


DEFINE VARIABLE oParameter AS PutOnHoldParameter NO-UNDO . 


oParameter = NEW PutOnHoldParameter (42, "We need to talk to this customer") .


ServiceInterface:InvokeMethod ("Demo.Customer.CustomerBusinessEntity":U, /* Business Entity name */
                               "PutCustomerOnHold":U,                    /* method name */
                               INPUT-OUTPUT DATASET dsCustomer,
                               oParameter) .