Description
Get description of the COA element
Parameters
icCOAElementType | input | character | |
iiCOAElement_ID | input | integer | |
icCOAElementCode | input | character | |
ocCOAElementDescription | output | character | |
oiOutCOAElement_ID | output | integer | |
oiReturnStatus | output | integer | |
Internal usage
QadFinancials
program code (program1/bfrwanalysiscode.p)
/* Retrieve desciption of the COA element */
/* Normalize input parameters */
if icCOAElementCode = "":U then assign icCOAElementCode = ?.
if icCOAElementType = "":U then assign icCOAElementType = ?.
if iiCOAElement_ID = 0 then assign iiCOAElement_ID = 0.
/* Validate input parameters */
if icCOAElementType = {&FRWANALYSISCOATYPE-COMPANY} or
icCOAElementType = {&FRWANALYSISCOATYPE-CURRENCY} or
icCOAElementType = {&FRWANALYSISCOATYPE-LAYER} or
icCOAElementType = {&FRWANALYSISCOATYPE-JOURNAL} or
icCOAElementType = {&FRWANALYSISCOATYPE-GL} then
do:
if icCOAElementCode = ? or
icCOAElementType = ?
then do:
assign vcMessage = #T-81'Not all mandatory input parameters are populated.':255(999890633)T-81#
vcContext = "icCOAElementCode=&1|icCOAElementType=&2":U
vcContext = replace(vcContext, "|":U, chr(2))
vcContext = substitute(vcContext, icCOAElementCode, icCOAElementType).
<M-55 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'S':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-928331':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input vcContext (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
assign oiReturnStatus = -1.
return.
end.
end.
case icCOAElementType:
when {&FRWANALYSISCOATYPE-COMPANY}
then do:
<Q-49 run CompanyByCompanyCodeDomainCode (all) (Read) (NoCache)
(input iiCOAElement_ID, (CompanyId)
input icCOAElementCode, (CompanyCode)
input ?, (DomainCode)
input ?, (DomainId)
input ?, (CompanyIsActive)
output dataset tqCompanyByCompanyCodeDomainCode) in BCompany>
find first tqCompanyByCompanyCodeDomainCode no-error.
if available tqCompanyByCompanyCodeDomainCode
then assign ocCOAElementDescription = tqCompanyByCompanyCodeDomainCode.tcCompanyDescription
oiOutCOAElement_ID = tqCompanyByCompanyCodeDomainCode.tiCompany_ID.
end.
when {&FRWANALYSISCOATYPE-COSTCENTRE}
then do:
<Q-32 run CostCentreByCodeID (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input icCOAElementCode, (CostCentreCode)
input iiCOAElement_ID, (CostCentreID)
output dataset tqCostCentreByCodeID) in BCostCentre>
find first tqCostCentreByCodeID no-error.
if available tqCostCentreByCodeID
then assign ocCOAElementDescription = tqCostCentreByCodeID.tcCostCentreDescription
oiOutCOAElement_ID = tqCostCentreByCodeID.tiCostCentre_ID.
end.
when {&FRWANALYSISCOATYPE-CURRENCY}
then do:
<Q-71 run CurrencyByCode (all) (Read) (NoCache)
(input icCOAElementCode, (CurrencyCode)
output dataset tqCurrencyByCode) in BCurrency>
find first tqCurrencyByCode no-error.
if available tqCurrencyByCode
then assign ocCOAElementDescription = tqCurrencyByCode.tcCurrencyDescription
oiOutCOAElement_ID = tqCurrencyByCode.tiCurrency_ID.
end.
when {&FRWANALYSISCOATYPE-DIVISION}
then do:
<Q-24 run DivisionByIdCodeDetails (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input icCOAElementCode, (DivisionCode)
input ?, (DivisionDescription)
input ?, (DivisionIsActive)
input iiCOAElement_ID, (DivisionId)
output dataset tqDivisionByIdCodeDetails) in BDivision>
find first tqDivisionByIdCodeDetails no-error.
if available tqDivisionByIdCodeDetails
then assign ocCOAElementDescription = tqDivisionByIdCodeDetails.tcDivisionDescription
oiOutCOAElement_ID = tqDivisionByIdCodeDetails.tiDivision_ID.
end.
when {&FRWANALYSISCOATYPE-GL}
then do:
<Q-89 run GLByCode (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input icCOAElementCode, (GLCode)
output dataset tqGLByCode) in BGL>
find first tqGLByCode no-error.
if available tqGLByCode
then assign ocCOAElementDescription = tqGLByCode.tcGLDescription
oiOutCOAElement_ID = tqGLByCode.tiGL_ID.
end.
when {&FRWANALYSISCOATYPE-INTERCO}
then do:
<Q-17 run BusinessRelationByIDCodeIC (all) (Read) (NoCache)
(input iiCOAElement_ID, (BusinessRelationID)
input ?, (BusinessRelationCode)
input icCOAElementCode, (BusinessRelationIntercoCode)
input true, (BusinessRelationIsActive)
output dataset tqBusinessRelationByIDCodeIC) in BBusinessRelation>
find first tqBusinessRelationByIDCodeIC where no-error.
if available tqBusinessRelationByIDCodeIC
then assign ocCOAElementDescription = tqBusinessRelationByIDCodeIC.tcBusinessRelationName1
oiOutCOAElement_ID = tqBusinessRelationByIDCodeIC.tiBusinessRelation_ID.
end.
when {&FRWANALYSISCOATYPE-JOURNAL}
then do:
<Q-63 run JournalByJournalIDCodeType (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input iiCOAElement_ID, (JournalID)
input icCOAElementCode, (JournalCode)
input ?, (JournalTypeCode)
output dataset tqJournalByJournalIDCodeType) in BJournal>
find first tqJournalByJournalIDCodeType no-error.
if available tqJournalByJournalIDCodeType
then assign ocCOAElementDescription = tqJournalByJournalIDCodeType.tcJournalDescription
oiOutCOAElement_ID = tqJournalByJournalIDCodeType.tiJournal_ID.
end.
when {&FRWANALYSISCOATYPE-LAYER}
then do:
<Q-15 run LayerByCodeTypeCode (all) (Read) (NoCache)
(input ?, (LayerTypeCode)
input icCOAElementCode, (LayerCode)
output dataset tqLayerByCodeTypeCode) in BLayer>
find first tqLayerByCodeTypeCode no-error.
if available tqLayerByCodeTypeCode
then assign ocCOAElementDescription = tqLayerByCodeTypeCode.tcLayerDescription
oiOutCOAElement_ID = tqLayerByCodeTypeCode.tiLayer_ID.
end.
when {&FRWANALYSISCOATYPE-PROJECT}
then do:
<Q-52 run ProjectPrim (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input iiCOAElement_ID, (ProjectID)
input icCOAElementCode, (ProjectCode)
output dataset tqProjectPrim) in BProject>
find first tqProjectPrim no-error.
if available tqProjectPrim
then assign ocCOAElementDescription = tqProjectPrim.tcProjectDescription
oiOutCOAElement_ID = tqProjectPrim.tiProject_ID.
end.
when {&FRWANALYSISCOATYPE-SAF1} or
when {&FRWANALYSISCOATYPE-SAF2} or
when {&FRWANALYSISCOATYPE-SAF3} or
when {&FRWANALYSISCOATYPE-SAF4} or
when {&FRWANALYSISCOATYPE-SAF5} or
when {&FRWANALYSISCOATYPE-SAF6} or
when {&FRWANALYSISCOATYPE-SAF7} or
when {&FRWANALYSISCOATYPE-SAF8} or
when {&FRWANALYSISCOATYPE-SAF9} or
when {&FRWANALYSISCOATYPE-SAF10}
then do:
<Q-36 run SafByIdCodeConceptID (all) (Read) (NoCache)
(input ?, (SafConcept_ID)
input icCOAElementCode, (SafCode)
input iiCOAElement_ID, (SafID)
output dataset tqGetSafForSafConcept) in BSaf>
find first tqGetSafForSafConcept no-error.
if available tqGetSafForSafConcept
then assign ocCOAElementDescription = tqGetSafForSafConcept.tcSafDescription
oiOutCOAElement_ID = tqGetSafForSafConcept.tiSaf_ID.
end.
end case.