View source | Discuss this page | Page history | Printable version   

ERP 2.50:Developers Guide/Concepts/Processes

ERP 2.50:Developers Guide




A process is a systematic series of actions directed to some end. Typically a process receives some parameters and taking them into account performs some actions to obtain a result. Openbravo ERP define two main kind of process Java Processes and PL/SQL Processes.

All processes (as well as Reports) are managed from the same window: Application Dictionary || Report and Process.

Once a process is defined it can be added to the menu to be called directly from it, or it can be invoked through a button.


When a process (PL/SQL or Java) or a Jasper Report is set as Standard UI Pattern a pop up is automatically generated to invoke it, this poup-up looks like:


Note that in this pop-up there is a section with information about the process, this information is obtained from the Help field in the Report and Process tab.

It also prompts for a number of parameters, and finally there are two buttons, OK to start the process and Cancel to close the pop up and do not do nothing else. In case the process did not require any parameter that section would be empty.

When this kind of process require parameters they must be defined in Application Dictionary || Report and Process || Report & Process >> Parameter tab.


Parameters are defined in a very similar way than columns are, depending on the Reference the parameter is assigned the generated UI for it will be different.

Let's overview some of the most important fields in this tab:

PL/SQL Processes

PL/SQL Processes are implemented by database stored procedures. For more information read the documentation on stored procedures.

Defining a PL/SQL process

PL/SQL processes are defined in Application Dictionary || Report and Process. The only field to take into account for this kind of processes is Procedure: It is the procedure name in database. Note that as PL/SQL procedures are assigned to modules, they must be named following the naming rules, this is: the name for the procedure must start with the module's DBPrefix.

As the UI for PL/SQL processes is always automatically generated, the UI Pattern field must be set as Standard.

In case the process requires any parameter is possible to define them, to learn more about how to do it read the section above.

Java Processes

It is possible to implement process with Java. They are also defined in Application Dictionary || Report and Process window. Depending on the UI pattern they use they can be split in Standard and Manual.

Standard UI Pattern

User interface to invoke Java processes with standard UI pattern is automatically generated in the same way the interface for PL/SQL processes is done.

Defining in Application Dictionary

To set a Java process to be have Standard UI just set the UI Pattern field to Standard in Application Dictionary || Report and Process || Report & Process tab. It is also necessary to indicate the class that is going to implement the process, this is done adding a new record in Process Class tab. At least, one record in this tab must be checked as default.

If the process requires parameters they can be defined in the Parameter tab as explained in the Parameters section of this document.

Java Implementation

The Java class implementing the process must extend the org.openbravo.scheduling.Process interface. This interface just defines a method:

 public void execute(ProcessBundle bundle) throws Exception;

This method receives a ProcessBundle, this bundle contains all the parameters for the process. When the process finishes it must add a result to this bundle, this result is an OBError instance that will be shown in the UI.

Let's explain it using a little example:

  package my.package;
  import org.openbravo.erpCommon.utility.OBError;
  import org.openbravo.scheduling.ProcessBundle;
  public class ImportClientProcess implements org.openbravo.scheduling.Process {
    public void execute(ProcessBundle bundle) throws Exception {
      try {
        //retrieve custom params
        final String myParam = (String) bundle.getParams().get("myParam");
        // retrieve standard params
        final String recordID = (String) bundle.getParams().get("C_Order_ID");
        final String clientID = (String) bundle.getParams().get("adClientID");
        final String orgID = (String) bundle.getParams().get("adOrgId");
        //Available from 2.50MP26
        final String tabId = (String) bundle.getParams().get("tabId"); 
        // implement your process here
        final OBError msg = new OBError();
        msg.setMessage("Process finished correctly");
      } catch (final Exception e) {
        final OBError msg = new OBError();
        msg.setTitle("Error occurred");

In this example a parameter named myParam is expected. It is read by the following line:

  final String myParam = (String) bundle.getParams().get("myParam");

In the standard parameters section it is obtained the ID for the record that invoked the process (recordID variable), note that the name for this parameter is the same as the primary key column in the tab invoking it, in this case this process is called from a tab for C_Order table. It also obtains the client and organization for that record.

It is possible to retrieve the tab id the process was invoked from using the tabId parameter. (Available from 2.50MP26).

Once the process is finished a new OBError is created to handle the message and it is added as result to the bundle, for more information about message read the Message section in this document.


Manual UI Pattern

The difference between Standard and Manual UI pattern is that no UI is automatically generated for Manual UI pattern processes, in this case UI must be manually genereted by the class implementing the process.

Application Dictionary definition

Manual Java processes are defined in application dictionary in the same way Standard ones are. Additionally is necessary to include an entry in Process Mapping to make it accessible in the web.xml.

Java Implementation

Manual processes are implemented by a Java class extending org.openbravo.base.secureApp.HttpSecureAppServlet, this is a standard servlet that generates the UI.

ERP 2.50:Developers Guide/Concepts/Reports | ERP 2.50:Developers Guide/Concepts/WebServices 

Retrieved from ""

This page has been accessed 19,700 times. This page was last modified on 27 June 2011, at 17:45. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.