project QadFinancials > class BCompanyProperty > method ValidateComponent

Description

Validates the CompanyProperty records.
The main logic is:
1) it will fill all mandatory fields with default value if they are not filled.
2) the method PreValidateComponent is called before the ancestor code.
3) after executing the ancestor code, there is a validation check for the business relation to make sure a business relation is only linked to a single entity.
4) validate whether a primary entity switch is allowed.
5) the the following Consolidation checks will be executed:
- IsConsolid can not be changed from true to false if a ConsolidCycle record exists
- IsConsolid can not be changed from false to true when postings exist
- IsConsolid can not be changed from false to true when unposted transactions exist
6) validation check to make sure that exchange rate tolerances are at least zero and not greater than 100.


Parameters


oiReturnStatusoutputinteger


Internal usage


unused


program code (program/bcompanyproperty.p)

/* Make sure all mfg class instances are stopped */
<M-38 run StopExternalInstances  (output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>

/* backwards compatibility : fill all mandatory fields if not filled yet */
for each t_sCompanyProperty :
    if t_sCompanyProperty.CompanyPropertyOINetRestr = ? or t_sCompanyProperty.CompanyPropertyOINetRestr = "":U
    then assign t_sCompanyProperty.CompanyPropertyOINetRestr = {&COMPANYPROPERTYOINETRESTR-NONE}.
    if t_sCompanyProperty.CompanyPropertyIsOICrossCy = ? 
    then assign t_sCompanyProperty.CompanyPropertyIsOICrossCy = true.
    if t_sCompanyProperty.CompanyPropertyIsCompens = ? 
    then assign t_sCompanyProperty.CompanyPropertyIsCompens = true.
    if t_sCompanyProperty.CompanyPropertyIsWHT = ? 
    then assign t_sCompanyProperty.CompanyPropertyIsWHT = false.
    if t_sCompanyProperty.CompanyPropertyIsSuspPaid = ?
    then assign t_sCompanyProperty.CompanyPropertyIsSuspPaid = false.    
    if t_sCompanyProperty.CompanyPropertyIsDelPaid = ?
    then assign t_sCompanyProperty.CompanyPropertyIsDelPaid = false.
    if t_sCompanyProperty.CompanyPropertyIsDocPerInv = ?
    then assign t_sCompanyProperty.CompanyPropertyIsDocPerInv = false.    
    if t_sCompanyProperty.CompanyPropertyIsGrIncAcc = ?
    then assign t_sCompanyProperty.CompanyPropertyIsGrIncAcc = false.
end.

/* =========================================== */
/* Validation-Checks - state ID based on codes */
/* =========================================== */
<M-1 run PreValidateComponent  (output viPreValidateReturnStatus (oiReturnStatus)) in BCompanyProperty>
    
<ANCESTOR-CODE>
    
<M-11 run ValidateComponentModify  (output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.

/* ========================================================================== */
/* Validation-Checks - Make sure a BusRel is only linked to a single Company  */
/* ========================================================================== */
for each t_sCompanyProperty where 
         t_sCompanyProperty.BusinessRelation_ID <> 0 and 
         t_sCompanyProperty.BusinessRelation_ID <> ? and 
         (t_sCompanyProperty.tc_Status = "N":U or
          t_sCompanyProperty.tc_Status = "C":U) :
    <Q-6 run CompanyPropertyByIdCode (all) (Read) (NoCache)
       (input ?, (CompanyId)
        input ?, (CompanyPropertyId)
        input t_sCompanyProperty.BusinessRelation_ID, (BusinessRelationId)
        input ?, (CurrencyId)
        input ?, (CompanyPropertyCode)
        input ?, (CompanyCode)
        input ?, (BusinessRelationCode)
        input ?, (CurrencyCode)
        output dataset tqCompanyPropertyByIdCode) in BCompanyProperty >
    find first tqCompanyPropertyByIdCode where 
               tqCompanyPropertyByIdCode.tiBusinessRelation_ID  = t_sCompanyProperty.BusinessRelation_ID and 
               tqCompanyPropertyByIdCode.tiCompanyProperty_ID  <> t_sCompanyProperty.CompanyProperty_ID
               no-lock no-error.
    if available tqCompanyPropertyByIdCode
    then do :
        assign vcMessage      = trim(substitute(#T-8'The business relation (&1) is already linked to another entity (&2).':255(1312)T-8#,trim(t_sCompanyProperty.tcBusinessRelationCode),trim(tqCompanyPropertyByIdCode.tcCompanyPropertyCode))) + chr(10) + 
                                trim(substitute(#T-9'Current entity code: &1.':255(1313)T-9#,trim(t_sCompanyProperty.CompanyPropertyCode))) + chr(10) + 
                                trim(substitute(#T-10'Current entity ID: &1.':255(1314)T-10#,trim(string(t_sCompanyProperty.CompanyProperty_ID)))).
               oiReturnStatus = min(-1, oiReturnStatus).
        <M-5 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  'tCompanyProperty.tcBusinessRelationCode':U (icFieldName), 
            input  t_sCompanyProperty.tcBusinessRelationCode (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  t_sCompanyProperty.tc_Rowid (icRowid), 
            input  'QADFIN-2789':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>
    end. /* if available tqCompanyPropertyByIdCode */

     <Q-39 run BusinessRelationByIDAllInfo (all) (Read) (NoCache)
        (input t_sCompanyProperty.BusinessRelation_ID, (BusinessRelation_ID)
         output dataset tqBusinessRelationByIDAllInfo) in BBusinessRelation >

     for first tqBusinessRelationByIDAllInfo where
               tqBusinessRelationByIDAllInfo.tiBusinessRelation_ID      = t_sCompanyProperty.BusinessRelation_ID and
               tqBusinessRelationByIDAllInfo.tlBusinessRelationIsInComp <> true
               :
        assign vcMessage      = #T-40'An entity can only be associated with a business relation which is defined for an internal entity.':255(65154)t-40#
               oiReturnStatus = min(-1, oiReturnStatus).

        <M-41 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tCompanyProperty.BusinessRelationCode':U (icFieldName), 
            input  t_sCompanyProperty.tcBusinessRelationCode (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  '' (icRowid), 
            input  'QadFin-6938':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>
    end. /* for first */
end. /* for each t_sCompanyProperty where */
    
/* ============================================== */
/* Actions for the CompanyPropertyIsPrimary       */
/* ============================================== */

/* Find out if a Primary company switch is allowed, validate if not... */
<I-14 {bFcOpenInstance
     &CLASS           = "Session"}>
<M-15 run GetLogicalValue
   (input  'AllowPrimaryCompanyChange':U (icName), 
    output vlAllowPrimaryCompanyChange (olValue), 
    output viFcReturnSuper (oiReturnStatus)) in Session>                       
<I-16 {bFcCloseInstance
     &CLASS           = "Session"}>                           

if vlAllowPrimaryCompanyChange <> true
then do:
    for each t_sCompanyProperty:
        
        assign vlSwitchingPrimaryCompany = no.
    
        if t_sCompanyProperty.tc_Status = "N":U 
        then assign vlSwitchingPrimaryCompany = t_sCompanyProperty.CompanyPropertyIsPrimary.
                /* MTDXXX Do I need to check whether this is the first company defined?  in which 
                 * case it would be ok to make it the primary company for the domain
                 */
        
        /* If we're modifying the record, then check whether we're changing the CompanyPropertyIsPrimary flag... */
        else if t_sCompanyProperty.tc_Status = "C":U 
             then do:        
                 find t_iCompanyProperty where 
                      t_iCompanyProperty.tc_Rowid = t_sCompanyProperty.tc_Rowid
                      no-lock no-error.
                 if not available t_iCompanyProperty
                 then next.
                 assign vlSwitchingPrimaryCompany = t_iCompanyProperty.CompanyPropertyIsPrimary <> t_sCompanyProperty.CompanyPropertyIsPrimary.
             end. /* tc_status = "C" */
        
        if vlSwitchingPrimaryCompany = true
        then do:
            assign viLocalReturnStatus = -1
                   vcMessage           = trim(#T-13'You cannot change the primary entity for the domain in this screen.':80(31943)t-13#).
    
            <M-17 run SetMessage
               (input  vcMessage (icMessage), 
                input  '' (icArguments), 
                input  't_sCompanyProperty.CompanyPropertyIsPrimary':U (icFieldName), 
                input  t_sCompanyProperty.CompanyPropertyIsPrimary (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sCompanyProperty.tc_Rowid (icRowid), 
                input  'QadFin-4914':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>
        end. /* if vlSwitchingPrimaryCompany = true */
    end. /* for each t_sCompanyProperty */
end. /* if vlAllowPrimaryCompanyChange <> yes */
else do:
    /* Clear the setting to allow a primary company switch... */
    <I-18 {bFcOpenInstance
         &CLASS           = "Session"}>
                       
    <M-19 run SetLogicalValue
       (input  'AllowPrimaryCompanyChange':U (icName), 
        input  false (ilValue), 
        output viLocalReturnStatus (oiReturnStatus)) in Session>                      
    <I-20 {bFcCloseInstance
         &CLASS           = "Session"}> 
end.

for each t_sCompanyProperty where 
         (t_sCompanyProperty.tc_Status = "N":U or
          t_sCompanyProperty.tc_Status = "C":U) :
    /* =================================================================================== */              
    /* Consolidation checks:                                                               */
    /* - IsConsolid can not be changed from true to false if a ConsolidCycle record exists */
    /* - IsConsolid can not be changed from false to true when postings exist              */
    /* - IsConsolid can not be changed from false to true when unposted transactions exist */
    /* =================================================================================== */
    if t_sCompanyProperty.tc_Status = "C":U
    then do:
        find t_iCompanyProperty where
             t_iCompanyProperty.tc_Rowid = t_sCompanyProperty.tc_Rowid
             no-lock no-error.
        if not available t_iCompanyProperty
        then next.
        
        if t_sCompanyProperty.CompanyPropertyIsConsolid = false and
           t_iCompanyProperty.CompanyPropertyIsConsolid = true
        then do:
            <Q-29 assign vlFcQueryRecordsAvailable = ConsolidCycleByCompanyID (NoCache)  (input t_sCompanyProperty.Company_ID, (CompanyId)) in BConsolidCycle >
            if vlFcQueryRecordsAvailable <> false
            then do:
                assign vcMessage           = trim(#T-30'A consolidation cycle already exists for this entity. The Consolidation field cannot be cleared.':200(57285)T-30#)         
                       viLocalReturnStatus = -1.
                <M-31 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  'tCompanyProperty.CompanyPropertyIsConsolid':U (icFieldName), 
                    input  string(t_sCompanyProperty.CompanyPropertyIsConsolid) (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  t_sCompanyProperty.tc_Rowid (icRowid), 
                    input  'QadFin-5840':U (icFcMsgNumber), 
                    input  '':U (icFcExplanation), 
                    input  '':U (icFcIdentification), 
                    input  '':U (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>                       
            end. /* ConsolidCycle record exists */
        end. /* IsConsolid moved from true to false */
        
        if t_sCompanyProperty.CompanyPropertyIsConsolid = true and
           t_iCompanyProperty.CompanyPropertyIsConsolid = false
        then do: 
            <Q-32 assign vlFcQueryRecordsAvailable = PostingPrim (NoCache)
               (input t_sCompanyProperty.Company_ID, (CompanyId)
                input '':U, (JournalCode)
                input 0, (PeriodYear)
                input 0, (PostingVoucher)
                input 0, (PostingID)) in BPosting >
            if vlFcQueryRecordsAvailable <> false
            then do:
                assign vcMessage           = trim(#T-33'Postings already exist for this entity. The Consolidation field cannot be selected.':200(57286)T-33#)
                       viLocalReturnStatus = -1.
                <M-34 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  'tCompanyProperty.CompanyPropertyIsConsolid':U (icFieldName), 
                    input  string(t_sCompanyProperty.CompanyPropertyIsConsolid) (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  t_sCompanyProperty.tc_Rowid (icRowid), 
                    input  'QadFin-5841':U (icFcMsgNumber), 
                    input  '':U (icFcExplanation), 
                    input  '':U (icFcIdentification), 
                    input  '':U (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>                       
            end. /* Posting records exist */                
            
            <Q-35 assign vlFcQueryRecordsAvailable = TransactionByDateType (NoCache)
               (input t_sCompanyProperty.tcDomainCode, (Domain)
                input t_sCompanyProperty.CompanyPropertyCode, (Entity)
                input '':U, (Type)
                input ?, (StartDate)
                input ?, (EndDate)) in BMfgUnpostedTransDetail >
            if vlFcQueryRecordsAvailable <> false
            then do:
                assign vcMessage           = trim(#T-36'Unposted transactions already exist for this entity. The Consolidation field cannot be selected.':200(57287)T-36#)
                       viLocalReturnStatus = -1.
                <M-37 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  'tCompanyProperty.CompanyPropertyIsConsolid':U (icFieldName), 
                    input  string(t_sCompanyProperty.CompanyPropertyIsConsolid) (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  t_sCompanyProperty.tc_Rowid (icRowid), 
                    input  'QadFin-5842':U (icFcMsgNumber), 
                    input  '':U (icFcExplanation), 
                    input  '':U (icFcIdentification), 
                    input  '':U (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>
            end. /* Unposted transactions exist */
        end. /* IsConsolid moved from false to true */
    end. /* tc_status = "C" */                          

    /* ========================================================================== */
    /* Validation-Checks - Make sure that exchange rate tolerances are at least   */
    /* zero and not greater than 100.                                             */
    /* ========================================================================== */             
    vcFieldName=?.
    if(t_sCompanyProperty.CompanyPropertyExchTolAP < 0 or
       t_sCompanyProperty.CompanyPropertyExchTolAP > 100) then do:
        assign
            vcFieldName="CompanyProperty.CompanyPropertyExchTolAP":U
            vcFieldValue=string(t_sCompanyProperty.CompanyPropertyExchTolAP,"->>>>>>9.99":U).
    end.                                                                    
    if(t_sCompanyProperty.CompanyPropertyExchTolAR < 0 or
       t_sCompanyProperty.CompanyPropertyExchTolAP > 100) then do:
        assign
            vcFieldName="CompanyProperty.CompanyPropertyExchTolAR":U
            vcFieldValue=string(t_sCompanyProperty.CompanyPropertyExchTolAR,"->>>>>>9.99":U).
    end.                                                                    
    if(vcFieldName <> ?) then do:
       assign vcMessage =  #T-28'Exchange rate tolerance must be at least zero and no greater than 100.':100(56495)t-28#.
              oiReturnStatus = min(-1, oiReturnStatus).
       <M-27 run SetMessage
          (input  vcMessage (icMessage), 
           input  '' (icArguments), 
           input  vcFieldName (icFieldName), 
           input  vcFieldValue (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  '' (icRowid), 
           input  'QadFin-5716':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>
    end. /* if(t_sCompanyProperty.CompanyPropertyHoldAmountTC < 0) */
    
    /* the next withholding tax number cannot be different from zero when withholding tax is not activated */
    if t_sCompanyProperty.CompanyPropertyWHTNextNbr <> 0 and 
       t_sCompanyProperty.CompanyPropertyWHTNextNbr <> ? and
       t_sCompanyProperty.CompanyPropertyIsWHT       = false
    then do:
        assign vcMessage           =  trim(#T-82'You cannot enter the Next WHT Number when the Withholding Tax field is not selected.':100(655243560)T-82#)
               viLocalReturnStatus = -1.
       <M-98 run SetMessage
          (input  vcMessage (icMessage), 
           input  '' (icArguments), 
           input  'tCompanyProperty.CompanyPropertyIsWHT':U (icFieldName), 
           input  t_sCompanyProperty.CompanyPropertyIsWHT (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  '' (icRowid), 
           input  'qadfin-633050':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>
    end.
    
    /* ========================================================================== */
    /* Validation on suspended and Delayed Tax: Suspend Until Paid and Delay      */
    /* Until Paid can only be enabled when Suspend Tax and Delayed Tax are        */
    /* enabled.                                                                   */
    /* ========================================================================== */
    if t_sCompanyProperty.CompanyPropertySuspTax    = {&SUSPDELAYTAX-NOTAPPLICABLE} and
       t_sCompanyProperty.CompanyPropertyIsSuspPaid <> false
    then do:
        assign vcMessage           = trim(#T-4'Suspend until Paid status are only enabled when suspended tax field has a value other than Not Applicable.':255(414723002)T-4#)
               viLocalReturnStatus = -1.
        <M-77 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tCompanyProperty.CompanyPropertyIsSuspPaid':U (icFieldName), 
            input  t_sCompanyProperty.CompanyPropertyIsSuspPaid (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  '' (icRowid), 
            input  'qadfin-211450':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>        
    end.
    
    if t_sCompanyProperty.CompanyPropertyDelTax    = {&SUSPDELAYTAX-NOTAPPLICABLE} and
       t_sCompanyProperty.CompanyPropertyIsDelPaid <> false
    then do:
        assign vcMessage           = trim(#T-67'Delay until Paid status are only enabled when delayed tax field has a value other than Not Applicable.':255(994962371)T-67#)
               viLocalReturnStatus = -1.
        <M-56 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tCompanyProperty.CompanyPropertyIsDelPaid':U (icFieldName), 
            input  t_sCompanyProperty.CompanyPropertyIsDelPaid (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  '' (icRowid), 
            input  'qadfin-603356':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>        
    end.    

    /* ========================================================================== */
    /* Validation for Source Entity: it can not be a entity out of the same       */
    /* domain, cannot be a entity with Additional GL Numbering off, cannot be a   */
    /* entity that is already have source entity.                                 */
    /* ========================================================================== */
    <Q-52 run CompanyByCompanyIdCode (all) (Read) (NoCache)
       (input t_sCompanyProperty.Company_ID, (CompanyId)
        input ?, (CompanyCode)
        output dataset tqCompanyByCompanyIdCode) in BCompany >

    for first tqCompanyByCompanyIdCode:    
        if t_SCompanyProperty.SharedAddNrCompany_ID > 0
        then do:
            <Q-92 run CompanyPropertyByDomainID (all) (Read) (NoCache)
               (input t_SCompanyProperty.SharedAddNrCompany_ID, (CompanyId)
                input tqCompanyByCompanyIdCode.tiDomain_ID, (DomainID)
                output dataset tqCompanyPropertyByDomainID) in BCompanyProperty >
            for first tqCompanyPropertyByDomainID:
                /* Source Entity must turn on the Additional GL Numbering */
                if not tqCompanyPropertyByDomainID.tlCompanyPropertyIsAddGLNbr
                then do:
                    assign vcMessage       =  trim(#T-7'Source Entity does not turn on the Additional GL Numbering':100(337766564)T-7#)
                       viLocalReturnStatus = -1.
                    <M-73 run SetMessage
                       (input  vcMessage (icMessage), 
                        input  '' (icArguments), 
                        input  'tCompanyProperty.SharedAddNrCompany_ID':U (icFieldName), 
                        input  t_sCompanyProperty.SharedAddNrCompany_ID (icFieldValue), 
                        input  'E':U (icType), 
                        input  3 (iiSeverity), 
                        input  '' (icRowid), 
                        input  'qadfin-302812':U (icFcMsgNumber), 
                        input  '' (icFcExplanation), 
                        input  '' (icFcIdentification), 
                        input  '' (icFcContext), 
                        output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>
                end. /* If not tqCompanyPropertyByDomainID */
                /* Source Entity cannot be a child entity */
                if tqCompanyPropertyByDomainID.tiSharedAddNrCompany_ID > 0
                then do:
                    assign vcMessage       =  trim(#T-54'An Entity that already has Source Entity cannot be referenced to other entities':100(413426535)T-54#)
                       viLocalReturnStatus = -1.
                    <M-61 run SetMessage
                       (input  vcMessage (icMessage), 
                        input  '' (icArguments), 
                        input  'tCompanyProperty.SharedAddNrCompany_ID':U (icFieldName), 
                        input  t_sCompanyProperty.SharedAddNrCompany_ID (icFieldValue), 
                        input  'E':U (icType), 
                        input  3 (iiSeverity), 
                        input  '' (icRowid), 
                        input  'qadfin-586603':U (icFcMsgNumber), 
                        input  '' (icFcExplanation), 
                        input  '' (icFcIdentification), 
                        input  '' (icFcContext), 
                        output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>
                end. /* If tqCompanyPropertyByDomainID... */
            end. /* For first tqCompanyPropertyByDomainID */
            
            /* Must in the same domain */
            if not available tqCompanyPropertyByDomainID then do:
                assign vcMessage           =  trim(#T-57'Source Entity should be in the same Domain with the current Entity':100(55806695)T-57#)
                       viLocalReturnStatus = -1.
                <M-3 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '' (icArguments), 
                    input  'tCompanyProperty.SharedAddNrCompany_ID':U (icFieldName), 
                    input  t_sCompanyProperty.SharedAddNrCompany_ID (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  '' (icRowid), 
                    input  'qadfin-766422':U (icFcMsgNumber), 
                    input  '' (icFcExplanation), 
                    input  '' (icFcIdentification), 
                    input  '' (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BCompanyProperty>
            end. /* if not available tqCompanyPropertyByDomainID... */
        end. /* t_SCompanyProperty.SharedAddNrCompany_ID > 0 */
    end. /* for first tqCompanyByCompanyIdCode */    
    
end. /* for each t_sCompanyProperty where */

/* =========================================== */
/* State correct return status                 */
/* =========================================== */   
assign oiReturnStatus = viLocalReturnStatus when oiReturnStatus > viLocalReturnStatus.
    
if oiReturnStatus < 0
then return.

if viPreValidateReturnStatus < 0
then do:
    assign oiReturnStatus = viPreValidateReturnStatus.
    return.
end.