SAP GUI Scripting案例1:创建用户 单一,多个

SAP GUI Scripting 入门系列这篇文章中,我们简单介绍了SAP GUI Scripting的一些初始化设置,本文章案例主要记录了利用SAP Scripting的脚本,执行后自动生成单个和多个用户。

创建单一用户案例:
首先,录制一下屏幕上的操作。
打开SAP GUI后,点击图片中的Script Recording and Playback 或者右上方三角箭头
在这里插入图片描述
选择完路径以后,点击红色圆形按钮,开始录制
在这里插入图片描述
点击方块按钮,结束相关操作。在这里插入图片描述
找到对应要录入的字段,修改完脚本。最后执行的话,需要打开SAP开始界面(建议只打开你要录入数据的SAP客户端,只保留一个SAP界面,以免VBA操作错客户端)。,双击脚本运行或者通过SAP菜单执行脚本均可。
在这里插入图片描述
找到前面的路径,去打开录制好的vbs文件,可以直接用notepad打开
在这里插入图片描述
选择需要执行的脚本文件,点击Playback 绿色三角形箭头,执行。
在这里插入图片描述
执行完成,用户YA_TEST01创建生成成功。
在这里插入图片描述

创建多个用户案例:
根据上面的案例,我们发现脚本中红色框出来的,从SU01开始记录,那是不是我们只要复制这个代码,然后修改一下数据就可以了呢?
在这里插入图片描述
修改完变量以后,我们来测试一下看看:
在这里插入图片描述
执行成功,说明直接加代码,改变量就可以了。大功告成。
在这里插入图片描述
总结一下:当执行脚本的时候,一定要记得回到SAP初始界面,脚本中的变量需要修改。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Java can also be used to interact with SAP GUI Scripting API, although it requires additional steps for setup compared to using ActiveX-compatible languages. Here are the general steps to use SAP GUI Scripting API in Java: 1. Install and configure SAP GUI on the machine where the Java application will run. 2. Download and install the SAP Java Connector (SAP JCo), which is a middleware component that allows Java applications to communicate with SAP systems. 3. Add the SAP JCo library to the Java classpath. 4. Write Java code to create an instance of the SAP GUI Scripting API component, connect to a SAP system, and perform the desired actions. Here's a sample code snippet in Java to perform a simple task using SAP GUI Scripting API: ``` import com.sap.conn.jco.*; import com.sap.conn.jco.ext.*; public class SAPGUIScriptingExample { public static void main(String[] args) throws JCoException { // Create a new SAP GUI Scripting API object JCoDestination destination = JCoDestinationManager.getDestination("SAPGUI"); // Connect to the SAP system destination.ping(); // Get the SAP GUI Scripting API object for the active session JCoContext.begin(destination); JCoSession session = destination.getSession(); JCoFunction function = session.getFunction("BAPI_COMPANYCODE_GETLIST"); // Invoke a function to get a list of company codes function.execute(session); // Retrieve the result and display it JCoStructure result = function.getExportParameterList().getStructure("COMPANYCODE_LIST"); System.out.println(result); } } ``` Note that this is just a simple example, and more complex scenarios may require additional code and configuration.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值