2016-11-17 46 views
0

这是我第一次使用VGen的SAPGUI协议。我使用SAPGUI协议在VUGen中录制了一个脚本。我记录的过程是VA01“创建销售订单”。在重放脚本我得到下面的错误的情况下直接打开SAP登录:VUGen使用SAPGUI协议

Error: line 2 contains 8 columns instead of 6 Error: Table 'C:\Users\Administrator\Documents\VuGen\Scripts\VA01\data_1.dat' cannot be opened. Error code is '-4'. Warning: Extension parameng.dll reports error -4 on call to function ExtPerProcessInitialize Error: Thread Context: Call to service of the driver failed, reason - thread context wasn't initialized on this thread.

回答

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; 

}