【问题标题】:SAPgui script with variables values from Excel带有 Excel 变量值的 SAPgui 脚本
【发布时间】:2016-02-19 06:31:39
【问题描述】:

我需要在 SAP 中的字段上填充日期,如果手动输入,脚本记录器会正确捕获这些日期。

是否可以使用 Excel 中的单元格链接更新脚本日期?

session.findById("wnd[0]/usr/ctxtLKO74-PERIO").Text = "2"
session.findById("wnd[0]/usr/ctxtLKO74-BUPERIO").Text = "2"
session.findById("wnd[0]/usr/txtLKO74-GJAHR").Text = "2016"
session.findById("wnd[0]/usr/ctxtLKO74-BZDAT").Text = "29.02.2016"

我打算复制录制的 SAP 脚本并将其作为按钮合并到 Excel 宏中。

【问题讨论】:

    标签: excel vbscript sap-gui


    【解决方案1】:

    你可以这样尝试:

    Set app = CreateObject("Excel.Application")
    Set wbook = app.Workbooks.Open("c:\tmp\prices.xls")
    set sheet = wbook.Sheets("Tabelle1")
    
    session.findById("wnd[0]/usr/ctxtLKO74-PERIO").Text = sheet.Cells(1,2).Value 
    session.findById("wnd[0]/usr/ctxtLKO74-BUPERIO").Text = sheet.Cells(1,3).Value 
    session.findById("wnd[0]/usr/txtLKO74-GJAHR").Text = sheet.Cells(1,4).Value 
    session.findById("wnd[0]/usr/ctxtLKO74-BZDAT").Text = sheet.Cells(1,5).Value 
    

    获取 App 对象,然后获取工作簿和工作表对象,然后分配脚本单元格值。

    【讨论】:

      【解决方案2】:

      这里的所有内容都得到了很好的讨论,包括所有要求不同场景的 cmets。 https://scn.sap.com/thread/1699675

      【讨论】:

      • 这里不鼓励仅链接的答案
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-16
      • 1970-01-01
      • 2016-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-30
      相关资源
      最近更新 更多