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

Using Macro in Excel How to open a SAP directly?

$
0
0

Hi,

       Can Anyone Suggest and help me to do above Code in Excel,"Using Macro in Excel  How to open SAP directly"

 

Example: I want to Open T.CODE: MM01 directly, without login in to SAP, Using Macro, i want to open SAP Directly, Anyone Suggest me how to do it?.............

 

I Tried this But it  showing Run time Error'438', Object does not support this property or method........

VBCODE:

 

Dim sap As Object

Dim conn As Object

Sub T_login()

Set sap = CreateObject("SAP.Functions")

Set conn = sap.Connection

conn.System = "production"

conn.client = "800"

conn.user = "SAPUSER"

conn.Password = "123456"

conn.Language = ""

conn.Tcode = "MM01"

If conn.logon(0, False) Then

MsgBox "Logon to the SAP system is not possible", vbOKOnly, "Comment"

Else

End If

If Not IsObject(SapGuiApp) Then

Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")

End If

If Not IsObject(Connection) Then

Set Connection = SapGuiApp.OpenConnection("production", True)

End If

If Not IsObject(session) Then

Set session = Connection.Children(0)

End If

session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "CLIENT"

session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "USER"

session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "PASSWORD"

session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = ""

session.findById("wnd[0]/usr/txtRSYST-LANGU").SetFocus

session.findById("wnd[0]/usr/txtRSYST-LANGU").caretPosition = 2

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

Set wshell = CreateObject("Wscript.Shell")

wshell.Run Chr(34) & Path & "\script.vbs" & Chr(34), 1, 1

End Sub

 

Anyone send me the Exact code related to this.................

 

Its very immediate requirement.................

 

 

Regards

Karthick


Viewing all articles
Browse latest Browse all 325

Trending Articles



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