Description
This method is used to load Employee, EmployeeHoliday, EmployeeRegulation, EmployeeSafDefault records.
Parameters
tApiEmployee | output | temp-table | Temp table of Employee. |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program9/bemployee.p)
assign oiReturnStatus = -98
viLocalStatus = 0.
empty temp-table tApiEmployee.
<Q-16 run ActivityCodePrim (Start) in BActivityCode >
<Q-18 run BusinessRelationPrim (Start) in BBusinessRelation >
<Q-19 run CostCentrePrim (Start) in BCostCentre >
<Q-20 run CreditorPrim (Start) in BCreditor >
<Q-21 run CurrencyPrim (Start) in BCurrency >
<Q-22 run DivisionPrim (Start) in BDivision >
<Q-23 run ExpenseCodePrim (Start) in BExpenseCode >
<Q-24 run ProjectPrim (Start) in BProject >
<Q-25 run UserPrim (Start) in BUser >
<Q-3 run EmployeeForExcelInteg (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
output dataset tqEmployeeForExcelInteg) in BEmployee >
/* Create tApiEmployee records */
for each tqEmployeeForExcelInteg:
create tApiEmployee.
<M-2 run BufferCopy
(input buffer tqEmployeeForExcelInteg:handle (ihFrom),
input buffer tApiEmployee:handle (ihTo),
output viFcReturnSuper (oiReturnStatus)) in BEmployee>
/* assign calculated fields */
assign tApiEmployee.tcActivityCode = <M-5 ApiLoadEmployeeCalcActivityCode (input tApiEmployee.ActivityCode_ID (iiActivityId)) in BEmployee>
tApiEmployee.tcBusinessRelationCode = <M-7 ApiLoadEmployeeCalcBusRelCode (input tApiEmployee.BusinessRelation_ID (iiBusinessRelationId)) in BEmployee>
tApiEmployee.tcCostCentreCode = <M-9 ApiLoadEmployeeCalcCostCentreCode (input tApiEmployee.CostCentre_ID (iiCostCentreId)) in BEmployee>
tApiEmployee.tcCreditorCode = <M-10 ApiLoadEmployeeCalcCreditorCode (input tApiEmployee.Creditor_ID (iiCreditorId)) in BEmployee>
tApiEmployee.tcCurrencyCode = <M-11 ApiLoadEmployeeCalcCurrencyCode (input tApiEmployee.Currency_ID (iiCurrencyId)) in BEmployee>
tApiEmployee.tcDivisionCode = <M-12 ApiLoadEmployeeCalcDivisionCode (input tApiEmployee.Division_ID (iiDivisionId)) in BEmployee>
tApiEmployee.tcExpenseCode = <M-13 ApiLoadEmployeeCalcExpenseCode (input tApiEmployee.ExpenseCode_ID (iiExpenseCodeId)) in BEmployee>
tApiEmployee.tcProjectCode = <M-14 ApiLoadEmployeeCalcProjectCode (input tApiEmployee.Project_ID (iiProjectId)) in BEmployee>
tApiEmployee.tcUsrLogin = <M-15 ApiLoadEmployeeCalcUsrLogin (input tApiEmployee.Usr_ID (iiUsrId)) in BEmployee>.
if viFcReturnSuper < 0 or
viFcReturnSuper <> 0 and
viLocalStatus = 0
then assign viLocalStatus = viFcReturnSuper.
end.
<Q-26 run ActivityCodePrim (Stop) in BActivityCode >
<Q-28 run BusinessRelationPrim (Stop) in BBusinessRelation >
<Q-29 run CostCentrePrim (Stop) in BCostCentre >
<Q-30 run CreditorPrim (Stop) in BCreditor >
<Q-31 run CurrencyPrim (Stop) in BCurrency >
<Q-32 run DivisionPrim (Stop) in BDivision >
<Q-33 run ExpenseCodePrim (Stop) in BExpenseCode >
<Q-34 run ProjectPrim (Stop) in BProject >
<Q-35 run UserPrim (Stop) in BUser >
assign oiReturnStatus = viLocalStatus.
Sample code: how to call this method through RPCRequestService (QXtend Inbound)
define temp-table ttContext no-undo
field propertyQualifier as character
field propertyName as character
field propertyValue as character
index entityContext is primary unique
propertyQualifier
propertyName
index propertyQualifier
propertyQualifier.
define dataset dsContext for ttContext.
define variable vhContextDS as handle no-undo.
define variable vhExceptionDS as handle no-undo.
define variable vhServer as handle no-undo.
define variable vhInputDS as handle no-undo.
define variable vhInputOutputDS as handle no-undo.
define variable vhOutputDS as handle no-undo.
define variable vhParameter as handle no-undo.
/* Create context */
create ttContext.
assign ttContext.propertyName = "programName"
ttContext.propertyValue = "BEmployee".
create ttContext.
assign ttContext.propertyName = "methodName"
ttContext.propertyValue = "ApiLoadEmployee".
create ttContext.
assign ttContext.propertyName = "applicationId"
ttContext.propertyValue = "fin".
create ttContext.
assign ttContext.propertyName = "entity"
ttContext.propertyValue = "1000".
create ttContext.
assign ttContext.propertyName = "userName"
ttContext.propertyValue = "mfg".
create ttContext.
assign ttContext.propertyName = "password"
ttContext.propertyValue = "".
/* Connect the AppServer */
create server vhServer.
vhServer:connect("-URL <appserver-url>").
if not vhServer:connected()
then do:
message "Could not connect AppServer" view-as alert-box error title "Error".
return.
end.
/* Run */
assign vhContextDS = dataset dsContext:handle.
run program/rpcrequestservice.p on vhServer
(input-output dataset-handle vhContextDS by-reference,
output dataset-handle vhExceptionDS,
input dataset-handle vhInputDS by-reference,
input-output dataset-handle vhInputOutputDS by-reference,
output dataset-handle vhOutputDS).
/* Handle output however you want, in this example, we dump it to xml */
if valid-handle(vhExceptionDS)
then vhExceptionDS:write-xml("file", "Exceptions.xml", true).
if valid-handle(vhOutputDS)
then vhOutputDS:write-xml("file", "Output.xml", true).
/* Cleanup */
vhServer:disconnect().
assign vhServer = ?.
if valid-handle(vhInputDS)
then delete object vhInputDS.
if valid-handle(vhOutputDS)
then delete object vhOutputDS.
if valid-handle(vhExceptionDS)
then delete object vhExceptionDS.