project QadFinancials > class BJournal > method AdditionalUpdates

Description

This method is part of the SetPublicTables flow.
When executed, data in the input class tables (prefix t_s) is validated and found correct, and copied into the class tables (prefix t_o).
This method can be extended to do updates that do not require a validation or that involve running business methods of other business classes. These classes should be started with ADD-TO-TRANSACTION = 'true'. Also make sure to add these classes in method StopExternalInstances.


Parameters


oiReturnStatusoutputinteger


Internal usage


QadFinancials
method BJournal.ApiGenerateInitialJournals
method BJournal.ApiStdMaintainTT


program code (program/bjournal.p)

<ANCESTOR-CODE>
        
/* Error handling */                                                 
assign oiReturnStatus = -98
       viLocalReturnStatus  = 0.
       
empty temp-table tValidMfgJournal.

/* Journals should only be replicated when they are of type 'Logistic' */
for each t_sJournal no-lock:
    /* Find the previous version */
    find first t_iJournal where 
        t_iJournal.Journal_ID = t_sJournal.Journal_ID no-lock no-error.
        
    if available t_iJournal and
       ((t_iJournal.JournalControl = {&JOURNALCONTROL-LOGISTIC} or
        t_sJournal.JournalControl = {&JOURNALCONTROL-LOGISTIC}) and
        t_iJournal.JournalControl <> t_sJournal.JournalControl) then do:
        /* If the previous version was logistic, then it's a delete in mfgpro */
        if  t_iJournal.JournalControl = {&JOURNALCONTROL-LOGISTIC} then do:
            create tValidMfgJournal.
            buffer-copy t_sJournal except tc_Status to tValidMfgJournal.
            assign tValidMfgJournal.tc_Status = "D":U.
        end.
        /* If the previous version was not logistic, then it's a create in mfgpro */
        else if t_sJournal.JournalControl = {&JOURNALCONTROL-LOGISTIC} then do:
            create tValidMfgJournal.
            buffer-copy t_sJournal except tc_Status to tValidMfgJournal.
            assign tValidMfgJournal.tc_Status = "N":U.
        end.
    end.
    else 
        if t_sJournal.JournalControl = {&JOURNALCONTROL-LOGISTIC} then do: 
            create tValidMfgJournal.
            buffer-copy t_sJournal to tValidMfgJournal.
        end.
end.

if can-find(first tValidMfgJournal) then do:
    
    if viBMfgDaybookID = 0 or
       viBMfgDaybookID = ? 
    then do:
    
        <I-3 {bFcStartAndOpenInstance
            &ADD-TO-TRANSACTION = "true"
            &CLASS              = "BMfgDaybook"}>
    
    end.
    else do:
    
        <I-9 {bFcOpenInstance
            &CLASS           = "BMfgDaybook"}>
    end.
    
    <M-5 run MaintainData
       (input  tValidMfgJournal (tCopyJournal), 
        output viLocalReturnStatus (oiReturnStatus)) in BMfgDaybook>
    
    <I-19 {bFcCloseInstance
            &CLASS           = "BMfgDaybook"}>
    
    if viLocalReturnStatus <> 0 then assign oiReturnStatus = viLocalReturnStatus.
    if viLocalReturnStatus < 0 
    then do :
        <M-22 run StopExternalInstances
           (output viFcReturnSuper (oiReturnStatus)) in BJournal>
        Return.
    end. /* if viLocalReturnStatus < 0  */
    
    if viBMfgNRM6ID = 0 or
       viBMfgNRM6ID = ? 
    then do:
        <I-17 {bFcStartAndOpenInstance
            &ADD-TO-TRANSACTION = "true"
            &CLASS              = "BMfgNRM"}>
    end.
    else do:
        <I-18 {bFcOpenInstance
            &CLASS           = "BMfgNRM"}>
    end.
    
    <M-14 run MaintainData
       (input  tValidMfgJournal (tJournalBook), 
        output viLocalReturnStatus (oiReturnStatus)) in BMfgNRM>
    
    
    <I-15 {bFcCloseInstance
            &CLASS           = "BMfgNRM"}>
                            
    if viLocalReturnStatus <> 0 then assign oiReturnStatus = viLocalReturnStatus.
    if viLocalReturnStatus < 0 
    then do :
        <M-23 run StopExternalInstances
           (output viFcReturnSuper (oiReturnStatus)) in BJournal>
        Return.
    end. /* if viLocalReturnStatus < 0  */

end.

/* Error handling */
assign oiReturnStatus = viLocalReturnStatus.