Skip to Content
avatar image
Former Member

How do I copy selected text in SAP with SAP macro?

This seems like the most simplistic or perhaps fundamental macro question... I've been unable to locate this answer though. Is there some special string of code to execute this function?

Here's my script:

If Not IsObject(application) Then Set SapGuiAuto = GetObject("SAPGUI") Set application = SapGuiAuto.GetScriptingEngine End If If Not IsObject(connection) Then Set connection = application.Children(0) End If If Not IsObject(session) Then Set session = connection.Children(0) End If If IsObject(WScript) Then WScript.ConnectObject session, "on" WScript.ConnectObject application, "on" End If session.findById("wnd[0]").maximize session.findById("wnd[0]/tbar[1]/btn[7]").press session.findById("wnd[0]/usr/sub/1/cntlV56I_PLAN_SCREEN_CONTAINER/shellcont/shell/shellcont[1]/shell[0]").pressButton "MM_TPMA 10001" session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX" session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem "%GOS_SO_SENDOBJ" session.findById("wnd[1]/usr/sub/1/sub/1/1/tabsSO33_TAB1/tabpTAB2").select session.findById("wnd[1]/usr/sub/1/sub/1/1/tabsSO33_TAB1/tabpTAB4").select session.findById("wnd[1]/usr/sub/1/sub/1/1/tabsSO33_TAB1/tabpTAB4/ssub/1/1/1/2/cntlATT_GRID_CONTROL/shellcont/shell").pressToolbarButton "DELE" session.findById("wnd[1]/usr/sub/1/sub/1/1/tabsSO33_TAB1/tabpTAB1").select session.findById("wnd[1]/usr/sub/1/sub/1/1/tabsSO33_TAB1/tabpTAB1/ssub/1/1/1/2/cntlEDITOR/shellcont/shell").text = "0001344568 " + vbCr + "0800953374 BANTA SAW LTD. DAP 04/20/2018 CA C " + vbCr + "" + vbCr + "" session.findById("wnd[1]/usr/sub/1/sub/1/1/tabsSO33_TAB1/tabpTAB1/ssub/1/1/1/2/cntlEDITOR/shellcont/shell").setSelectionIndexes 59,59 session.findById("wnd[1]/usr/sub/1/sub/1/1/txt").text = "rtp shipment 0001344568" session.findById("wnd[1]/usr/sub/1/sub/1/2/tabsTAB_CONTROL/tabpREC/ssub/1/2/1/2/tblSAPLSO04REC_CONTROL/ctxt[0,0]").text = "Eric Shelton" session.findById("wnd[1]/usr/sub/1/sub/1/2/tabsTAB_CONTROL/tabpREC/ssub/1/2/1/2/tblSAPLSO04REC_CONTROL/ctxt[0,0]").setFocus session.findById("wnd[1]/usr/sub/1/sub/1/2/tabsTAB_CONTROL/tabpREC/ssub/1/2/1/2/tblSAPLSO04REC_CONTROL/ctxt[0,0]").caretPosition = 12 session.findById("wnd[1]/tbar[0]/btn[20]").press

I've been highlighting text within transaction VT03N using the "select all" function button but there's no "copy" function button so SAP macro just pulls the data of text that I used to record the operation. Thank you so much for you help on this!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers