project QadFinancials > class BExpenseNote > method ValidateComponent2


Parameters


iiExpNoteLine_IDinputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BExpenseNote.ValidateComponent


program code (program1/bexpensenote.p)

find first t_sExpNoteLine where t_sExpNoteLine.ExpNoteLine_ID = iiExpNoteLine_ID no-error.
if not available t_sExpNoteLine then return.

if t_sExpNoteLine.tcSafStructure <> "":U and
   t_sExpNoteLine.tcSafStructure <> ?    and
   t_sExpNoteLine.tcSafStructure <> "?":U
then do:
    <Q-4 run SafStructureLineByStructIDLine (all) (Read) (NoCache)
          (input ?, (SafStructure_ID)
           input ?, (LineNumber)
           input t_sExpNoteLine.tcSafStructureCode, (SafStructureCode)
           input ?, (SafConceptCode)
           output dataset tqSafStructureLineByStructIDLine) in BSafStructure >
    /* SAF 1 */ 

    if can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 1) and
       (t_sExpNoteLine.tcSAFConcept1 = "":U or
        t_sExpNoteLine.tcSAFConcept1 = ?    or
        t_sExpNoteLine.tcSAFConcept1 = "?":U)
    then do:
        assign vcMessage = substitute(#T-32'SAF concept &1 is missing while there is a SAF concept &1 defined in the SAF structure (&4). (&2, &3)':255(1906)T-32#,
                                  "1":U,
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ? ,   /* t_sExpNoteLine.tcItemCode */
                                  t_sExpNoteLine.tcSafStructureCode).
        <M-5 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  'tExpNoteLine.tcSAFConcept1':U (icFieldName), 
            input  t_sExpNoteLine.tcSAFConcept1 (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  t_sExpNoteLine.tc_Rowid (icRowid), 
            input  'QADFIN-2743':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
        assign oiReturnStatus = -1.
    end.

    if not can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 1) and
       t_sExpNoteLine.tcSAFConcept1 <> "":U and
       t_sExpNoteLine.tcSAFConcept1 <> ?    and
       t_sExpNoteLine.tcSAFConcept1 <> "?":U
    then do:
        assign vcMessage = substitute(#T-33'SAF concept &1 (&5) must not be defined according to the SAF structure (&4). (&2, &3)':255(1907)t-33#,
                                  "1":U,
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?,  /* t_sExpNoteLine.tcItemCode */
                                  t_sExpNoteLine.tcSafStructureCode,
                                  t_sExpNoteLine.tcSAFConcept1).
        <M-6 run SetMessage
          (input  vcMessage (icMessage), 
           input  '':U (icArguments), 
           input  'tExpNoteLine.tcSAFConcept1':U (icFieldName), 
           input  t_sExpNoteLine.tcSAFConcept1 (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  t_sExpNoteLine.tc_Rowid (icRowid), 
           input  'QADFIN-2744':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
        assign oiReturnStatus = -1.
    end.

    if can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 1) and
       t_sExpNoteLine.tcSAFConcept1 <> "":U and
       t_sExpNoteLine.tcSAFConcept1 <> ?    and
       t_sExpNoteLine.tcSAFConcept1 <> "?":U
    then do:
        if t_sExpNoteLine.tcSAFCode1 <> "":U and
           t_sExpNoteLine.tcSAFCode1 <> ?    and
           t_sExpNoteLine.tcSAFCode1 <> "?":U
        then do:
            <Q-7 assign vlFcQueryRecordsAvailable = GetSaf (NoCache)
          (input t_sExpNoteLine.tcSAFCode1, (SafCode)
           input t_sExpNoteLine.tcSAFConcept1, (SafConceptCode)
           input ?, (SafDescription)
           input ?, (SafIsActive)) in BSaf >
            if not vlFcQueryRecordsAvailable
            then do:
                assign vcMessage = substitute(#T-34'Invalid SAF code (&1) for SAF concept (&2). (&3, &4)':255(1908)T-34#,
                                  t_sExpNoteLine.tcSAFCode1,
                                  t_sExpNoteLine.tcSAFConcept1,                
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?).  /* t_sExpNoteLine.tcItemCode */
                <M-8 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  'tExpNoteLine.tcSAFCode1':U (icFieldName), 
                    input  t_sExpNoteLine.tcSAFCode1 (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  t_sExpNoteLine.tc_Rowid (icRowid), 
                    input  'QADFIN-2745':U (icFcMsgNumber), 
                    input  '' (icFcExplanation), 
                    input  '' (icFcIdentification), 
                    input  '' (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
                assign oiReturnStatus = -1.
            end.
        end.
        else do:
            assign vcMessage = substitute(#T-35'SAF (&1) cannot be blank if SAF Concept {&2} is defined. (&3, &4)':255(1909)t-35#,
                                  "1":U,
                                  t_sExpNoteLine.tcSAFConcept1,                
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?).  /* t_sExpNoteLine.tcItemCode */
            <M-9 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tExpNoteLine.tcSAFCode1':U (icFieldName), 
                input  t_sExpNoteLine.tcSAFCode1 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sExpNoteLine.tc_Rowid (icRowid), 
                input  'QADFIN-2746':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
            
            assign oiReturnStatus = -1.
        end.
    end.

    /* SAF 2 */ 

    if can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 2) and
       (t_sExpNoteLine.tcSAFConcept2 = "":U or
        t_sExpNoteLine.tcSAFConcept2 = ?    or
        t_sExpNoteLine.tcSAFConcept2 = "?":U)
    then do:
        assign vcMessage = substitute(#T-54'SAF concept &1 is missing while there is a SAF concept &1 defined in the SAF structure (&4). (&2, &3)':255(13498)T-54#,
                                  "2":U,
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?,  /* t_sExpNoteLine.tcItemCode */
                                  t_sExpNoteLine.tcSafStructureCode).
        <M-10 run SetMessage
          (input  vcMessage (icMessage), 
           input  '':U (icArguments), 
           input  'tExpNoteLine.tcSAFConcept2':U (icFieldName), 
           input  t_sExpNoteLine.tcSAFConcept2 (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  t_sExpNoteLine.tc_Rowid (icRowid), 
           input  'QADFIN-2747':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
        assign oiReturnStatus = -1.
    end.

    if not can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 2) and
       t_sExpNoteLine.tcSAFConcept2 <> "":U and
       t_sExpNoteLine.tcSAFConcept2 <> ?    and
       t_sExpNoteLine.tcSAFConcept2 <> "?":U
    then do:
        assign vcMessage = substitute(#T-52'Saf Concept &1 (&5) should not be defined according to the Saf Structure (&4). (&2, &3)':255(13496)T-52#,
                                  "2":U,
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?,  /* t_sExpNoteLine.tcItemCode */
                                  t_sExpNoteLine.tcSafStructureCode,
                                  t_sExpNoteLine.tcSAFConcept1).
        <M-11 run SetMessage (input  vcMessage (icMessage), 
                      input  '':U (icArguments), 
                      input  'tExpNoteLine.tcSAFConcept2':U (icFieldName), 
                      input  t_sExpNoteLine.tcSAFConcept2 (icFieldValue), 
                      input  'E':U (icType), 
                      input  3 (iiSeverity), 
                      input  t_sExpNoteLine.tc_Rowid (icRowid), 
                      input  'QADFIN-2748':U (icFcMsgNumber), 
                      input  '' (icFcExplanation), 
                      input  '' (icFcIdentification), 
                      input  '' (icFcContext), 
                      output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
        assign oiReturnStatus = -1.
    end.

    if can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 2) and
       t_sExpNoteLine.tcSAFConcept2 <> "":U and
       t_sExpNoteLine.tcSAFConcept2 <> ?    and
       t_sExpNoteLine.tcSAFConcept2 <> "?":U
    then do:
        if t_sExpNoteLine.tcSAFCode2 <> "":U and
           t_sExpNoteLine.tcSAFCode2 <> ?    and
           t_sExpNoteLine.tcSAFCode2 <> "?":U
        then do:
            <Q-12 assign vlFcQueryRecordsAvailable = GetSaf (NoCache)
          (input t_sExpNoteLine.tcSAFCode2, (SafCode)
           input t_sExpNoteLine.tcSAFConcept2, (SafConceptCode)
           input ?, (SafDescription)
           input ?, (SafIsActive)) in BSaf >
            if not vlFcQueryRecordsAvailable
            then do:
                assign vcMessage = substitute(#T-38'Invalid SAF code (&1) for SAF concept (&2). (&3, &4)':255(1908)T-38#,
                                  t_sExpNoteLine.tcSAFCode2,
                                  t_sExpNoteLine.tcSAFConcept2,                
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?).  /* t_sExpNoteLine.tcItemCode */
                <M-13 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  'tExpNoteLine.tcSAFCode2':U (icFieldName), 
                    input  t_sExpNoteLine.tcSAFCode2 (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  t_sExpNoteLine.tc_Rowid (icRowid), 
                    input  'QADFIN-2749':U (icFcMsgNumber), 
                    input  '' (icFcExplanation), 
                    input  '' (icFcIdentification), 
                    input  '' (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
                assign oiReturnStatus = -1.
            end.
        end.
        else do:
            assign vcMessage = substitute(#T-39'SAF (&1) cannot be blank if SAF Concept {&2} is defined. (&3, &4)':255(1909)t-39#,
                                  "2":U,
                                  t_sExpNoteLine.tcSAFConcept2,                
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?). /* t_sExpNoteLine.tcItemCode */
            <M-14 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tExpNoteLine.tcSAFCode2':U (icFieldName), 
                input  t_sExpNoteLine.tcSAFCode2 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sExpNoteLine.tc_Rowid (icRowid), 
                input  'QADFIN-2750':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
            assign oiReturnStatus = -1.
        end.
    end.

    /* SAF 3 */ 

    if can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 3) and
       (t_sExpNoteLine.tcSAFConcept3 = "":U or
        t_sExpNoteLine.tcSAFConcept3 = ?    or
        t_sExpNoteLine.tcSAFConcept3 = "?":U)
    then do:
        assign vcMessage = substitute(#T-40'SAF concept &1 is missing while there is a SAF concept &1 defined in the SAF structure (&4). (&2, &3)':255(1910)T-40#,
                                  "3":U,
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?, /* t_sExpNoteLine.tcItemCode */
                                  t_sExpNoteLine.tcSafStructureCode).
        <M-15 run SetMessage
          (input  vcMessage (icMessage), 
           input  '':U (icArguments), 
           input  'tExpNoteLine.tcSAFConcept3':U (icFieldName), 
           input  t_sExpNoteLine.tcSAFConcept3 (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  t_sExpNoteLine.tc_Rowid (icRowid), 
           input  'QADFIN-2751':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
        assign oiReturnStatus = -1.
    end.

    if not can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 3) and
       t_sExpNoteLine.tcSAFConcept3 <> "":U and
       t_sExpNoteLine.tcSAFConcept3 <> ?    and
       t_sExpNoteLine.tcSAFConcept3 <> "?":U
    then do:
        assign vcMessage = substitute(#T-41'SAF concept &1 (&5) must not be defined according to the SAF structure (&4). (&2, &3)':255(1907)t-41#,
                                  "3":U,
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?, /* t_sExpNoteLine.tcItemCode */
                                  t_sExpNoteLine.tcSafStructureCode,
                                  t_sExpNoteLine.tcSAFConcept3).
        <M-16 run SetMessage
          (input  vcMessage (icMessage), 
           input  '':U (icArguments), 
           input  'tExpNoteLine.tcSAFConcept3':U (icFieldName), 
           input  t_sExpNoteLine.tcSAFConcept3 (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  t_sExpNoteLine.tc_Rowid (icRowid), 
           input  'QADFIN-2752':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
        assign oiReturnStatus = -1.
    end.

    if can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 3) and
       t_sExpNoteLine.tcSAFConcept3 <> "":U and
       t_sExpNoteLine.tcSAFConcept3 <> ?    and
       t_sExpNoteLine.tcSAFConcept3 <> "?":U
    then do:
        if t_sExpNoteLine.tcSAFCode3 <> "":U and
           t_sExpNoteLine.tcSAFCode3 <> ?    and
           t_sExpNoteLine.tcSAFCode3 <> "?":U
        then do:
            <Q-17 assign vlFcQueryRecordsAvailable = GetSaf (NoCache)
          (input t_sExpNoteLine.tcSAFCode3, (SafCode)
           input t_sExpNoteLine.tcSAFConcept3, (SafConceptCode)
           input ?, (SafDescription)
           input ?, (SafIsActive)) in BSaf >
            if not vlFcQueryRecordsAvailable
            then do:
                assign vcMessage = substitute(#T-42'Invalid SAF code (&1) for SAF concept (&2). (&3, &4)':255(1908)T-42#,
                                  t_sExpNoteLine.tcSAFCode3,
                                  t_sExpNoteLine.tcSAFConcept3,                
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?). /* t_sExpNoteLine.tcItemCode */
                <M-18 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  'tExpNoteLine.tcSAFCode3':U (icFieldName), 
                    input  t_sExpNoteLine.tcSAFCode3 (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  t_sExpNoteLine.tc_Rowid (icRowid), 
                    input  'QADFIN-2753':U (icFcMsgNumber), 
                    input  '' (icFcExplanation), 
                    input  '' (icFcIdentification), 
                    input  '' (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
                assign oiReturnStatus = -1.
            end.
        end.
        else do:
            assign vcMessage = substitute(#T-43'SAF (&1) cannot be blank if SAF Concept {&2} is defined. (&3, &4)':255(1909)t-43#,
                                  "3":U,
                                  t_sExpNoteLine.tcSAFConcept3,                
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?). /* t_sExpNoteLine.tcItemCode */
            <M-19 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tExpNoteLine.tcSAFCode3':U (icFieldName), 
                input  t_sExpNoteLine.tcSAFCode3 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sExpNoteLine.tc_Rowid (icRowid), 
                input  'QADFIN-2754':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
            assign oiReturnStatus = -1.
        end.
    end.

    /* SAF 4 */ 

    if can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 4) and
       (t_sExpNoteLine.tcSAFConcept4 = "":U or
        t_sExpNoteLine.tcSAFConcept4 = ?    or
        t_sExpNoteLine.tcSAFConcept4 = "?":U)
    then do:
        assign vcMessage = substitute(#T-44'SAF concept &1 is missing while there is a SAF concept &1 defined in the SAF structure (&4). (&2, &3)':255(1910)T-44#,
                                  "4":U,
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?, /* t_sExpNoteLine.tcItemCode */
                                  t_sExpNoteLine.tcSafStructureCode).
        <M-20 run SetMessage
          (input  vcMessage (icMessage), 
           input  '':U (icArguments), 
           input  'tExpNoteLine.tcSAFConcept4':U (icFieldName), 
           input  t_sExpNoteLine.tcSAFConcept4 (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  t_sExpNoteLine.tc_Rowid (icRowid), 
           input  'QADFIN-2755':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
        assign oiReturnStatus = -1.
    end.

    if not can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 4) and
       t_sExpNoteLine.tcSAFConcept4 <> "":U and
       t_sExpNoteLine.tcSAFConcept4 <> ?    and
       t_sExpNoteLine.tcSAFConcept4 <> "?":U
    then do:
        assign vcMessage = substitute(#T-45'SAF concept &1 (&5) must not be defined according to the SAF structure (&4). (&2, &3)':255(1907)t-45#,
                                  "4":U,
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?, /* t_sExpNoteLine.tcItemCode */
                                  t_sExpNoteLine.tcSafStructureCode,
                                  t_sExpNoteLine.tcSAFConcept4).
        <M-21 run SetMessage
          (input  vcMessage (icMessage), 
           input  '':U (icArguments), 
           input  'tExpNoteLine.tcSAFConcept4':U (icFieldName), 
           input  t_sExpNoteLine.tcSAFConcept4 (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  t_sExpNoteLine.tc_Rowid (icRowid), 
           input  'QADFIN-2756':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
        assign oiReturnStatus = -1.
    end.

    if can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 4) and
       t_sExpNoteLine.tcSAFConcept4 <> "":U and
       t_sExpNoteLine.tcSAFConcept4 <> ?    and
       t_sExpNoteLine.tcSAFConcept4 <> "?":U
    then do:
        if t_sExpNoteLine.tcSAFCode4 <> "":U and
           t_sExpNoteLine.tcSAFCode4 <> ?    and
           t_sExpNoteLine.tcSAFCode4 <> "?":U
        then do:
            <Q-22 assign vlFcQueryRecordsAvailable = GetSaf (NoCache)
          (input t_sExpNoteLine.tcSAFCode4, (SafCode)
           input t_sExpNoteLine.tcSAFConcept4, (SafConceptCode)
           input ?, (SafDescription)
           input ?, (SafIsActive)) in BSaf >
            if not vlFcQueryRecordsAvailable
            then do:
                assign vcMessage = substitute(#T-46'Invalid SAF code (&1) for SAF concept (&2). (&3, &4)':255(1908)T-46#,
                                  t_sExpNoteLine.tcSAFCode4,
                                  t_sExpNoteLine.tcSAFConcept4,                
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?). /*  t_sExpNoteLine.tcItemCode */
                <M-23 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  'tExpNoteLine.tcSAFCode4':U (icFieldName), 
                    input  t_sExpNoteLine.tcSAFCode4 (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  t_sExpNoteLine.tc_Rowid (icRowid), 
                    input  'QADFIN-2757':U (icFcMsgNumber), 
                    input  '' (icFcExplanation), 
                    input  '' (icFcIdentification), 
                    input  '' (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
                assign oiReturnStatus = -1.
            end.
        end.
        else do:
            assign vcMessage = substitute(#T-47'SAF (&1) cannot be blank if SAF Concept {&2} is defined. (&3, &4)':255(1909)t-47#,
                                  "4":U,
                                  t_sExpNoteLine.tcSAFConcept4,                
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?). /* t_sExpNoteLine.tcItemCode */
            <M-24 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tExpNoteLine.tcSAFCode4':U (icFieldName), 
                input  t_sExpNoteLine.tcSAFCode4 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sExpNoteLine.tc_Rowid (icRowid), 
                input  'QADFIN-2758':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
            assign oiReturnStatus = -1.
        end.
    end.

    /* SAF 5 */ 

    if can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 5) and
       (t_sExpNoteLine.tcSAFConcept5 = "":U or
        t_sExpNoteLine.tcSAFConcept5 = ?    or
        t_sExpNoteLine.tcSAFConcept5 = "?":U)
    then do:
        assign vcMessage = substitute(#T-48'SAF concept &1 is missing while there is a SAF concept &1 defined in the SAF structure (&4). (&2, &3)':255(1910)T-48#,
                                  "5":U,
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?, /* t_sExpNoteLine.tcItemCode */
                                  t_sExpNoteLine.tcSafStructureCode).
        <M-25 run SetMessage
          (input  vcMessage (icMessage), 
           input  '':U (icArguments), 
           input  'tExpNoteLine.tcSAFConcept5':U (icFieldName), 
           input  t_sExpNoteLine.tcSAFConcept5 (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  t_sExpNoteLine.tc_Rowid (icRowid), 
           input  'QADFIN-2759':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
        assign oiReturnStatus = -1.
    end.

    if not can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 5) and
       t_sExpNoteLine.tcSAFConcept5 <> "":U and
       t_sExpNoteLine.tcSAFConcept5 <> ?    and
       t_sExpNoteLine.tcSAFConcept5 <> "?":U
    then do:
        assign vcMessage = substitute(#T-49'SAF concept &1 (&5) must not be defined according to the SAF structure (&4). (&2, &3)':255(1907)t-49#,
                                  "5":U,
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?, /* t_sExpNoteLine.tcItemCode */
                                  t_sExpNoteLine.tcSafStructureCode,
                                  t_sExpNoteLine.tcSAFConcept5).
        <M-26 run SetMessage
          (input  vcMessage (icMessage), 
           input  '':U (icArguments), 
           input  'tExpNoteLine.tcSAFConcept5':U (icFieldName), 
           input  t_sExpNoteLine.tcSAFConcept5 (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  t_sExpNoteLine.tc_Rowid (icRowid), 
           input  'QADFIN-2760':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
        assign oiReturnStatus = -1.
    end.

    if can-find(first tqSafStructureLineByStructIDLine where tqSafStructureLineByStructIDLine.tiSafStructureLineNumber = 5) and
       t_sExpNoteLine.tcSAFConcept5 <> "":U and
       t_sExpNoteLine.tcSAFConcept5 <> ?    and
       t_sExpNoteLine.tcSAFConcept5 <> "?":U
    then do:
        if t_sExpNoteLine.tcSAFCode5 <> "":U and
           t_sExpNoteLine.tcSAFCode5 <> ?    and
           t_sExpNoteLine.tcSAFCode5 <> "?":U
        then do:
            <Q-27 assign vlFcQueryRecordsAvailable = GetSaf (NoCache)
          (input t_sExpNoteLine.tcSAFCode5, (SafCode)
           input t_sExpNoteLine.tcSAFConcept5, (SafConceptCode)
           input ?, (SafDescription)
           input ?, (SafIsActive)) in BSaf >
            if not vlFcQueryRecordsAvailable
            then do:
                assign vcMessage = substitute(#T-53'Invalid SAF code (&1) for SAF concept (&2). (&3, &4)':255(13497)T-53#,
                                  t_sExpNoteLine.tcSAFCode5,
                                  t_sExpNoteLine.tcSAFConcept5,                
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?). /* t_sExpNoteLine.tcItemCode */
                <M-28 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  'tExpNoteLine.tcSAFCode5':U (icFieldName), 
                    input  t_sExpNoteLine.tcSAFCode5 (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  t_sExpNoteLine.tc_Rowid (icRowid), 
                    input  'QADFIN-2761':U (icFcMsgNumber), 
                    input  '' (icFcExplanation), 
                    input  '' (icFcIdentification), 
                    input  '' (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
                assign oiReturnStatus = -1.
            end.
        end.
        else do:
            assign vcMessage = substitute(#T-51'SAF (&1) cannot be blank if SAF Concept {&2} is defined. (&3, &4)':255(1909)t-51#,
                                  "5":U,
                                  t_sExpNoteLine.tcSAFConcept5,                
                                  t_sExpNoteLine.ExpNoteLineDate,
                                  ?). /* t_sExpNoteLine.tcItemCode */
            <M-29 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tExpNoteLine.tcSAFCode5':U (icFieldName), 
                input  t_sExpNoteLine.tcSAFCode5 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sExpNoteLine.tc_Rowid (icRowid), 
                input  'QADFIN-2762':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
            assign oiReturnStatus = -1.
        end.
    end.
end.