Using INVOKE in a Lawson 4GL Program

Only Lawson online-type programs can be activated by INVOKE. Programs activated by INVOKE must follow all the same rules as regular online programs. If an online program should be activated by INVOKE, you must set the Can Be Accessed By INVOKE attribute in Program Definition to Yes.

Because online programs possess up to nine separate transactions (forms), you must use the transaction code (the form ID) for the desired form to identify the logical entry point to a program. The form ID "GL01.1" is shown in the following example from the GL01.scr file.

*                            ELEMENT NAME               
* LEVEL       NAME           TYPE LENGTH    DEC REQ OC KN SC      PICTURE
* ----- --------------------- --  ----        - -- -- --- - -----------------
$TRANS     GL011    S

Form IDs identify the specific transaction in a program to execute. Only one transaction per program can be invoked at a time.

Note: At this time, INVOKE processing does not include field editing, defaulting, or form rule processing that is implicit to using the Lawson Presentation Manager (lapm) or the Lawson Portal. It is essential that all of the $TRANS fields are correctly loaded or initialized before activating a program using an INVOKE statement.
  1. Open Program Definition for the product line and system code that contains the program you want to execute using INVOKE:

    pgmdef productline systemcode

    For detailed instructions on accessing and using Program Definition, see Doc for Developers: Application Development Workbench.

  2. Move the light bar to the online program you want to execute using INVOKE.
  3. Press Define (F6) and choose Program.
  4. In the Can Be Accessed By INVOKE field, type Y

    - or -

    Press Select (F4) and choose Yes.

  5. Select OK twice to save the change.
  6. Generate and compile the Lawson 4GL program, if necessary.
  7. Exit Program Definition.
  8. Open the Lawson 4GL Editor (led) for the product line and program in which you want to execute the INVOKE statement:

    led productline ProgramCode

    For detailed instructions on accessing and using the Lawson 4GL Editor, see the Lawson Editor.

  9. From the Program menu, choose Procedure Description.
  10. Add statements to initialize or move values to any fields required by the transaction that are activated with the INVOKE statement.
  11. Add the INVOKE statement to the procedure logic.
  12. Save the changes.
  13. Exit the Lawson 4GL Editor.
  14. Compile the program:

    qcompile ProductLine SystemCode ProgramCode

    For detailed instructions on compiling a program, see Doc for Developers: Application Development Workbench.