Skip to Content
0
Mar 25, 2020 at 08:53 AM

How to capture text using SAP Gui Scripting?

6539 Views Last edit Mar 25, 2020 at 07:38 AM 5 rev

sap-capture-1.png

sap-capture-2.png

sap-capture-3.png

I am using Python to automate an SAP Logon process by modifying recorded script.
But I have run into a problem. I do not know how to extract the text data I find on SAP.


One process that I am doing is to extract information from Inbox line-by-line.
How can I capture the text using scripting? (Info record, vendor, material, etc)


I tried to record most steps but I have no idea how to capture the .text field.
The record does not pinpoint to that section.

 session.findById("wnd[0]").resizeWorkingPane(184, 30, 0) session.findById("wnd[0]/tbar[1]/btn[36]").press() session.findById("wnd[0]/usr/cntlSINWP_CONTAINER/shellcont/shell/shellcont[0]/shell").selectedNode = " 2" # Selects Inbox

session.findById("wnd[0]/usr/cntlSINWP_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell").selectedRows = "0" # Selects First Row
        session.findById("wnd[0]/usr/cntlSINWP_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell").selectionChanged()
        print(session.findById("wnd[0]/usr/cntlSINWP_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell").text) 
# This thing prints "SAPGUI.GridViewCtrl.1"......
        session.findById("wnd[0]/usr/cntlSINWP_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell").pressToolbarButton("DISP") 
      
        session.findById("wnd[0]/usr/tabsSO33_TAB1/tabpTAB1").select()
        print(session.findById("wnd[0]/usr/tabsSO33_TAB1/tabpTAB1").text)

# This thing prints "Doc. contents" ......I need to get (Info record, vendor, material, etc)


If you look at SAP_Capture_3.png photo, I have identified the shell. But I cannot get the text data of it...

print(session.findByID("wnd[0]/usr/cntlSINWP_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").text)

Above code only gives me "SAP.HTMLControl.1"...........I want the contents.

Help me please.

Attachments

sap-capture-1.png (83.5 kB)
sap-capture-2.png (41.1 kB)
sap-capture-3.png (106.7 kB)