0

这是我第一次将 SAPGUI 协议与 VUGen 一起使用。我使用 SAPGUI 协议在 VUGen 中录制了一个脚本。我记录的过程是VA01“创建销售订单”。在重播脚本时,我在没有打开 sap 登录的情况下直接遇到错误:

错误:第 2 行包含 8 列而不是 6 列错误:无法打开表“C:\Users\Administrator\Documents\VuGen\Scripts\VA01\data_1.dat”。错误代码是“-4”。警告:扩展 parameng.dll 在调用函数 ExtPerProcessInitialize 时报告错误 -4 错误:线程上下文:调用驱动程序服务失败,原因 - 线程上下文未在此线程上初始化。

4

1 回答 1

0

我已经尝试自己录制“VA01 - 创建销售订单”流程,并且能够成功重播。

我正在使用 SAP 7.40 和 VuGen 12.55。

你能把你录制的脚本贴出来吗?

另外,您可以在此处查看我录制的脚本:https ://pastebin.com/DkFD8W5J

Action()
{

sapgui_open_connection_ex(connection_string1, 
    "", 
    "con[0]");

sapgui_select_active_connection("con[0]");

sapgui_select_active_session("ses[0]");

sapgui_select_active_window("wnd[0]");

sapgui_window_resize("149", 
    "25", 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui104", 
    END_OPTIONAL);

/*Before running script, enter password in place of asterisks in logon function*/

lr_think_time(4);

sapgui_logon("NWBCUSER", 
    "mercury", 
    "800", 
    "EN", 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1012", 
    END_OPTIONAL);

sapgui_tree_set_selected_node("VA01 - Create Sales Order", 
    shell1, 
    "F00003", 
    BEGIN_OPTIONAL, 
        "AdditionalNodeInfo=Favorites;VA01 - Create Sales Order", 
        "AdditionalInfo=sapgui1013", 
    END_OPTIONAL);

sapgui_tree_double_click_node("VA01 - Create Sales Order", 
    shell1, 
    "F00003", 
    BEGIN_OPTIONAL, 
        "AdditionalNodeInfo=Favorites;VA01 - Create Sales Order", 
        "AdditionalInfo=sapgui1014", 
    END_OPTIONAL);

lr_think_time(4);

sapgui_set_text("VBAK-AUART", 
    "12", 
    ctxtVBAK1, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1017", 
    END_OPTIONAL);

sapgui_set_text("Sales Organization", 
    "ss", 
    ctxtVBAK2, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1018", 
    END_OPTIONAL);

sapgui_set_focus(ctxtVBAK2, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1019", 
    END_OPTIONAL);

sapgui_send_vkey(F4, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1021", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[1]");

sapgui_window_scroll_to_row("0", 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1025", 
    END_OPTIONAL);

sapgui_set_focus(lbl1, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1024", 
    END_OPTIONAL);

sapgui_send_vkey(F2, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1028", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[0]");

sapgui_set_focus(ctxtVBAK3, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1031", 
    END_OPTIONAL);

sapgui_send_vkey(F4, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1033", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[1]");

sapgui_window_scroll_to_row("0", 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1037", 
    END_OPTIONAL);

sapgui_set_focus(lbl2, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1036", 
    END_OPTIONAL);

sapgui_send_vkey(F2, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1040", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[0]");

sapgui_set_focus(ctxtVBAK4, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1043", 
    END_OPTIONAL);

sapgui_send_vkey(F4, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1045", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[1]");

sapgui_window_scroll_to_row("0", 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1049", 
    END_OPTIONAL);

sapgui_set_focus(lbl3, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1048", 
    END_OPTIONAL);

sapgui_send_vkey(F2, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1052", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[0]");

sapgui_set_focus(ctxtVBAK5, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1055", 
    END_OPTIONAL);

sapgui_send_vkey(F4, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1057", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[1]");

sapgui_press_button("Continue   (Enter)", 
    btn1, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1060", 
    END_OPTIONAL);

sapgui_press_button("Continue   (Enter)", 
    btn1, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1063", 
    END_OPTIONAL);

sapgui_set_focus(ctxtG_SELFLD_TAB1, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1066", 
    END_OPTIONAL);

sapgui_send_vkey(F2, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1068", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[2]");

sapgui_window_close(
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1071", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[1]");

sapgui_set_focus(txtG_SELFLD_TAB1, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1074", 
    END_OPTIONAL);

sapgui_send_vkey(F2, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1076", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[2]");

sapgui_grid_select_cell("'Sales Office' (2, Description)", 
    shell2, 
    "2", 
    "TEXT", 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1079", 
    END_OPTIONAL);

sapgui_grid_select_rows("'Sales Office', 2", 
    shell2, 
    "2", 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1080", 
    END_OPTIONAL);

sapgui_grid_double_click_current_cell("'Sales Office' (2, Description)", 
    shell2, 
    BEGIN_OPTIONAL, 
        "CurrentRow=2", 
        "CurrentCell=TEXT", 
        "AdditionalInfo=sapgui1081", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[1]");

sapgui_set_focus(txtG_SELFLD_TAB1, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1084", 
    END_OPTIONAL);

sapgui_press_button("Cancel   (F12)", 
    btn2, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1086", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[0]");

sapgui_send_vkey(F4, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1089", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[1]");

sapgui_window_close(
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1092", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[0]");

sapgui_status_bar_get_text("paramStatusBarText", 
    BEGIN_OPTIONAL, 
        "Recorded status bar text: Choose a valid function", 
        "AdditionalInfo=sapgui1097", 
    END_OPTIONAL);

lr_think_time(6);

sapgui_set_text("Sales Office", 
    "1", 
    ctxtVBAK5, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1098", 
    END_OPTIONAL);

sapgui_set_text("Sales Group", 
    "2", 
    ctxtVBAK6, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui1099", 
    END_OPTIONAL);

sapgui_set_focus(ctxtVBAK6, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui10100", 
    END_OPTIONAL);

sapgui_press_button("Back   (F3)", 
    btn3, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui10102", 
    END_OPTIONAL);

sapgui_press_button("Log off   (Shift+F3)", 
    btn4, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui10105", 
    END_OPTIONAL);

sapgui_select_active_window("wnd[1]");

sapgui_press_button("Yes", 
    btnSPOP1, 
    BEGIN_OPTIONAL, 
        "AdditionalInfo=sapgui10108", 
    END_OPTIONAL);

return 0;

}

于 2017-11-13T08:52:37.403 回答