通过SAP GUI脚本处理SAP错误 [英] SAP Error handling by SAP GUI Scripting

查看:133
本文介绍了通过SAP GUI脚本处理SAP错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用SAP GUI脚本代码通过SAP表单提交批量记录.它从excel文件中一张一张地挑选记录,并提交到SAP系统中.

I m using SAP GUI Scripting code for bulk record submission through SAP form. It picks records one by one from excel file and submits in SAP system.

我的问题:

我想在其中包含错误处理.因此,如果在提交任何特定记录时发生任何错误,则脚本不应停止.在注释"字段中输入适当的消息后,应移至下一行.

I want to include error handling into it. So that if any error occurs at any particular record submission, Script shouldn't stop. It should move to the next line after putting appropriate message in Comment field.

任何人都可以阐明如何确定SAP面临错误还是警告吗?

Can anyone throw some light how to identify whether SAP is facing some Error or Warning?

如果发生错误,如何摆脱错误,即如何处理并转移到下一个记录提交.

And if Error occurs how to get out of it i.e., how to handle that and move to next record submissions.

推荐答案

是的,您可以这样做.

在botton查找状态栏

Look for the status bar at botton

SAP中的GUI脚本帮助部分非常有用,它将非常详细地向您解释.

GUI Scripting help section in SAP is very helpful it will explain you things in very details.

GuiStatusBarObject --> Members --> Message Type

我们可以根据需要使用这些属性,如果您需要移动next,暂停或通知用户,则可以使用这些消息类型并进行相应的工作.

Us can use those properties as per your needs, If You need to move next , halt or notify user You can use these messages type and work accordingly.

如果SAP本身发生错误,SAP脚本编制不会抛出错误,只会在找不到元素或其他问题时抛出错误.

SAP scripting does not throw error if error occurs in SAP itself , It will only throw error when it can not find elements or some other issue.

示例代码:

Public Sub get_status_bar_value_exit_if_Error()
    Dim usr_resp As String
    If (session.findById("wnd[0]/sbar").messagetype = "E" Or session.findById("wnd[0]/sbar").messagetype = "W") Then
       usr_resp = MsgBox(session.findById("wnd[0]/sbar").Text & Chr(13) & "Show the Error in SAP ?", vbYesNo)
            If usr_resp = vbYes Then

        Else
            Call go_to_Sap_home
        End If

        End
    End If
End Sub

如果用户选择不查看SAP中的错误,则在此处我选择退出当前任务,然后回家,否则SAP将停止并且用户可以在状态栏中看到错误.您可以做任何想做的事.

Here I chose to exit the current task and go to home if user chose not to see error in SAP ,else SAP will halt and user can see error in the status bar. You can do anything you want to do.

这篇关于通过SAP GUI脚本处理SAP错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆