icBusinessClassShortName | input | character | Name of the business component containing the business function to run. |
icMethodName | input | character | Name of the business function to run. When not specified, default 'LoadAndUpdateInstanceData' will be used. |
icCompanyGroupCode | input | character | name of the entity group |
icActivityCode | input | character | Parameter values for the business function. The business function itself defines the implementation of this parameter. |
izInstanceData | input | dataset-handle | Parameter values for the business function. The business function itself defines the implementation of this parameter. |
icUnmanagedData | input | character | Parameter values for the business function. The business function itself defines the implementation of this parameter. |
ocNextCompanyCode | output | character | Code of the next entity to be processed |
oiNumberOfCompaniesInCyGroup | output | integer | Number of the entities in the entity group |
oiReturnStatus | output | integer | Return status of the method. |
/* ================================================================= */ /* Input parametrs normalization */ /* ================================================================= */ if icMethodName = "" or icMethodName = ? then assign icMethodName = "LoadAndUpdateInstanceData". /* ================================================================= */ /* Store all data needed for asynchronous processing to component */ /* (it is stored in component data as state data) */ /* ================================================================= */ assign vcAsyncBusinessClassShortName = icBusinessClassShortName vcAsyncMethodName = icMethodName vcAsyncCompanyGroupCode = icCompanyGroupCode vcAsyncActivityCode = icActivityCode vcAsyncUnmanagedData = icUnmanagedData vhAsyncInstanceData = izInstanceData. /* ================================================================= */ /* Store also content of dynamic dataset passed as input parameter */ /* to this method. We need to keep it becuase it is required later. */ /* And because component can be closed between execution, schema and */ /* and content is stored in the class instace temp table. Logically */ /* it would be easiest to store in longchar, but it does not support */ /* state keeping. Therefore segmentation and temp table is used. */ /* ================================================================= */ /* ================================================================= * * This block of the functionality is commented for the moment. To * * don't store content of dataset as state, we are running this * * component always in the LAN mode. * * See MultiCyProcessorAdapter.ProcessRequestAsync * * ================================================================= */ /* izInstanceData:write-xml("LONGCHAR", vpAsyncInstanceData, false, ?, /* default formating - utf-8 */ "", /* no schema location file */ true). /* write schema location to xml */ <M-12 run ConvertLongCharToTempTable (input vpAsyncInstanceData (ipLongText), output tAsyncInstanceDataSerialized (tAsyncInstanceDataSerialized), output viFcReturnSuper (oiReturnStatus)) in BMultiCyProcessor> if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper. if oiReturnStatus < 0 then return. */ /* ================================================================= */ /* Store session variables */ /* ================================================================= */ assign viSessionSavedID = viSessionID viSessionSavedOC = viSessionOC vhSessionSavedInst = vhSessionInst vcAsyncCurrentCompanyCode = vcCompanyCode viAsyncReturnStatus = 0 viAsyncCurrentCompReturnStatus = -98 viNumberOfCompaniesInCyGroup = 0 viNumberOfCompaniesProcessed = 0 viSessionID = 0 viSessionOC = 0 vhSessionInst = ?. /* ================================================================= */ /* Initiate some data used during execution */ /* ================================================================= */ empty temp-table tProcessErrors. /* ================================================================= */ /* Validate input data. */ /* ================================================================= */ if vcAsyncBusinessClassShortName = "" or vcAsyncBusinessClassShortName = ? or vcAsyncCompanyGroupCode = "" or vcAsyncCompanyGroupCode = ? then do: assign vcMessage = #T-73'Input parameters do not contain valid values':255(999890914)T-73# vcContext = "vcAsyncBusinessClassShortName=&1|vcAsyncCompanyGroupCode=&2":U vcContext = replace(vcContext,"|":U, chr(2)) vcContext = substitute(vcContext, vcAsyncBusinessClassShortName, vcAsyncCompanyGroupCode). <M-55 run SetMessage (input vcMessage (icMessage), input '':U (icArguments), input '':U (icFieldName), input '':U (icFieldValue), input 'E':U (icType), input 3 (iiSeverity), input '':U (icRowid), input 'qadfin-656675':U (icFcMsgNumber), input '':U (icFcExplanation), input '':U (icFcIdentification), input vcContext (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BMultiCyProcessor> assign oiReturnStatus = -1. return. end. /* icBusinessClassShortName = "" or icBusinessClassShortName = ? or icCompanyGroupCode = "" or icCompanyGroupCode = ? */ /* ================================================================= */ /* Validate Entity group and build temp-table with all entities of */ /* the entity group where processing is done */ /* ================================================================= */ if not can-find (CYGroup where CYGroup.CYGroupCode = vcAsyncCompanyGroupCode) then do: assign vcMessage = #T-86'Entity group &1 is not defined in the system.':255(249684263)T-86# vcMessage = substitute(vcMessage, vcAsyncCompanyGroupCode). <M-82 run SetMessage (input vcMessage (icMessage), input '':U (icArguments), input '':U (icFieldName), input '':U (icFieldValue), input 'E':U (icType), input 3 (iiSeverity), input '':U (icRowid), input 'qadfin-394871':U (icFcMsgNumber), input '':U (icFcExplanation), input '':U (icFcIdentification), input '':U (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BMultiCyProcessor> assign oiReturnStatus = -1. return. end. /* not vlFcOk */ /* Get all entities of the entity group */ <Q-11 run CyGroupCompanyByGrpCy (all) (Read) (NoCache) (input 0, (CompanyId) input 0, (GroupID) input vcAsyncCompanyGroupCode, (GroupCode) output dataset tqCyGroupCompanyByGrpCy) in BCompanyGroup> /* Current entity must be member of the selected entity group */ if not can-find (first tqCyGroupCompanyByGrpCy where tqCyGroupCompanyByGrpCy.tcCompanyCode = vcAsyncCurrentCompanyCode) then do: assign vcMessage = #T-62'The current entity (&1) should belong to the specified entity-group (&2).':255(490312612)T-62# vcMessage = substitute(vcMessage, vcAsyncCurrentCompanyCode, icCompanyGroupCode). <M-10 run SetMessage (input vcMessage (icMessage), input '' (icArguments), input '' (icFieldName), input '' (icFieldValue), input 'E' (icType), input 3 (iiSeverity), input '' (icRowid), input 'qadfin-340751':U (icFcMsgNumber), input '' (icFcExplanation), input '' (icFcIdentification), input '' (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BMultiCyProcessor> oiReturnStatus = -1. return. end. /* not can-find (first tqCyGroupCompanyByGrpCy where tqCyGroupCompanyByGrpCy.tcCompanyCode = vcCompanyCode) */ /* Build table of all entities where processing should be done */ assign viNumberOfCompaniesInCyGroup = 0. empty temp-table tAsyncProcessCompanies. for each tqCyGroupCompanyByGrpCy where tqCyGroupCompanyByGrpCy.tcCyGroupCode = vcAsyncCompanyGroupCode: create tAsyncProcessCompanies. assign tAsyncProcessCompanies.tcCompanyCode = tqCyGroupCompanyByGrpCy.tcCompanyCode tAsyncProcessCompanies.tlIsProcessed = false. /* Count total number of the entities in the entity group */ assign viNumberOfCompaniesInCyGroup = viNumberOfCompaniesInCyGroup + 1. end. /* for each tqCyGroupCompanyByGrpCy where */ finally: assign oiNumberOfCompaniesInCyGroup = viNumberOfCompaniesInCyGroup ocNextCompanyCode = vcCompanyCode. /* we are starting with the current entity */ end finally.