4 5 1 Procedural Add an Employee Function

LANSA Web Functions

4.5.1 Procedural Add an Employee Function

Consider a very common data entry function such as the type of function created by the FRADD01 template.

FUNCTION 

OPTIONS(*DIRECT)

GROUP_BY 

NAME(#PANEL) FIELDS(#EMPNO #SURNAME ....)

MESSAGE 

MSGID(DCU0010) MSGF(DC@M01) MSGDTA('employee')

BEGIN_LOOP

 

REQUEST

FIELDS(#PANEL) DESIGN(*DOWN) IDENTIFY(*DESC) MENU_KEY(*YES)

INSERT

FIELDS(#PANEL) TO_FILE(PSLMST)

MESSAGE

MSGID(DCU0011) MSGF(DC@M01) MSGDTA('employee')

CHANGE

FIELD(#PANEL) TO(*NULL)

END_LOOP

 

In this example, you have a single function, which must be converted to follow the rules of the WEBEVENT function. The behavior of the function should be as follows:

  • When the function is first called, it simply displays a data entry panel and then the function ends.
  • The user will enter data into the function and call the function again.
  • When the data is passed to the function, it executes and attempts to insert the data to the file.
  • If there are errors, then the error messages must be displayed.
  • If there are no errors, a completion message is sent and the fields are reset.
  • The function displays the data entry panel and the function ends.

Refer to 4.5.2 Changes Required to Restructure for WEBEVENT.