9/11 计划反馈 - Developing SAPGUI Vuser Scripts
SAP 脚本的录制说复杂也复杂说简单也简单,主要看几个注意点
1. The basic steps in checking and setting up your system for the recording of SAPGUI Vusers, are Checking the Patch Level and Enabling Scripting.
就是检查你的sap client端是否满足了VuGen的需要,现在大概是640,620的可能就会出问题,尽管书上还是620 patch level大于32
server端的应该也需要检查,不过没接触过server端,现在也不清楚
2. 正常安装就好了,安装完以后注意修改以下设置,
就按上面图上的选择就好了,第二个好象可以不显示一些弹出提示,例如这个用户已经登陆,云云
3. Retrieving Information
When working with SAGUI Vusers, you can retrieve the current value of a
SAPGUI object using the sapgui_get_<xxx> functions. You can use this
value as input for another business process, or display it in the output log.
Retrieving Status Bar Information
The following example illustrates how to save part of a status bar message in
order to retrieve the order number.
To retrieve the order number from the status bar:
1 Navigate to the point where you want to check the status bar text, and select
Insert > New Step. Choose the sapgui_status_bar_get_type function. This
verifies that the Vuser can successfully retrieve text from the status bar.
2 Insert an if statement that checks if the previous statement succeeded. If so,
save the value of the argument using sapgui_status_bar_get_param.
This sapgui_status_bar_get_param function saves the order number into a
user-defined parameter. In this case, the order number is the second index of
the status bar string.
example:
sapgui_press_button("Save (Ctrl+S)",
"tbar[0]/btn[11]",
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1038",
END_OPTIONAL);
sapgui_status_bar_get_type("Status");
if(0==strcmp(lr_eval_string("{Status}"),"Success"))
sapgui_status_bar_get_param("2", " Order_Number ");
这个就是说从status bar提取数据 然后以后应用其他地方,这个方法我还没试验过,不过看来是很有用的
4. Saving Date Information
When creating scripts that use dates, your script may not run properly. For
example, if you record the script on June 2, and replay it on June 3, the date
fields will be incorrect. Therefore, you need to save the date to a parameter
during text execution, and use the stored value as input for other date fields.
To save the current date or time during script execution, use the
lr_save_datetime function. Insert this function before the function
requiring the date information. Note that the format of the date is specific
to your locale. Use the relevant format within the lr_save_datetime
function. For example, for month.day.year, specify "%m.%d.%Y".
In the following example, lr_save_datetime saves the current date. The
sapgui_set_text function uses this value to set the delivery date for two days
later.
lr_save_datetime("%d.%m.%Y", DATE_NOW + (2 * ONE_DAY),
"paramDateTodayPlus2");
sapgui_set_text("Req. deliv.date",
"{paramDateTodayPlus2}",
"usr/ctxtRV45A-KETDAT",
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1025",
END_OPTIONAL);
这个就是说显示和输入日期的,都是看好例子就可以了,照抄就ok
现在就到这里,回来再补充