project QadFinancials > class BHistoryDaemonProcessor > method PerformWorkItemDIRECTUpdPHistFRW


Parameters


ihLocalHandleToThePersistenceinputhandle
itDateForCubeinputdate
iiTimeForCubeinputinteger
igETimeForCubeinputint64
iiPostingHistIDForCubeinputinteger
oiNbrOfCreatedQFRWCubeoutputinteger
oiNbrOfCreatedQFRWCubeSafoutputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BHistoryDaemonProcessor.PerformWorkItemDIRECTUpdPHist


program code (program1/bhistorydaemonprocessor.p)

/* ================================================================================ */ 
/* Prerequisite:                                                                    */
/*      The calling methods has to make sure a QpostingLine is available            */
/* Purpose of this method:                                                          */
/*      Create the required QFRWCube and QFRWCubeSaf records for that QPostingLine  */
/* ================================================================================ */
/* Indicate Direct db-access (find, update and create) is done here                 */
<I-84 {WRITEDIRECTDBACCESS
     &WRITETABLENAMES = "'QFRWCubeSaf,QFRWCube'"}>


/* ============================================================================== */ 
/* Prerequisite: The calling methods has to make sure a QpostingLine is available */
/* ============================================================================== */ 
if not available QpostingLine
then do :  
    assign oiReturnStatus  = -3
           vcMsgHist       = trim(substitute(#T-23'Internal error: mandatory information in the program code is not accessible; see below for more details.':255(70321)T-23#)) + chr(10) + 
                             trim(substitute(#T-15'Record for table &1 is not available in method &2.':255(587056425)T-15#,"QpostingLine":U,"PerformWorkItemDIRECTUpdPHistFRW":U)).
    <M-45 run SetMessage
       (input  vcMsgHist (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'qadfin-433354':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BHistoryDaemonProcessor>
    Return.
end. /* if not available QpostingLine */


/* ================================================================================================= */
/* Create QFRWCube and QFRWCubeSaf records                                                           */
/* If the QPostingLines are from the Rebuild Account Balance then do not create the QFRWCube Records */
/* ================================================================================================= */
if can-find (first FRWCube) and 
   QPostingLine.QPostingLineIsAccountRebuild = no
then do:
    /* Create the actual records */
    /* Now the logic is changed to create QFRWCube records for each Operational FRWCube */
    for each FRWCube where FRWCube.FRWCubeIsAllowedCreateQFRWCube no-lock:
        create QFRWCube.
        assign oiNbrOfCreatedQFRWCube               = oiNbrOfCreatedQFRWCube + 1
               vhFcComponent                        = ihLocalHandleToThePersistence
               QFRWCube.QFRWCube_ID                 = <M-38 GetNextValue  (input  'ObjectNumber':U (icSequence)) in Progress>
               QFRWCube.FRWCube_ID                  = FRWCube.FRWCube_ID
               QFRWCube.Company_ID                  = QPostingLine.Company_ID
               QFRWCube.GL_ID                       = QPostingLine.GL_ID
               QFRWCube.Journal_ID                  = QPostingLine.Journal_ID
               QFRWCube.Layer_ID                    = QPostingLine.Layer_ID
               QFRWCube.Currency_ID                 = QPostingLine.Currency_ID
               QFRWCube.Division_ID                 = QPostingLine.Division_ID
               QFRWCube.Project_ID                  = QPostingLine.Project_ID
               QFRWCube.CostCentre_ID               = QPostingLine.CostCentre_ID
               QFRWCube.Layer_ID                    = QPostingLine.Layer_ID
               QFRWCube.IntercoBusinessRelation_ID  = QPostingLine.IntercoBusinessRelation_ID
               QFRWCube.Period_ID                   = QPostingLine.Period_ID
               QFRWCube.PeriodYearPeriod            = QPostingLine.PeriodYearPeriod
               QFRWCube.QFRWCubeDebitTC             = QPostingLine.QPostingLineDebitTC
               QFRWCube.QFRWCubeDebitLC             = QPostingLine.QPostingLineDebitLC
               QFRWCube.QFRWCubeDebitCC             = QPostingLine.QPostingLineDebitCC
               QFRWCube.QFRWCubeCreditTC            = QPostingLine.QPostingLineCreditTC
               QFRWCube.QFRWCubeCreditLC            = QPostingLine.QPostingLineCreditLC
               QFRWCube.QFRWCubeCreditCC            = QPostingLine.QPostingLineCreditCC
               QFRWCube.JournalTypeCode             = QPostingLine.JournalTypeCode
               QFRWCube.QFRWCubeInfo                = QPostingLine.QPostingLineInfo
               QFRWCube.QFRWCubeQTY                 = QPostingLine.QPostingLineQTY
               QFRWCube.PostingHist_ID              = iiPostingHistIDForCube
               QFRWCube.QFRWCubePostingDate         = QPostingLine.QPostingDate
               QFRWCube.QFRWCubePHLastModifiedDate  = itDateForCube
               QFRWCube.QFRWCubePHLastModifiedTime  = iiTimeForCube
               QFRWCube.QFRWCubeETime               = igETimeForCube.        
        for each QPostingSaf no-lock where
                 QPostingSaf.QPostingLine_ID = QPostingLine.QPostingLine_ID
                 on error undo, throw:                 
            create QFRWCubeSaf.
            assign oiNbrOfCreatedQFRWCubeSAF            = oiNbrOfCreatedQFRWCubeSAF + 1
                   vhFcComponent                        = ihLocalHandleToThePersistence
                   QFRWCubeSaf.QFRWCubeSaf_ID           = <M-78 GetNextValue  (input  'ObjectNumber':U (icSequence)) in Progress>
                   QFRWCubeSaf.QFRWCube_ID              = QFRWCube.QFRWCube_ID
                   QFRWCubeSaf.QFRWCubeSafInputSequence = QPostingSaf.QPostingSafInputSequence
                   QFRWCubeSaf.QFRWCubeSafParentType    = QPostingSaf.QPostingSafParentType
                   QFRWCubeSaf.Saf_ID                   = QPostingSaf.Saf_ID
                   QFRWCubeSaf.SafStructure_ID          = QPostingSaf.SafStructure_ID.
         end. /* for each QPostingSaf  */
     end. /* for each FRWCube */
end. /* if can-find (first FRWCube) and */

/* ==================== */
/* Release used buffers */
/* ==================== */
release QFRWCube.
release QFRWCubeSaf.