Skip to main content

Helpcenter

Implement a First Function in ABL

Backend logic can be included in ABL. The following instruction is based on the use case where a field is filled with text every time a DSO is read.

For this use case, a screen with an entity named 'eAddress' and at least one field named 'Name2' is used.

  1. In your Gitpod environment got to src\backend\.

  2. Create a new folder.

  3. Create a new file <Name>EventHandler.cls in the previously created folder.

  4. Type b1-datasourceEventHandler in the new file to insert an EventHandler.

  5. Save the changes.

  1. In the Build.One Platform go to Integrate > Data > Datasource.

  2. Click the Generate Dataset-Definition button.

  3. Select the desired DSO in the Data Source Object field.

  4. Copy the generated Dataset Definition.

  5. In your Gitpot environment create the file dsAddress.i in the previously created folder.

  6. Paste the copied Dataset Definition into the dsAddress.i file.

  1. Include the dsAddress.i as follows:

    INHERITS Akioma.Swat.OERA.Dynamic.BaseServerEventHandler:
    { <Name of the previously creatded folder>/dsAddress.i &ACCESS="PRIVATE" }
  2. Rename the constructor as follows:

    CONSTRUCTOR <Name>EventHander():
  3. Enter the following code:

    METHOD PROTECTED OVERRIDE VOID OnAfterFetch():
        FOR EACH eAddress NO-LOCK:
          ASSIGN eAddress.Name2 = "HelloWorld from Backend".
        END.
      END METHOD.
  4. Open the DSO at the root level.

  5. In the Attributes panel, enter the value 'Training.TrainingEventHandler' for the ServerEventHandler attribute.