×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

BOC MSO MSO700 Error Handling Problems

BOC MSO MSO700 Error Handling Problems

BOC MSO MSO700 Error Handling Problems

(OP)
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

RE: BOC MSO MSO700 Error Handling Problems

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 <> ""MIMS Warning Message" then
   if error = 0609 then
       msgbox "Unknown Employee"
       exit sub
   else
       go to error_handler
   end if
else
   if error = "MIMS Warning Message" then
       execute mso command "Confirm"
       if error then
          ...
       end if
   end if
   some_mims_field = "123456"
   ...
   ... and so on

RE: BOC MSO MSO700 Error Handling Problems

Although this may not help with working out error handling, but why not use the MaintSchedTsk object?

Steve

RE: BOC MSO MSO700 Error Handling Problems

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

RE: BOC MSO MSO700 Error Handling Problems

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.

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 "Currently doing something on another MSO"
    GoTo ItemError
  End If

  If Not oMimsx.Screen.ExecuteMSO("MSOxxx") Then
    ' Problems with the MIMSX screen interface
    Debug.Print "MIMSX Error: Cannot start MSOxxx"
    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("_ErrorTexts").Value)
      If Left(sTmp, 1) = """" Then
        sTmp = Mid(sTmp, 2)
      End If
      If Right(sTmp, 1) = """" Then
        sTmp = Left(sTmp, Len(sTmp) - 1)
      End If
      sTmp = Trim$(sTmp)
      Debug.Print "MIMS Error: Cannot start MSOxxx: " + 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 "MSMxxxA"

  If oMimsx.Connected = False Then
    ' Something bad has happened
    Debug.Print "No connection to MIMS"
    MIMS_Disconnect
    Exit Function
  End If
  
  If oMimsx.Screen.Idle Then
    ' Something else bad has happened
    Debug.Print " Lost connection to MIMS MSO handler"
    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 "MIMS Bad Navigation: Expected screen " + _
              sScreen + ", no screen map available. Probable back-end crash."
      Exit Function
    Else
      If Trim$(oMimsx.Screen.MSO.Error) <> "" Then
        Debug.Print "MIMS Error: On screen " + _
          Trim$(oMimsx.Screen.MSO.Name) + ": " + _
          Trim$(oMimsx.Screen.MSO.Error) + vbCrLf + _
          "Field in Error: " + _
          Trim$(oMimsx.Screen.MSO.ActiveField.Name) + "; " + vbCrLf + _
          "Value of Field in Error: " + _
          Trim$(oMimsx.Screen.MSO.ActiveField.Value)
        Exit Function
      Else
        Debug.Print "MIMS Bad Navigation: Expected screen " + _
          sScreen + ", got screen " + _
          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) <> "" Then
    Debug.Print "MIMS Error: On screen " + _
      Trim$(oMimsx.Screen.MSO.Name) + ": " + _
      Trim$(oMimsx.Screen.MSO.Error) + vbCrLf + _
      "Field in Error: " + _
      Trim$(oMimsx.Screen.MSO.ActiveField.Name) + "; " + vbCrLf + _
      "Value of Field in Error: " + _
      Trim$(oMimsx.Screen.MSO.ActiveField.Value)
    Exit Function
  End If



Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close