Quantcast
Channel: SCN : Discussion List - Scripting Languages
Viewing all articles
Browse latest Browse all 325

Insert VBA code in a SAP script

$
0
0

Hi,

 

I have a question if possible to insert VBA code that will copy data in range A:A(from book1 file) to this script. Data in range A are material codes in thousands. So that SAP will execute the query automatically.

 

Thank you and have a nice day.

 

 

SAP SCRIPT HERE:

 

If Not IsObject(SAPguiApp) Then
Set SAPguApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Not IsObject(Connection) Then
Set Connection = SAPguiApp.OpenConnection("A6P(HK/TW) - SSO", True)
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]").resizeWorkingPane 105,29,false

session.findById("wnd[0]/tbar[0]/okcd").text = "zse16"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/ctxtI_TABLE").text = "marc"

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

session.findById("wnd[0]").sendVKey 8

session.findById("wnd[0]/tbar[1]/btn[17]").press

session.findById("wnd[1]/usr/txtV-LOW").text = "marc dl"

session.findById("wnd[1]/usr/txtV-LOW").caretPosition = 4

session.findById("wnd[1]/tbar[0]/btn[8]").press

 

VBA code here

 

session.findById("wnd[0]/usr/btn%_I1_%_APP_%-VALU_PUSH").press

session.findById("wnd[1]/tbar[0]/btn[24]").press

session.findById("wnd[1]/tbar[0]/btn[8]").press

session.findById("wnd[0]/tbar[1]/btn[8]").press

session.findById("wnd[0]").sendVKey 33

session.findById("wnd[1]").sendVKey 14

session.findById("wnd[1]/usr/chk[1,4]").selected = true

session.findById("wnd[1]/usr/chk[1,5]").selected = true

session.findById("wnd[1]/usr/chk[1,6]").selected = true

session.findById("wnd[1]/usr/chk[1,6]").setFocus

session.findById("wnd[1]").sendVKey 0

session.findById("wnd[0]/tbar[0]/okcd").text = "%pc"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").select

session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").setFocus

session.findById("wnd[1]/tbar[0]/btn[0]").press

session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "a6p.xls"

session.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 7

session.findById("wnd[1]/tbar[0]/btn[0]").press


Viewing all articles
Browse latest Browse all 325

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>