project QadFinancials > class BGrossIncomeAccounting > method DataLoadByInput

Description

This method loads database records corresponding to input values (records found in the t_s*** tables).
When nothing found in the database, a new record should be initialised.
Input values should also be updated with :
- identity fields (override input values)
- tc_Rowid / tc_ParentRowid / tc_Status

Annotation

This template can be used to implement the code for this method.

* Replace [MainTableName] with the name of the main table in the class dataset (no prefixes).
* This template assumes that the main table has an identity field, and this field is the only field of the primary index of the table. Replace [PrimaryKeyFieldName] with the name of this field.
* This template assumes that the table has one logical alternate key (a key that is visible and editable to end-users) with one field. Replace [LogicalKeyFieldName] with the name of this field. If the logical key contains more than one field, repeat the code with this tag for every field in the key.
* The run statement following [METHOD CALL] should not be copied literally, but inserted as a method call (run the method in your own component).




for each t_s[MainTableName] by rowid(t_s[MainTableName]) on error undo, throw:

/* ================================================================= */
/* Lookup object by logical key */
/* When in create mode, skip lookup. */
/* ================================================================= */
if vcActivityCode <> "Create":U
then do:
vcFreeform = "for each [MainTableName] where [MainTableName].[LogicalKeyFieldName] = '":U + t_s[MainTableName].[LogicalKeyFieldName] + "'":U.
[METHOD CALL]
run DataLoad
(input '' (icRowids),
input '' (icPkeys),
input '' (icObjectIds),
input vcFreeform (icFreeform),
input yes (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus))
if viFcReturnSuper >= 0
then do:
/* DataLoad succeeded, no no-error needed */
find first t[MainTableName] where t[MainTableName].[LogicalKeyFieldName] = t_s[MainTableName].[LogicalKeyFieldName].
if t[MainTableName].tc_Status <> ""
then do:
[METHOD CALL]
run SetMessage
(input [duplicate key error] (icMessage),
input t_s[MainTableName].[LogicalKeyFieldName] (icArguments),
input 't[MainTableName].[LogicalKeyFieldName]':U (icFieldName),
input t_s[MainTableName].[LogicalKeyFieldName] (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_s[MainTableName].tc_Rowid (icRowid),
input 'ERR-xyz':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus))
assign oiReturnStatus = -1.
return.
end.
end.
end.

/* ================================================================= */
/* When in delete mode, ignore input data. */
/* When object not found, do not return an error. */
/* ================================================================= */
if vcActivityCode = "Delete":U
then do:
if viFcReturnSuper = -4
then delete t_s[MainTableName].
else do:
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

/* keep the UI rowid for usage in error messages (tFcMessages.tcFcRowid) */
[METHOD CALL]
run SetRowidConvert
(input t_s[MainTableName].tc_Rowid (icOldRowid),
input t[MainTableName].tc_Rowid (icNewRowid),
output viFcReturnSuper (oiReturnStatus))

/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
assign t_s[MainTableName].tc_Rowid = t[MainTableName].tc_Rowid
t_s[MainTableName].tc_ParentRowid = ""
opPrimeKey = (if opPrimeKey = "" then "" else opPrimeKey + chr(4))
+ string(t[MainTableName].[PrimaryKeyFieldName]).
end.

next.
end.

if vcActivityCode = "Create":U
or viFcReturnSuper = -4
then do:
/* ================================================================= */
/* When object not found and in modify only mode, return an error. */
/* ================================================================= */
if vcActivityCode = "Modify":U
then do:
[METHOD CALL]
run SetMessage
(input #T'Object with key $1 does not exist.':100T# (icMessage),
input t_s[MainTableName].[LogicalKeyFieldName] (icArguments),
input 't[MainTableName].[LogicalKeyFieldName]':U (icFieldName),
input t_s[MainTableName].[LogicalKeyFieldName] (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_s[MainTableName].tc_Rowid (icRowid),
input 'ERR-xyz':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus))
assign oiReturnStatus = -1.
return.
end.

/* ================================================================= */
/* When object not found or in create mode, create it. */
/* ================================================================= */
[METHOD CALL]
run AddDetailLine
(input '[MainTableName]':U (icTable),
input '' (icParentRowid),
output viFcReturnSuper (oiReturnStatus))

/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
assign t_s[MainTableName].tc_Status = "N":U.
end.
else do:
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
assign t_s[MainTableName].tc_Status = "C":U
t[MainTableName].tc_Status = "C":U.
end.

if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

/* insert code for subtables here */

/* keep the UI rowid for usage in error messages (tFcMessages.tcFcRowid) */
[METHOD CALL]
run SetRowidConvert
(input t_s[MainTableName].tc_Rowid (icOldRowid),
input t[MainTableName].tc_Rowid (icNewRowid),
output viFcReturnSuper (oiReturnStatus))

/* ================================================================= */
/* override value for identity fields in input */
/* ================================================================= */
assign t_s[MainTableName].[PrimaryKeyFieldName] = t[MainTableName].[PrimaryKeyFieldName]

/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
t_s[MainTableName].tc_Rowid = t[MainTableName].tc_Rowid
t_s[MainTableName].tc_ParentRowid = ""

opPrimeKey = (if opPrimeKey = "" then "" else opPrimeKey + chr(4))
+ string(t[MainTableName].[PrimaryKeyFieldName]).
end.






If the class dataset contains more than one table, insert this code for every additional table.

/* ================================================================= */
/* Delete existing detail */
/* ================================================================= */
for each t[ChildTableName] where
t[ChildTableName].tc_ParentRowid = t[ParentTableName].tc_Rowid:
assign t[ChildTableName].tc_Status = "D":U.
end.

/* ================================================================= */
/* Update / add detail */
/* ================================================================= */
for each t_s[ChildTableName] where
t_s[ChildTableName].tc_ParentRowid = t_s[ParentTableName].tc_Rowid
on error undo, throw:

find first t[ChildTableName] where
t[ChildTableName].tc_ParentRowid = t[ParentTableName].tc_Rowid and
t[ChildTableName].[LogicalKeyFieldName] = t_s[ChildTableName].[LogicalKeyFieldName] no-error.
if available t[ChildTableName]
then if t[ChildTableName].tc_Status = "D":U
then assign t_s[ChildTableName].tc_Status = "C":U
t[ChildTableName].tc_Status = "C":U.
else do:
[METHOD CALL]
run SetMessage
(input [duplicate key error] (icMessage),
input t_s[ChildTableName].[LogicalKeyFieldName] (icArguments),
input 't[ChildTableName].[LogicalKeyFieldName]':U (icFieldName),
input t_s[ChildTableName].[LogicalKeyFieldName] (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_s[ChildTableName].tc_Rowid (icRowid),
input 'ERR-xyz':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus))
assign oiReturnStatus = -1.
return.
end.
else do:
[METHOD CALL]
run AddDetailLine (input '[ChildTableName]':U (icTable),
input t[ParentTableName].tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus))
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
assign t_s[ChildTableName].tc_Status = "N":U
t[ChildTableName].[LogicalKeyFieldName] = t_s[ChildTableName].[LogicalKeyFieldName].
end.

/* keep the UI rowid for usage in error messages (tFcMessages.tcFcRowid) */
[METHOD CALL]
run SetRowidConvert
(input t_s[ChildTableName].tc_Rowid (icOldRowid),
input t[ChildTableName].tc_Rowid (icNewRowid),
output viFcReturnSuper (oiReturnStatus))

/* ================================================================= */
/* override value for identity fields in input */
/* ================================================================= */
assign t_s[ChildTableName].[ChildPrimaryKeyFieldName] = t[ChildTableName].[ChildPrimaryKeyFieldName]

/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
t_s[ChildTableName].[ParentPrimaryKeyFieldName] = t[ChildTableName].[ParentPrimaryKeyFieldName]
t_s[ChildTableName].tc_Rowid = t[ChildTableName].tc_Rowid
t_s[ChildTableName].tc_ParentRowid = t[ParentTableName].tc_Rowid.
end.

PreCondition

The code of this method must always be overridden, not extended.


Parameters


opPrimeKeyoutputlongcharPrimary Key field value of loaded record(s).
Keys are chr(4) separated.
Key fields are chr(2) separated.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program2/bgrossincomeaccounting.p)

PROCESSBLOCK:
for each t_sGrossIncAcc on error undo, throw:
    if t_sGrossIncAcc.Company_ID = 0 or
       t_sGrossIncAcc.Company_ID = ?
    then assign t_sGrossIncAcc.Company_ID = viCompanyId.

    /* ================================================================= */
    /* Lookup object by logical key                                      */
    /* When in create mode, skip lookup.                                 */
    /* ================================================================= */
    if vcActivityCode <> "Create":U 
    then do:        
        /* ====================================================== */
        /* Resolve the ID fields to make the prim query go faster */
        /* ====================================================== */
        assign viSalesGLID            = 0
               viSalesDivisionID      = 0
               viSalesCostCentreID    = 0
               viSalesProjectID       = 0
               viTaxPayableGLID       = 0
               viTaxPayableDivisionID = 0.

        if t_sGrossIncAcc.tcSalesGLCode <> "" and
           t_sGrossIncAcc.tcSalesGLCode <> ?
        then do:
            <Q-18 run GLPrim (all) (Read) (Cache)
               (input t_sGrossIncAcc.Company_ID, (CompanyId)
                input t_sGrossIncAcc.tcSalesGLCode, (GLCode)
                input 0, (GLId)
                output dataset tqGLPrim) in BGL >
            find tqGLPrim where
                 tqGLPrim.tcGLCode = t_sGrossIncAcc.tcSalesGLCode
                 no-lock no-error.
            if available tqGLPrim
            then assign viSalesGLID = tqGLPrim.tiGL_ID.
            else assign viSalesGLID = 0.
        end. /* if t_sGrossIncAcc.tcSalesGLCode <> "" and */

        if t_sGrossIncAcc.tcSalesDivisionCode <> "" and
           t_sGrossIncAcc.tcSalesDivisionCode <> ?
        then do:
            <Q-3 run DivisionPrim (all) (Read) (Cache)
               (input t_sGrossIncAcc.Company_ID, (CompanyId)
                input 0, (DivisionID)
                input t_sGrossIncAcc.tcSalesDivisionCode, (DivisionCode)
                output dataset tqDivisionPrim) in BDivision >
            find tqDivisionPrim where
                 tqDivisionPrim.tcDivisionCode = t_sGrossIncAcc.tcSalesDivisionCode
                 no-lock no-error.
            if available tqDivisionPrim
            then assign viSalesDivisionID = tqDivisionPrim.tiDivision_ID.
            else assign viSalesDivisionID = 0.
        end. /* if t_sGrossIncAcc.tcSalesDivisionCode <> "" and */

        if t_sGrossIncAcc.tcSalesCostCentreCode <> "" and
           t_sGrossIncAcc.tcSalesCostCentreCode <> ?
        then do:
            <Q-31 run CostCentrePrim (all) (Read) (Cache)
               (input t_sGrossIncAcc.Company_ID, (CompanyId)
                input 0, (CostCentreID)
                input t_sGrossIncAcc.tcSalesCostCentreCode, (CostCentreCode)
                output dataset tqCostCentrePrim) in BCostCentre >
            find tqCostCentrePrim where
                 tqCostCentrePrim.tcCostCentreCode = t_sGrossIncAcc.tcSalesCostCentreCode
                 no-lock no-error.
            if available tqCostCentrePrim
            then assign viSalesCostCentreID = tqCostCentrePrim.tiCostCentre_ID.
            else assign viSalesCostCentreID = 0.
        end. /* if t_sGrossIncAcc.tcSalesCostCentreCode <> "" and */

        if t_sGrossIncAcc.tcSalesProjectCode <> "" and
           t_sGrossIncAcc.tcSalesProjectCode <> ?
        then do:
            <Q-24 run ProjectPrim (all) (Read) (NoCache)
               (input t_sGrossIncAcc.Company_ID, (CompanyId)
                input 0, (ProjectID)
                input t_sGrossIncAcc.tcSalesProjectCode, (ProjectCode)
                output dataset tqProjectPrim) in BProject >
            find tqProjectPrim where
                 tqProjectPrim.tcProjectCode = t_sGrossIncAcc.tcSalesProjectCode
                 no-lock no-error.
            if available tqProjectPrim
            then assign viSalesProjectID = tqProjectPrim.tiProject_ID.
            else assign viSalesProjectID = 0.
        end. /* if t_sGrossIncAcc.tcSalesProjectCode <> "" and */

        if t_sGrossIncAcc.tcTaxPayableGLCode <> "" and
           t_sGrossIncAcc.tcTaxPayableGLCode <> ?
        then do:
            <Q-80 run GLPrim (all) (Read) (Cache)
               (input t_sGrossIncAcc.Company_ID, (CompanyId)
                input t_sGrossIncAcc.tcTaxPayableGLCode, (GLCode)
                input 0, (GLId)
                output dataset tqGLPrim) in BGL >
            find tqGLPrim where
                 tqGLPrim.tcGLCode = t_sGrossIncAcc.tcTaxPayableGLCode
                 no-lock no-error.
            if available tqGLPrim
            then assign viTaxPayableGLID = tqGLPrim.tiGL_ID.
            else assign viTaxPayableGLID = 0.
        end. /* if t_sGrossIncAcc.tcTaxPayableGLCode <> "" and */

        if t_sGrossIncAcc.tcTaxPayableDivisionCode <> "" and
           t_sGrossIncAcc.tcTaxPayableDivisionCode <> ?
        then do:
            <Q-68 run DivisionPrim (all) (Read) (Cache)
               (input t_sGrossIncAcc.Company_ID, (CompanyId)
                input 0, (DivisionID)
                input t_sGrossIncAcc.tcTaxPayableDivisionCode, (DivisionCode)
                output dataset tqDivisionPrim) in BDivision >
            find tqDivisionPrim where
                 tqDivisionPrim.tcDivisionCode = t_sGrossIncAcc.tcTaxPayableDivisionCode
                 no-lock no-error.
            if available tqDivisionPrim
            then assign viTaxPayableDivisionID = tqDivisionPrim.tiDivision_ID.
            else assign viTaxPayableDivisionID = 0.
        end. /* if t_sGrossIncAcc.tcTaxPayableDivisionCode <> "" and */

        /* =================================================== */
        /* Get the GrossIncAcc_ID based on the logical key     */
        /* =================================================== */

        <Q-71 run GrossIncAccPrim (all) (Read) (NoCache)
           (input t_sGrossIncAcc.Company_ID, (CompanyId)
            input 0, (GrossIncAccID)
            input '', (SalesGLCode)
            input '', (SalesDivisionCode)
            input '', (SalesCostCentreCode)
            input '', (SalesProjectCode)
            input '', (TaxPayableGLCode)
            input '', (TaxPayableDivisionCode)
            input viSalesGLID, (SalesGLID)
            input viSalesDivisionID, (SalesDivisionID)
            input viSalesCostCentreID, (SalesCostCentreID)
            input viSalesProjectID, (SalesProjectID)
            input viTaxPayableGLID, (TaxPayableGLID)
            input viTaxPayableDivisionID, (TaxPayableDivisionID)
            output dataset tqGrossIncAccPrim) in BGrossIncomeAccounting >
        find tqGrossIncAccPrim where
             tqGrossIncAccPrim.tiCompany_ID             = t_sGrossIncAcc.Company_ID            and
             tqGrossIncAccPrim.tcSalesGLCode            = t_sGrossIncAcc.tcSalesGLCode         and
             tqGrossIncAccPrim.tcSalesDivisionCode      = t_sGrossIncAcc.tcSalesDivisionCode   and
             tqGrossIncAccPrim.tcSalesCostCentreCode    = t_sGrossIncAcc.tcSalesCostCentreCode and
             tqGrossIncAccPrim.tcSalesProjectCode       = t_sGrossIncAcc.tcSalesProjectCode    and
             tqGrossIncAccPrim.tcTaxPayableGLCode       = t_sGrossIncAcc.tcTaxPayableGLCode    and
             tqGrossIncAccPrim.tcTaxPayableDivisionCode = t_sGrossIncAcc.tcTaxPayableDivisionCode
             no-lock no-error. 
        if available tqGrossIncAccPrim
        then assign t_sGrossIncAcc.GrossIncAcc_ID = tqGrossIncAccPrim.tiGrossIncAcc_ID.

        /* ================ */
        /* Load GrossIncAcc */
        /* ================ */   
        if t_sGrossIncAcc.GrossIncAcc_ID = ? or
           t_sGrossIncAcc.GrossIncAcc_ID = 0
        then assign viFcReturnSuper = -4.
        else do:
            <M-76 run DataLoad
               (input  '' (icRowids), 
                input  '' (icPkeys), 
                input  string(t_sGrossIncAcc.GrossIncAcc_ID) (icObjectIds), 
                input  '' (icFreeform), 
                input  yes (ilKeepPrevious), 
                output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>  
        end. /* else do: */
      
        if viFcReturnSuper >= 0 
        then do:
            find tGrossIncAcc where 
                 tGrossIncAcc.GrossIncAcc_ID = t_sGrossIncAcc.GrossIncAcc_ID 
                 no-error.
            if available tGrossIncAcc and tGrossIncAcc.tc_Status <> "":U
            then do:
                assign vcMessage      = trim(#T-72'This Gross Income Accounting record was already processed in this transaction.':255(265675632)T-72#) + chr(10) + 
                                        substitute(#T-47'Sales GL Account: &1':255(396032617)T-47#,        trim(t_sGrossIncAcc.tcSalesGLCode))             + chr(10) +
                                        substitute(#T-14'Sales Sub-Account: &1':30(65104161)T-14#,         trim(t_sGrossIncAcc.tcSalesDivisionCode))       + chr(10) +
                                        substitute(#T-20'Sales Cost Center: &1':30(131895780)T-20#,        trim(t_sGrossIncAcc.tcSalesCostCentreCode))     + chr(10) +
                                        substitute(#T-83'Sales Project: &1':20(711936451)T-83#,            trim(t_sGrossIncAcc.tcSalesProjectCode))        + chr(10) +
                                        substitute(#T-90'Tax Payable GL Account: &1':255(139397117)T-90#,  trim(t_sGrossIncAcc.tcTaxPayableGLCode))        + chr(10) +
                                        substitute(#T-70'Tax Payable Sub-Account: &1':255(457076917)T-70#, trim(t_sGrossIncAcc.tcTaxPayableDivisionCode))  + chr(10) +
                                        substitute(#T-95'Company ID: &1':255(69637)T-95#,                  trim(string(t_sGrossIncAcc.Company_ID)))
                       oiReturnStatus = -1.
                <M-54 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  '' (icFieldName), 
                    input  '' (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  t_sGrossIncAcc.tc_Rowid (icRowid), 
                    input  'qadfin-26985':U (icFcMsgNumber), 
                    input  '':U (icFcExplanation), 
                    input  '':U (icFcIdentification), 
                    input  '':U (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
                return.
            end. /* if available tGrossIncAcc and tGrossIncAcc.tc_Status <> "":U */
        end. /* if viFcReturnSuper >= 0 */
    end. /* if vcActivityCode <> "Create":U */

    /* ================================================================= */
    /* When in delete mode, ignore input data.                           */
    /* When object not found, do not return an error.                    */
    /* ================================================================= */
    if vcActivityCode = "Delete":U
    then do:
        if viFcReturnSuper = -4
        then delete t_sGrossIncAcc.
        else do:
            if viFcReturnSuper <> 0
            then oiReturnStatus = viFcReturnSuper.
            if viFcReturnSuper < 0
            then leave PROCESSBLOCK.
    
            /* ================================================================= */
            /* Update input to allow correct matching                            */
            /* ================================================================= */
            assign t_sGrossIncAcc.tc_Rowid       = tGrossIncAcc.tc_Rowid
                   t_sGrossIncAcc.tc_ParentRowid = ""
                   opPrimeKey                    = (if opPrimeKey = "" then "" else opPrimeKey + chr(4))
                                                 + string(tGrossIncAcc.GrossIncAcc_ID).
        end. /* else do: */
        next.
    end. /* if vcActivityCode = "Delete":U */

    if vcActivityCode = "Create":U or 
       viFcReturnSuper = -4
    then do:
        /* ================================================================= */
        /* When object not found and in modify only mode, return an error.   */
        /* ================================================================= */
        if vcActivityCode = "Modify":U
        then do:
            assign vcMessage      = trim(#T-73'Object with this key does not exist.':255(789938300)T-73#) + chr(10) + 
                                    substitute(#T-60'Sales GL Account: &1':255(396032617)T-60#,        trim(t_sGrossIncAcc.tcSalesGLCode))             + chr(10) +
                                    substitute(#T-63'Sales Sub-Account: &1':30(65104161)T-63#,         trim(t_sGrossIncAcc.tcSalesDivisionCode))       + chr(10) +
                                    substitute(#T-78'Sales Cost Center: &1':30(131895780)T-78#,        trim(t_sGrossIncAcc.tcSalesCostCentreCode))     + chr(10) +
                                    substitute(#T-1'Sales Project: &1':20(711936451)T-1#,              trim(t_sGrossIncAcc.tcSalesProjectCode))        + chr(10) +
                                    substitute(#T-44'Tax Payable GL Account: &1':255(139397117)T-44#,  trim(t_sGrossIncAcc.tcTaxPayableGLCode))        + chr(10) +
                                    substitute(#T-45'Tax Payable Sub-Account: &1':255(457076917)T-45#, trim(t_sGrossIncAcc.tcTaxPayableDivisionCode))  + chr(10) +
                                    substitute(#T-34'Company ID: &1':255(69637)T-34#,                  trim(string(t_sGrossIncAcc.Company_ID)))
                   oiReturnStatus = -1.
            <M-17 run SetMessage
               (input  vcMessage (icMessage), 
                input  '' (icArguments), 
                input  '' (icFieldName), 
                input  '' (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sGrossIncAcc.tc_Rowid (icRowid), 
                input  'qadfin-164699':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
            leave PROCESSBLOCK.
        end. /* if vcActivityCode = "Create":U or */

        /* ================================================================= */
        /* When object not found or in create mode, create it.               */
        /* ================================================================= */
        <M-50 run AddDetailLine
           (input  'GrossIncAcc' (icTable), 
            input  '' (icParentRowid), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>

        /* ================================================================= */
        /* Update input to allow correct matching                            */
        /* ================================================================= */
        assign t_sGrossIncAcc.tc_Status = "N":U
               tGrossIncAcc.tc_Status   = "N":U. /* we need to assign this to make our test for doubles work */
    end. /* if vcActivityCode = "Create":U or */
    else do:
        /* ================================================================= */
        /* Update input to allow correct matching                            */
        /* ================================================================= */
        assign t_sGrossIncAcc.tc_Status = "C":U
               tGrossIncAcc.tc_Status   = "C":U. /* we need to assign this to make our test for doubles work */
    end. /* else do: */

    if viFcReturnSuper <> 0
    then oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0
    then leave PROCESSBLOCK.

    /* ================================================================= */
    /* override value for identity fields in input                       */
    /* ================================================================= */
    assign t_sGrossIncAcc.GrossIncAcc_ID  = tGrossIncAcc.GrossIncAcc_ID
           t_sGrossIncAcc.Company_ID      = tGrossIncAcc.Company_ID
    /* ================================================================= */
    /* Update input to allow correct matching                            */
    /* ================================================================= */
           t_sGrossIncAcc.tc_Rowid        = tGrossIncAcc.tc_Rowid
           t_sGrossIncAcc.tc_ParentRowid  = ""

           opPrimeKey                     = (if opPrimeKey = "" then "" else opPrimeKey + chr(4))
                                          + string(tGrossIncAcc.GrossIncAcc_ID).
end. /* for each t_sGrossIncAcc on error undo, throw: */