INVOKE Syntax

The syntax for INVOKE has two variations so transaction codes can by specified literally (Syntax 1) or accessed from the contents of a Lawson 4GL field (Syntax 2). The behavior of INVOKE does not differ between syntax 1 and 2. Syntax 2 allows a Lawson 4GL procedure to send a message of a known structure to a variable transaction specified by the value of a field.

Note:  Recursion using INVOKE is not supported . If a program attempts to directly or indirectly call itself using INVOKE, execution aborts. No error is returned.

Syntax 1

INVOKE "XXnn.n"

Syntax 1 sends the $TRAN from XXnn.n to program XXnn and waits for the return. All fields in the requested program must be correctly loaded before the INVOKE is performed.

After the message is sent, the receiving program processes the data according to the transaction code specified and returns the transaction to the program that requested the data. The sending program then uses the data in those fields as required. Following is an example of syntax 1.

MOVE GL80F1-COMPANY        TO GLCMF1-COMPANY.
MOVE "I" TO GLCMF1-FC.
INVOKE "GLCM.1".
IF (NO-ERROR-FOUND)
    MOVE GLCMF1-TEXT-FLD1     TO GL80F1-TEXT-FLD1.

Syntax 2

INVOKE FormID MESSAGE "XXnn.n"

FormID is any six-character alpha field that contains a string structured like a form ID (XXnn.n) to identify the target transaction. The form ID stored in this field must be capable of processing the transaction structure that is sent to it.

The MESSAGE "XXnn.n9" clause identifies the $TRAN structure, or message, to be sent but not where to send it. This must name a valid transaction in a Lawson online program. A program sent this message must be capable of processing it. Following is an example of syntax 2.

MOVE GL80F1-COMPANY        TO GLCMF1-COMPANY.
MOVE "I" TO GLCMF1-FC.
INVOKE WS-TRANCODE MESSAGE "GLCM.1".
IF (NO-ERROR-FOUND)
    MOVE GLCMF1-TEXT-FLD1  TO GL80F1-TEXT-FLD1.