project QadFinancials > class BPosting > method PostSaveDynamicCreations
Description
PostSaveDynamicCreations: submethod of the inheritted method PostSave that will create the QPostingLine and QPostingSaf records based upon temp-tables
Parameters
oiNbrOfCreatedQPostingLine | output | integer | QPostingLinesCreated: Returns the number of QPostingLine records that are created |
oiNbrOfCreatedQPostingSaf | output | integer | QPostingSafsCreated: Returns the number of QPostingSaf records that are created |
oiNbrOfCreatedQBudgetLinkActual | output | integer | Number of QBudgetLinkActual-records that are created |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bposting.p)
/* ====================================================================================================================== */
/* IMPORTANT NOTES: */
/* */
/* The normal process is that updates towards other classes are done through the normal approach with Starting&Opening */
/* the external instance and then call a method in there. But as that decreases the performance to much for frequently */
/* used actions like the creation of the QPostingLine- and QPostingSaf-records, we will here do the creation of these */
/* records here via dynamic buffers. */
/* */
/* Note that the tApiQPostingLineBank-records (same as the QPostingLine-records but using Banl-GL-accounts) are still */
/* processed using the standard approach as they don't need to be just created but also on-line processed; they still */
/* will use the normal calls through the normal process in AdditionalUpdatesBQPosting */
/* All temp-tables records (tApiQPostingLine, tApiQPostingSaf, tApiQPostingLineBank and tApiQPostingSafBank) are still */
/* created in AdditionalUpdatesCreateQPostingLineN) regardless how they are created in the db later on */
/* */
/* For the tNewQBudgetLinkAct records the complete processing is only done here although they are still created in */
/* method AdditionalUpdates or one of its sub-methods. */
/* */
/* The temp-tables used in here need to be defined with KeepState=true as the records in them are created in method */
/* AdditionalUpdates but they are used in PostSave and these method are not always executed in one go. */
/* So the 2 (AdditionalUpdates and PostSave) can be handled by another appserver-process and then PostSave would find */
/* the temp-table to empty when they were not defined with KeepState=true. */
/* ====================================================================================================================== */
/* ====================================================================================== */
/* Start the persistenceLayer once so it can be used for get new db-sequences */
/* ====================================================================================== */
<I-38 {WRITEDIRECTDBACCESS
&WRITETABLENAMES = "'QPostingLine,QPostingSaf,QBudgetLinkActual':U"}>
/* ====================================================================================== */
/* Start the persistenceLayer once so it can be used for get new db-sequences */
/* ====================================================================================== */
<M-81 run StartPersistence
(output vhFcComponent (ohPersistence),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
/* ====================================================================================== */
/* QPosting: Transfer the data that is in the temp-tables to the db using dynamic buffers */
/* ====================================================================================== */
create buffer vhBufferQPostingLine for table "QPostingLine":U in widget-pool "non-persistent":U.
create buffer vhBufferQPostingSaf for table "QPostingSaf":U in widget-pool "non-persistent":U.
For each tApiQPostingLine
no-lock
on error undo, throw :
vhBufferQPostingLine:Buffer-Create().
assign oiNbrOfCreatedQPostingLine = oiNbrOfCreatedQPostingLine + 1
vhBufferQPostingLine::QPostingLine_ID = <M-21 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
vhBufferQPostingLine::QPostingLineDebitLC = tApiQPostingLine.QPostingLineDebitLC
vhBufferQPostingLine::QPostingLineCreditLC = tApiQPostingLine.QPostingLineCreditLC
vhBufferQPostingLine::QPostingLineDebitTC = tApiQPostingLine.QPostingLineDebitTC
vhBufferQPostingLine::QPostingLineCreditTC = tApiQPostingLine.QPostingLineCreditTC
vhBufferQPostingLine::QPostingLineDebitCC = tApiQPostingLine.QPostingLineDebitCC
vhBufferQPostingLine::QPostingLineCreditCC = tApiQPostingLine.QPostingLineCreditCC
vhBufferQPostingLine::QPostingLineDebitPC = tApiQPostingLine.QPostingLineDebitPC
vhBufferQPostingLine::QPostingLineCreditPC = tApiQPostingLine.QPostingLineCreditPC
vhBufferQPostingLine::QPostingLineQTY = tApiQPostingLine.QPostingLineQTY
vhBufferQPostingLine::QPostingLineInfo = tApiQPostingLine.QPostingLineInfo
vhBufferQPostingLine::PeriodYearPeriod = tApiQPostingLine.PeriodYearPeriod
vhBufferQPostingLine::JournalTypeCode = tApiQPostingLine.JournalTypeCode
vhBufferQPostingLine::Company_ID = tApiQPostingLine.Company_ID
vhBufferQPostingLine::CostCentre_ID = tApiQPostingLine.CostCentre_ID
vhBufferQPostingLine::Currency_ID = tApiQPostingLine.Currency_ID
vhBufferQPostingLine::Division_ID = tApiQPostingLine.Division_ID
vhBufferQPostingLine::GL_ID = tApiQPostingLine.GL_ID
vhBufferQPostingLine::IntercoBusinessRelation_ID = tApiQPostingLine.IntercoBusinessRelation_ID
vhBufferQPostingLine::Journal_ID = tApiQPostingLine.Journal_ID
vhBufferQPostingLine::Period_ID = tApiQPostingLine.Period_ID
vhBufferQPostingLine::Project_ID = tApiQPostingLine.Project_ID
vhBufferQPostingLine::Layer_ID = tApiQPostingLine.Layer_ID
vhBufferQPostingLine::QPostingDate = tApiQPostingLine.QPostingDate.
For each tApiQPostingSaf where
tApiQPostingSaf.tc_ParentRowid = tApiQPostingLine.tc_Rowid
no-lock
on error undo, throw :
vhBufferQPostingSaf:Buffer-Create().
assign oiNbrOfCreatedQPostingSaf = oiNbrOfCreatedQPostingSaf + 1
vhBufferQPostingSaf::QPostingSaf_ID = <M-94 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
vhBufferQPostingSaf::QPostingLine_ID = vhBufferQPostingLine::QPostingLine_ID
vhBufferQPostingSaf::QPostingSafParentType = tApiQPostingSaf.QPostingSafParentType
vhBufferQPostingSaf::QPostingSafInputSequence = tApiQPostingSaf.QPostingSafInputSequence
vhBufferQPostingSaf::Saf_ID = tApiQPostingSaf.Saf_ID
vhBufferQPostingSaf::SafStructure_ID = tApiQPostingSaf.SafStructure_ID.
vhBufferQPostingSaf:Buffer-Release().
End. /* For each tApiQPostingSaf where */
vhBufferQPostingLine:Buffer-Release().
End. /* For each tApiQPostingLine where */
/* ============================================================================================== */
/* QBudgetLinkActual: Transfer the data that is in the temp-table to the db using dynamic buffers */
/* ============================================================================================== */
create buffer vhBufferQBudgetLinkActual for table "QBudgetLinkActual":U in widget-pool "non-persistent":U.
For each tNewQBudgetLinkAct
no-lock
on error undo, throw :
vhBufferQBudgetLinkActual:Buffer-Create().
assign oiNbrOfCreatedQBudgetLinkActual = oiNbrOfCreatedQBudgetLinkActual + 1
vhBufferQBudgetLinkActual::QBudgetLinkActual_ID = <M-73 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
vhBufferQBudgetLinkActual::BudgetLinkActualTC = tNewQBudgetLinkAct.BudgetLinkActualTC
vhBufferQBudgetLinkActual::BudgetLinkActualQTY = tNewQBudgetLinkAct.BudgetLinkActualQTY
vhBufferQBudgetLinkActual::BudgetLinkActualDate = tNewQBudgetLinkAct.BudgetLinkActualDate
vhBufferQBudgetLinkActual::BudgetLinkActualInfo = tNewQBudgetLinkAct.BudgetLinkActualInfo
vhBufferQBudgetLinkActual::BudgetLinkActualDivCode = tNewQBudgetLinkAct.BudgetLinkActualDivCode
vhBufferQBudgetLinkActual::BudgetLinkActualGLCode = tNewQBudgetLinkAct.BudgetLinkActualGLCode
vhBufferQBudgetLinkActual::BudgetLinkActualPrjCode = tNewQBudgetLinkAct.BudgetLinkActualPrjCode
vhBufferQBudgetLinkActual::BudgetLinkActualCCCode = tNewQBudgetLinkAct.BudgetLinkActualCCCode
vhBufferQBudgetLinkActual::BudgetLinkActualSafStruct = tNewQBudgetLinkAct.BudgetLinkActualSafStruct
vhBufferQBudgetLinkActual::BudgetLinkActualSaf1Code = tNewQBudgetLinkAct.BudgetLinkActualSaf1Code
vhBufferQBudgetLinkActual::BudgetLinkActualSaf2Code = tNewQBudgetLinkAct.BudgetLinkActualSaf2Code
vhBufferQBudgetLinkActual::BudgetLinkActualSaf3Code = tNewQBudgetLinkAct.BudgetLinkActualSaf3Code
vhBufferQBudgetLinkActual::BudgetLinkActualSaf4Code = tNewQBudgetLinkAct.BudgetLinkActualSaf4Code
vhBufferQBudgetLinkActual::BudgetLinkActualSaf5Code = tNewQBudgetLinkAct.BudgetLinkActualSaf5Code
vhBufferQBudgetLinkActual::BudgetLinkActualSaf1Concpt = tNewQBudgetLinkAct.BudgetLinkActualSaf1Concpt
vhBufferQBudgetLinkActual::BudgetLinkActualSaf2Concpt = tNewQBudgetLinkAct.BudgetLinkActualSaf2Concpt
vhBufferQBudgetLinkActual::BudgetLinkActualSaf3Concpt = tNewQBudgetLinkAct.BudgetLinkActualSaf3Concpt
vhBufferQBudgetLinkActual::BudgetLinkActualSaf4Concpt = tNewQBudgetLinkAct.BudgetLinkActualSaf4Concpt
vhBufferQBudgetLinkActual::BudgetLinkActualSaf5Concpt = tNewQBudgetLinkAct.BudgetLinkActualSaf5Concpt
vhBufferQBudgetLinkActual::LayerTypeCode = tNewQBudgetLinkAct.LayerTypeCode
vhBufferQBudgetLinkActual::JournalTypeCode = tNewQBudgetLinkAct.JournalTypeCode
vhBufferQBudgetLinkActual::PostingLine_ID = tNewQBudgetLinkAct.PostingLine_ID
vhBufferQBudgetLinkActual::BudgetWBS_ID = tNewQBudgetLinkAct.BudgetWBS_ID
vhBufferQBudgetLinkActual::Company_ID = tNewQBudgetLinkAct.Company_ID
vhBufferQBudgetLinkActual::Currency_ID = tNewQBudgetLinkAct.Currency_ID
vhBufferQBudgetLinkActual::Journal_ID = tNewQBudgetLinkAct.Journal_ID
vhBufferQBudgetLinkActual::Layer_ID = tNewQBudgetLinkAct.Layer_ID
vhBufferQBudgetLinkActual::Unit_ID = tNewQBudgetLinkAct.Unit_ID
vhBufferQBudgetLinkActual::Budget_ID = tNewQBudgetLinkAct.Budget_ID.
vhBufferQBudgetLinkActual:Buffer-Release().
End. /* For each tNewQBudgetLinkAct where */
/* ================================================================================================== */
/* Empty the temp-tables as they are no longer needed and thus only increase the size of the instance */
/* ================================================================================================== */
empty temp-table tApiQPostingLine.
empty temp-table tApiQPostingSaf.
empty temp-table tNewQBudgetLinkAct.
/* =============== */
/* Finally actions */
/* =============== */
finally:
if vhBufferQPostingLine <> ?
then vhBufferQPostingLine:buffer-release().
Delete Object vhBufferQPostingLine no-error.
if vhBufferQPostingSaf <> ?
then vhBufferQPostingSaf:buffer-release().
Delete Object vhBufferQPostingSaf no-error.
if vhBufferQBudgetLinkActual <> ?
then vhBufferQBudgetLinkActual:buffer-release().
Delete Object vhBufferQBudgetLinkActual no-error.
end finally.