project QadFinancials > class BCompany > method GetSharedSetsCurrencyFromDomain
Description
Retrieves the shared sets and the currency information from the specified domain
Parameters
icDomainCode | input | character | |
tApiCompanySharedSet | output | temp-table | |
ocCurrencyCode | output | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/bcompany.p)
/* =================================================== */
/* Get Shared Sets and currency from the linked Domain */
/* =================================================== */
empty temp-table tApiCompanySharedSet.
<Q-3 run DomainsByCode (all) (Read) (NoCache)
(input ?, (DomainID)
input icDomainCode, (DomainCode)
output dataset tqDomainsByCode) in BDomain >
find first tqDomainsByCode where
tqDomainsByCode.tcDomainCode = icDomainCode
no-lock no-error.
if not available tqDomainsByCode
then do:
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-9'Cannot find the requested domain. (Domain Code = &1)':200(32046)T-9#, icDomainCode)).
<M-8 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tCompany.tcDomainCode':U (icFieldName),
input icDomainCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7003':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCompany>
return.
end. /* if not available tqDominsByCode */
/* Create a chr(2)-seperated list of SharedSetTypes */
assign vcSharedSetListTypes = <M-10 GetSharedSetTypes () in BCompany>.
/* Get the shared sets from domain */
<Q-11 run DomainByDomainSharedSet (all) (Read) (NoCache)
(input tqDomainsByCode.tiDomain_ID, (DomainID)
input '':U, (SharedSetID)
input '':U, (SharedSetCode)
input '':U, (SharedSetType)
output dataset tqDomainByDomainSharedSet) in BDomain >
SHAREDSETLOOP:
for each tqDomainByDomainSharedSet:
/* skip shared sets that are not in the sharedset list */
if lookup(tqDomainByDomainSharedSet.tcSharedSetTypeCode, vcSharedSetListTypes, chr(2)) = 0
then next SHAREDSETLOOP.
/* Check if we can find the sharedsettype in the instance (CompanySharedSet) --> Copy */
find first tCompanySharedSet where
tCompanySharedSet.tcSharedSetTypeCode = tqDomainByDomainSharedSet.tcSharedSetTypeCode
no-error.
if available tCompanySharedSet
then do:
create tApiCompanySharedSet.
buffer-copy tCompanySharedSet to tApiCompanySharedSet.
assign tApiCompanySharedSet.SharedSet_ID = tqDomainByDomainSharedSet.tiSharedSet_ID
tApiCompanySharedSet.tcSharedSetCode = tqDomainByDomainSharedSet.tcSharedSetCode
tApiCompanySharedSet.tcSharedSetTypeCode = tqDomainByDomainSharedSet.tcSharedSetTypeCode
tApiCompanySharedSet.tcSharedSetTypeTranslated = tqDomainByDomainSharedSet.tcSharedSetTypeTranslated
tApiCompanySharedSet.LastModifiedDate = today
tApiCompanySharedSet.LastModifiedTime = time
tApiCompanySharedSet.LastModifiedUser = vcUserLogin.
if tApiCompanySharedSet.tc_Status = "":U
then assign tApiCompanySharedSet.tc_Status = 'C':U.
end.
/*
else do:
for each tCompanySharedSet:
find first tApiCompanySharedSet where
tApiCompanySharedSet.CompanySharedSet_ID = tCompanySharedSet.CompanySharedSet_ID
no-error.
if not available tApiCompanySharedSet
then do:
create tApiCompanySharedSet.
buffer-copy tCompanySharedSet to tApiCompanySharedSet.
assign tApiCompanySharedSet.SharedSet_ID = tqDomainByDomainSharedSet.tiSharedSet_ID
tApiCompanySharedSet.tcSharedSetCode = tqDomainByDomainSharedSet.tcSharedSetCode
tApiCompanySharedSet.tcSharedSetTypeCode = tqDomainByDomainSharedSet.tcSharedSetTypeCode
tApiCompanySharedSet.tcSharedSetTypeTranslated = tqDomainByDomainSharedSet.tcSharedSetTypeTranslated
tApiCompanySharedSet.LastModifiedDate = today
tApiCompanySharedSet.LastModifiedTime = time
tApiCompanySharedSet.LastModifiedUser = vcUserLogin.
if tApiCompanySharedSet.tc_Status = "":U
then assign tApiCompanySharedSet.tc_Status = 'C':U.
next SHAREDSETLOOP.
end.
end.
end.
*/
end.
/* Now get the currency code from the domain Property */
<Q-12 run DomainPropertyByDomain (all) (Read) (NoCache)
(input tqDomainsByCode.tiDomain_ID, (DomainID)
output dataset tqDomainPropertyByDomain) in BDomainProperty >
find first tqDomainPropertyByDomain where
tqDomainPropertyByDomain.tiDomain_ID = tqDomainsByCode.tiDomain_ID
no-error.
if available tqDomainPropertyByDomain
then assign ocCurrencyCode = tqDomainPropertyByDomain.tcCurrencyCode.