Skip to Content
avatar image
Former Member

Copying second level Container text - Sendkeys?

Hi there,

I'm very new to coding SAP through scripts so apologies if there is a really obvious answer to this. I've tried using the record function to capture what I want to do but it doesn't capture me copying the text using the keyboard so I was wondering if there was another way..... here is what I have so far.

session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[0]/usr/shell/shellcont[1]/shell[1]").SelectItem " 2", "&Hierarchy"

Everything works great up until this point and does exactly as it should. What I want to do next is copy the contents of the selected item. I can do this easily by using CTRL-C on the keyboard but I can't find the proper way of either using sendkeys or allocating the text to a variable such as..

variable1 = session.FindById("wnd[0]/usr/shell/shellcont[1]/shell[1]").SelectItem " 2", "&Hierarchy"

session.FindById("wnd[0]/usr/shell/shellcont[1]/shell[1]").SendVKey V92

Both options give errors though.

Many thanks in advance for any assistance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jul 13, 2017 at 08:20 AM

    Hello Scott,

    try this to copy the content of an active cell to the clipboard.

    CurrCellRow = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").CurrentCellRow()
    CurrCellCol = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").CurrentCellColumn()
    CurrCellContent = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").GetCellValue(CurrCellRow, CurrCellCol)
    Set oIE = CreateObject("InternetExplorer.Application")
    oIE.document.parentwindow.clipboardData.SetData "text", CurrCellContent
    'Now is the content of the cell in the clipboard

    Let us know your results.


    Add comment
    10|10000 characters needed characters exceeded