project BLF > class PMfgPro > method InitInstance

Description

Set the value of "vcDefaultMfgProgram" before the <ANCESTOR-CODE>.

PreCondition

This method is executed when a new instance of the business class is started, or when a draft instance is opened (in that case a new instance is started which is a copy of the draft instance).


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program/pmfgpro.p)

if not vlSkipInitInstanceAncestorCode
then do:
    <ANCESTOR-CODE>
end.

if oiReturnStatus >= 0
then do :
    assign oiReturnStatus = -98.

    /* Check whether the default MfgPro program is set or not. Return an error if it is not! */
    if vcDefaultMfgProgram = ""
    then do :
        <M-4 run SetMessage (input  'The default MfgPro program is not set correctly':U (icMessage), 
                     input  '' (icArguments), 
                     input  '' (icFieldName), 
                     input  '' (icFieldValue), 
                     input  'S':U (icType), 
                     input  1 (iiSeverity), 

                     input  '' (icRowid), 
                     input  'BLF-378':U (icFcMsgNumber), 
                     input  'The implementation of the MfgPro proxy is not done correclty.  The default MfgPro procedure is not specified':U (icFcExplanation), 
                     input  '' (icFcIdentification), 
                     input  '' (icFcContext), 
                     output viFcReturnSuper (oiReturnStatus)) in PMfgPro>
        assign oiReturnStatus = -1. /* Validation error */
        Return.
    end.

    /*  Set the program-name to the right value in the context */
    <M-7 run SetQadContextProperty
       (input  'programName':U (icPropertyName), 
        input  vcDefaultMfgProgram (icPropertyValue), 
        output viFcReturnSuper (oiReturnStatus)) in PMfgPro>
    if viFcReturnSuper <> 0
    then do:
        assign oiReturnStatus = viFcReturnSuper.
        <M-10 run SetMessage (input  #T-11'The -$1- property could not be set in the internal service context.':100(8066)T-11# (icMessage), 
                     input  'ProgramName':U (icArguments), 
                     input  '' (icFieldName), 
                     input  '' (icFieldValue), 
                     input  'S':U (icType), 
                     input  1 (iiSeverity), 
                     input  '' (icRowid), 
                     input  'BLF-379':U (icFcMsgNumber), 
                     input  'The internal context property could not be set.  This is an internal error.':U (icFcExplanation), 
                     input  '' (icFcIdentification), 
                     input  '' (icFcContext), 
                     output viFcReturnSuper (oiReturnStatus)) in PMfgPro>
        leave.
    end.

    /*  Set the username (Login) to the right value in the context */
    <M-1 run SetQadContextProperty
       (input  'username':U (icPropertyName), 
        input  vcUserLogin (icPropertyValue), 
        output viFcReturnSuper (oiReturnStatus)) in PMfgPro>
    if viFcReturnSuper <> 0
    then do:
        assign oiReturnStatus = viFcReturnSuper.
        <M-12 run SetMessage
           (input  #T-13'The -$1- property could not be set in the internal service context.':100(8066)T-13# (icMessage), 
            input  'UserName':U (icArguments), 
            input  '' (icFieldName), 
            input  '' (icFieldValue), 
            input  'S':U (icType), 
            input  1 (iiSeverity), 
            input  '' (icRowid), 
            input  'BLF-380':U (icFcMsgNumber), 
            input  'The internal context property could not be set.  This is an internal error.':U (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in PMfgPro>
        leave.
    end.

    /*  Set the domain code to the right value in the context */
    <M-2 run SetQadContextProperty
       (input  'domain':U (icPropertyName), 
        input  vcDomainCode (icPropertyValue), 
        output viFcReturnSuper (oiReturnStatus)) in PMfgPro>
    if viFcReturnSuper <> 0
    then do:
        assign oiReturnStatus = viFcReturnSuper.
        <M-14 run SetMessage
           (input  #T-15'The -$1- property could not be set in the internal service context.':100(8066)T-15# (icMessage), 
            input  'Domain':U (icArguments), 
            input  '' (icFieldName), 
            input  '' (icFieldValue), 
            input  'S':U (icType), 
            input  1 (iiSeverity), 
            input  '' (icRowid), 
            input  'BLF-381':U (icFcMsgNumber), 
            input  'The internal context property could not be set.  This is an internal error.':U (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in PMfgPro>
        leave.
    end.

    /*  Set the global session ID to the right value in the context */
    <M-3 run SetQadContextProperty
       (input  'sessionId':U (icPropertyName), 
        input  vcGlobalSessionId (icPropertyValue), 
        output viFcReturnSuper (oiReturnStatus)) in PMfgPro>
    if viFcReturnSuper <> 0
    then do:
        assign oiReturnStatus = viFcReturnSuper.
        <M-16 run SetMessage
           (input  #T-17'The -$1- property could not be set in the internal service context.':100(8066)T-17# (icMessage), 
            input  'SessionId':U (icArguments), 
            input  '' (icFieldName), 
            input  '' (icFieldValue), 
            input  'S':U (icType), 
            input  1 (iiSeverity), 
            input  '' (icRowid), 
            input  'BLF-382':U (icFcMsgNumber), 
            input  'The internal context property could not be set.  This is an internal error.':U (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in PMfgPro>
        leave.
    end.

    /* Start the QadAppServiceCaller.p persistently if not yet started before */
    <M-6 run StartQadAppServiceCaller (output viFcReturnSuper (oiReturnStatus)) in PMfgPro>
    if viFcReturnSuper <> 0
    then do :
        assign oiReturnStatus = viFcReturnSuper.
        return.
    end.

    assign oiReturnStatus = 0.
end.