cancel
Showing results for 
Search instead for 
Did you mean: 

Reading data from a GUITextfield

Former Member
0 Kudos

Hello,

at work we often have to transfer customerdata from SAP GUI to Outlook 2003.

At the moment we have to get the data manually via copy and paste from SAP GUI Textfields.

In the long term this is very frustrating and unefficient.

So to improve this process I thought that it might be possibly to read the data of the controls via VB WinApi = GetWindowText function.

Unfortunately one can easily get the handles of the controls, but not their content.

I don't know why maybe someone can help me?

If needed I can post the code. Although it works with other programs.

Another way to get the data should be possible if the SAP-Scripting is used.(As a macro or within vba-code)

I tried the macrorecorder, but it doesn't work.

So again I would like to ask for some help for solving this problem.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Michael,

when I want to get Data from SAP I use visual basich script (vbs).

So you can open a new mail item with following code (found on internet).

Sub Start
     Dim oOApp
     Dim oOMail

Const olByValue = 1
Const olMailItem = 0

Dim oOApp, oOMail
Set oOApp = CreateObject("Outlook.Application")
Set oOMail = oOApp1.CreateItem(olMailItem)
With oOMail
  .Display
      .To = "user.1@domain.com;user.2@domain.com"
      .CC = "user.3@domain.com"
      .Subject = "This is the subject"
       .Body = vbcr & "Hello everybody," & vbcr & vbcr & _
         "this is the new adress of our customer:" & vbcr
      '.Attachments.Add "c:\file.txt", olByValue
  '.Send
End With

Set oOMail = Nothing

Set oOMail = Nothing

End Sub
Start

Use this code to get the content of one Text-Field:

session.findById("wnd[0]/usr/ . . .").setFocus

session.findById("wnd[0]/usr/ . . .").caretPosition = 0

ContentOfField = session.findById("wnd[0]/usr/ . . .").Text

Now it's up to you to combine it.

Netkid