SAP GUI Scripting

Have you ever fallen into the situation that you have to repeat same operations plenty of times to find something out or get it down in SAP . For instance:

1. There are 1000 sales orders in production system and you need to find out which of them used a pricing type ZT01 in its variant material item.

2. You're required to create 100 variants for a transaction and the variant values have been in Excel or MS Access.

Of course, you can figure these requests out with some technologies like query, eCATT, LSMW, BDC etc. but here, I'd like to introduce another solution - SAP GUI Scripting. 

 

Steps:

1. Start script recording in SAP

2. Run proper transaction like VA03 and step into target screen

3. Stop the recording

4. Tune the generated Script(VBScript)

If Not IsObject(application) Then
   Set SapGuiAuto  = GetObject("SAPGUI")
   Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
   Set connection = application.Children(0)
End If
If Not IsObject(session) Then
   Set session    = connection.Children(0)
End If
If IsObject(WScript) Then
   WScript.ConnectObject session,     "on"
   WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "VA03"
session.findById("wnd[0]").sendVKey 0
...

 session.findById("wnd[0]/tbar[1]/btn[8]").press
 session.findById("wnd[0]/usr/lbl[0,2]").setFocus
 session.findById("wnd[0]/usr/lbl[0,2]").caretPosition = 37
 session.findById("wnd[0]/tbar[0]/btn[3]").press

5. Run the script

 

Comment:

1. We can use session.findById to find value of screen fields, and check the value with custom logic

2. We even can use ADO to get data from database like MS Access as data source, but need the support of VB/VBA.

3. QTP is a powerful automatic testing tool which can be used to test SAP based on SAP GUI Scription as well.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值