1.  Switch to the Source tab. Below the Define_Com statements, define four work fields as follows:

Define Field(#NewTotalSalary) Reffld(#iiiTotalSalary)
Define Field(#CurrentTotal) Reffld(#iiiTotalSalary)
Define Field(#ServerStatus) Reffld(#IO$STS)

2.  Copy and paste the working list definition Employees from function iiiFN21.

Def_List Name(#Employees) Fields(#xEmployeeIdentification #iiiFullName #xDepartmentCode #xEmployeeSalary #iiiNewSalary) Counter(#listcount) Type(*WORKING) Entrys(*MAX)
 
     The exchanged working list definition must be identical in the form and the called function.
CALL_SERVER_FUNCTION BIF
The CALL_SERVER_FUNCTION calls a function running on a server. In order to use this BIF, the application must have a client server connection with a server. This would usually be established when the user initially signs on to the application.
CALL_SERVER_FUNCTION can optionally pass the Exchange list of fields to the server function and receive the Exchange field list back. Up to 10 working lists can be exchanged with the server function.
     The CALL_SERVER_FUNCTION should use the following parameters:

WITH_ARGS


Server Symbolic Name

*sserver_ssn

Name of RDML function to be called

IIIFN21

Pass Current Exchange List

Y

Receive Exchange List back

*default

Working List 1

#Employees

TO_GET


Return Code

#ServerStatus



     See the Technical Guide for more information on the Client Server built-in functions.

3.  Complete the SubmitButton.Click event routine, based on the following:

Use BEGINCHECK/FILECHECK/ENDCHECK to validate xDepartmentCode using table xDepartments
      Clear list Employees
      EXCHANGE fields xDepartmentCode and iiiPercent
      If *sserver_connected = N
          Call, process *direct, function iiiFN21, Pass list Employees
          else
          USE CALL_SERVER_FUNCTION, with arguments (*sserver_ssn iiiFN21 Y *default Employees) To Get(#ServerStatus)
      EndIf
      If (#ServerStatus *ne OK)
      Message 'Call server function failed'
      End if

     Your code should look like the following:
Evtroutine Handling(#SubmitButton.Click)
Begincheck
Filecheck Field(#xDepartmentCode) Using_File(xDepartments) Msgtxt('Department Code not found')
Endcheck
Clr_List Named(#EmployeeList)
Exchange Fields(#xDepartmentCode #iiiPercent)
If (*sserver_connected = N)
Call Process(*direct) Function(iiiFN21) Pass_Lst(#Employees)
Else
Use Builtin(call_server_function) With_Args(*sserver_ssn 'iiiFN21' Y *default #Employees) To_Get(#ServerStatus)
If (#ServerStatus *NE OK)
Message Msgtxt('Call server function failed')
Endif
Endif