Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BOC MSO MSO700 Error Handling Problems

Status
Not open for further replies.

GlenG

Technical User
Sep 6, 2001
3
0
0
GB
Hi, Currently migrating MINT scripts into BOC, anything MSQ related has worked well with no problems to date. However just started on the first MSO BOC script and have got stuck with error handling.

The Program is MSO700, option 2 amend MST record.

On Second Window MSM700B you have to Validate then Confirm if I have an error that falls over at the final Confirm stage then no problems all works well. However if I have a field that returns an error at the Validate stage then I get stuck. I get the error message continued onto the next record I process even though there is nothing wrong with the record.

I believe the problem is that when you validate and get an error you get a message display window with an edit / close button. I cannot seem to find the Object / methods applicable to these windows to enable me to handle these in the error trapping.

I think this what is causing my gobjMIMS.Screen.MSO.Error.Name etc to retain error values onto the next record.

Any help or advice / code samples on the correct way to handle error trapping in a MSO BOC script would be very helpful and greatly appreciated.

Regards

Glen

 
Hello... using MSO's with BOC is very different to MSK objects. You will have to cater for every option/error available in the MSO screens particular to your business processes.
Below I have is an example of how you have to code using MSO's and catering for warning messages, obviously there are many different ways to code this, but this should get u started.

Drew



exectue mso screen "MSO???"
employee_id1 = '123456'
...
...
execute mso command "VALIDATE"
if error and error <> &quot;&quot;MIMS Warning Message&quot; then
if error = 0609 then
msgbox &quot;Unknown Employee&quot;
exit sub
else
go to error_handler
end if
else
if error = &quot;MIMS Warning Message&quot; then
execute mso command &quot;Confirm&quot;
if error then
...
end if
end if
some_mims_field = &quot;123456&quot;
...
... and so on
 
Although this may not help with working out error handling, but why not use the MaintSchedTsk object?

Steve
 
Good point Steve,
however if you are talking about Invoicing or a process that does not have a stateless object to work with, you have no choice but to use the mso objects.

Drew
 
Once you've worked out what the MSO does, and worked out the logic as Drw has suggested above, then you might want some code.
Code:
The following code samples use a Debug.Print statement where proper error handling and feedback to the user would normally be coded.

' STARTING A MSO PROGRAM

  ' Make sure MSO handler is waiting
  If Not oMimsx.Screen.Idle Then
    Debug.Print &quot;Currently doing something on another MSO&quot;
    GoTo ItemError
  End If

  If Not oMimsx.Screen.ExecuteMSO(&quot;MSOxxx&quot;) Then
    ' Problems with the MIMSX screen interface
    Debug.Print &quot;MIMSX Error: Cannot start MSOxxx&quot;
    GoTo ItemError
  End If
  If oMimsx.Screen.Reply.Requests.Count > 0 Then
    If oMimsx.Screen.Reply.Requests(1).Instances(1).IsError Then
      ' MIMS does not let this user start this program (eg. Insufficient Access)
      sTmp = Trim$(oMimsx.Screen.Reply.Requests(1).Instances(1).Fields(&quot;_ErrorTexts&quot;).Value)
      If Left(sTmp, 1) = &quot;&quot;&quot;&quot; Then
        sTmp = Mid(sTmp, 2)
      End If
      If Right(sTmp, 1) = &quot;&quot;&quot;&quot; Then
        sTmp = Left(sTmp, Len(sTmp) - 1)
      End If
      sTmp = Trim$(sTmp)
      Debug.Print &quot;MIMS Error: Cannot start MSOxxx: &quot; + sTmp
      GoTo ItemError
    End If
  End If


' CHECK NAVIGATION ARRIVED AT EXPECTED SCREEN
' I would normally put this in a Function or Sub as it is often called numerous times
' Pass a string parameter sScreen to hold the screen name which is expected eg &quot;MSMxxxA&quot;

  If oMimsx.Connected = False Then
    ' Something bad has happened
    Debug.Print &quot;No connection to MIMS&quot;
    MIMS_Disconnect
    Exit Function
  End If
  
  If oMimsx.Screen.Idle Then
    ' Something else bad has happened
    Debug.Print &quot; Lost connection to MIMS MSO handler&quot;
    MIMS_Disconnect
    Exit Function
  End If
  
  ' Check if on an unexpected screen
  If Trim$(oMimsx.Screen.MSO.Name) <> sScreen Then
    If oMimsx.Screen.MSO.Fields.Count = 0 Then
      Debug.Print &quot;MIMS Bad Navigation: Expected screen &quot; + _
              sScreen + &quot;, no screen map available. Probable back-end crash.&quot;
      Exit Function
    Else
      If Trim$(oMimsx.Screen.MSO.Error) <> &quot;&quot; Then
        Debug.Print &quot;MIMS Error: On screen &quot; + _
          Trim$(oMimsx.Screen.MSO.Name) + &quot;: &quot; + _
          Trim$(oMimsx.Screen.MSO.Error) + vbCrLf + _
          &quot;Field in Error: &quot; + _
          Trim$(oMimsx.Screen.MSO.ActiveField.Name) + &quot;; &quot; + vbCrLf + _
          &quot;Value of Field in Error: &quot; + _
          Trim$(oMimsx.Screen.MSO.ActiveField.Value)
        Exit Function
      Else
        Debug.Print &quot;MIMS Bad Navigation: Expected screen &quot; + _
          sScreen + &quot;, got screen &quot; + _
          Trim$(oMimsx.Screen.MSO.Name)
        Exit Function
      End If
    End If
  End If
  
  ' Check if on expected screen, but with error message
  If Trim$(oMimsx.Screen.MSO.Error) <> &quot;&quot; Then
    Debug.Print &quot;MIMS Error: On screen &quot; + _
      Trim$(oMimsx.Screen.MSO.Name) + &quot;: &quot; + _
      Trim$(oMimsx.Screen.MSO.Error) + vbCrLf + _
      &quot;Field in Error: &quot; + _
      Trim$(oMimsx.Screen.MSO.ActiveField.Name) + &quot;; &quot; + vbCrLf + _
      &quot;Value of Field in Error: &quot; + _
      Trim$(oMimsx.Screen.MSO.ActiveField.Value)
    Exit Function
  End If

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top