0

I need to populate dates on fields in SAP which if manually entered is properly captured by the script recorder.

Is it possible to update the script dates using a cell link in 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"

I plan to copy the recorded SAP script and incorporate it in an Excel macro as a button.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Kevz R
  • 11
  • 1

2 Answers2

0

You may try like this:

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 

Get App object, then get workbook and worksheet objects, and then assign your script cell values.

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
-1

Everything is well discussed here including all the comments asking for different scenarios. https://scn.sap.com/thread/1699675

Kevz R
  • 11
  • 1