project QadFinancials > class BExchangeRateType > method UpdateExchangeRateType

Description

Updates all tExchangeRateType records passed in an input-output parameter.


Parameters


bvBExchangeRateTypeinput-outputdatasettExchangeRateType temp-table to pass data to and from the method.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BGL.CreateExchangeRateTypeInFlight


program code (program1/bexchangeratetype.p)

for each t_sExchangeRateType where 
         t_sExchangeRateType.tc_Status <> "":U:
    find tExchangeRateType of t_sExchangeRateType no-error.
    if not available tExchangeRateType
    then do:
        if t_sExchangeRateType.tc_Status = "N":U
        /* create a new record */
        then do:
            <M-1 run AddDetailLine (input  'ExchangeRateType':U (icTable), 
                         input  '':U (icParentRowid), 
                         output viFcReturnSuper (oiReturnStatus)) in BExchangeRateType>
            if viFcReturnSuper <> 0
            then do:
                /* error handling */
                <M-2 run SetMessage
          (input  trim(#T-9'The detail line could not be added. The system was unable to create the exchange rate type.':100(1889)t-9#) (icMessage), 
           input  '':U (icArguments), 
           input  '':U (icFieldName), 
           input  '':U (icFieldValue), 
           input  'D':U (icType), 
           input  2 (iiSeverity), 
           input  '':U (icRowid), 
           input  'QADFIN-168':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BExchangeRateType>
                assign oiReturnStatus = -1.
                return.
            end.            
        end. /* create */
        /* load the existing record */
        else do:
            <M-3 run DataLoad
          (input  '':U (icRowids), 
           input  string(t_sExchangeRateType.ExchangeRateType_ID) (icPkeys), 
           input  '':U (icObjectIds), 
           input  '' (icFreeform), 
           input  true (ilKeepPrevious), 
           output viFcReturnSuper (oiReturnStatus)) in BExchangeRateType>
            if viFcReturnSuper <> 0
            then do:
                <M-4 run SetMessage
          (input  trim(#T-10'The detail line could not be added. The system was unable to modify the exchange rate type.':100(1890)t-10#) (icMessage), 
           input  '':U (icArguments), 
           input  '':U (icFieldName), 
           input  '':U (icFieldValue), 
           input  'D':U (icType), 
           input  2 (iiSeverity), 
           input  '':U (icRowid), 
           input  'QADFIN-169':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BExchangeRateType>
                assign oiReturnStatus = -1.
                return.
            end.
            if not available tExchangeRateType 
            then do:
                if can-find(first tExchangeRateType where tExchangeRateType.ExchangeRateType_ID = t_sExchangeRateType.ExchangeRateType_ID) 
                then do:
                    find first tExchangeRateType where tExchangeRateType.ExchangeRateType_ID = t_sExchangeRateType.ExchangeRateType_ID.
                end.
                else do:
                    <M-5 run SetMessage
          (input  trim(#T-11'The data have been successfully loaded, but the exchange rate type is not available.':100(1891)T-11#) (icMessage), 
           input  '':U (icArguments), 
           input  '':U (icFieldName), 
           input  '':U (icFieldValue), 
           input  'D':U (icType), 
           input  2 (iiSeverity), 
           input  '':U (icRowid), 
           input  'QADFIN-170':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BExchangeRateType>                    
                assign oiReturnStatus = -1.
                return.                    
                end.
            end.
        end. /* load the existing record */
        if not available tExchangeRateType
        then do:
            /* error handling */
            <M-6 run SetMessage (input  trim(#T-12'The Exchange Rate Type is not available.':100(1892)t-12#) (icMessage),
                     input  '':U (icArguments),
                     input  '':U (icFieldName),
                     input  '':U (icFieldValue),
                     input  'D':U (icType),
                     input  2 (iiSeverity),
                     input  '':U (icRowid),
                     input  'QADFIN-171':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BExchangeRateType>
            assign oiReturnStatus = -1.
            return.
        end.
    end.
    if t_sExchangeRateType.tc_Status = "D":U
    then assign tExchangeRateType.tc_Status = "D":U.
    else  buffer-copy t_sExchangeRateType except ExchangeRateType_ID tc_Rowid tc_ParentRowid to tExchangeRateType.
end. /* for each */

<M-7 run ValidateBC (output viFcReturnSuper (oiReturnStatus)) in BExchangeRateType>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
<M-8 run AdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BExchangeRateType>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.