on 06-22-2015 11:56 AM
Good morning, everybody!
I've been looking for the solution in the last days but I really have not managed to succeed:
I am trying to make a vba code to:
1-log into SAP,
2-run some transactions
3-export to excel.
But even the "log into SAP" part is not OK!
I tried several codes, the one below OPENS the SAP logon screen, but does not fill in any fields. I Used CreateObject("Sapgui.ScriptingCtrl.1"):
Sub Entrar_SAP()
If Not IsObject(SAPguiApp) Then
Set SAPguiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Not IsObject(Connection) Then
Set Connection = SAPguiApp.OpenConnection("xxxxxxx)", True)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If
session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "100"
session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "user"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "pass"
session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "PT"
session.findById("wnd[0]/usr/txtRSYST-LANGU").SetFocus session.findById("wnd[0]/usr/txtRSYST-LANGU").caretPosition = 2
session.findById("wnd[0]").sendVKey 0
ANother one, with CreateObject("SAP.Functions"), showed:
"RFC error received. No RFC authorization for function module RFC PING"
the code is:
'Declaration
Dim objBAPIControl As Object 'Function Control (Collective object)
Dim sapConnection As Object 'Connection object
Set objBAPIControl = CreateObject("SAP.Functions")
Set sapConnection = objBAPIControl.Connection
sapConnection.Client = "xxxxx"
sapConnection.User = "xxxxxx"
sapConnection.Language = "PT"
sapConnection.hostname = "xxxxx"
sapConnection.Password = "xxxxxxxx" 'Fake password
sapConnection.SystemNumber = "4"
sapConnection.System = "xxxxxx)"
sapConnection.Logon
If sapConnection.Logon(1, True) <> True Then
MsgBox "No connection to R/3!"
Exit Sub 'End program
End If
Can someone please help me?
Thanks!!
Hi Eduardo
1-log into SAP,
2-run some transactions
You can create the simple .BAT or .CMD on Windows OS.
refer the help in start sapshcut /?
Syntax-
Start sapshcut -system=SID -client=xxx -desc= " description of System" - user= USER ID -pw=password -maxgui -command= "transaction code"
3-export to excel.
For this you can create the Z custom program export the data to excel file format as output .
BR
SS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
With same script we are using in our environment.
From the command prompt you can type " start sapshcut /? " you can find the help menu with syntax and switches settings
For Example
SID = DEV
System description - Development system
Client = 100
User id = Test1
password= welcome
Start sapshcut -system=dev -client=100 -desc= "Development system " - user=test1 -pw=welcome -maxgui -command=St03
Refer the SAP note 103019 - SAPshortcut: Program parameters
Regards
SS
Thanks again for answering! The problem is that it is not recognizing username and password! I've tried with " " but has not worked either! It keeps on opening the log on screen with my PC username (different from SAP name). Do you have any suggestions?? Also i've tried opening the link but i have no access to that page (need login).
Hello again! Thanks! i used the code below and it worked. for some reason in sap version 730 yours was not working.
Now that I can enter in a transaction, my next move is to run the transactions and report to Excel kkk. The problem is that I dont have permission in my company to use ABAP transactions.
By the way, do you know a way to log in with command without opening the "are you sure you want to open the file" screen?
Start sapshcut -sysname="Customer PRD" -client=100 -user=CONUSER -pw=PASS -language=EN -type=Transaction -command=SESSION_MANAGER
Hi
Its a just warning message while opening the command. refer the your tube video to disable the pop-up or just uncheck the option on the same screen
BR
SS
1-log into SAP,
2-run some transactions
3-export to excel.
Do you know about SECAT ?
May be that can help and save your efforts you are putting into VBA ?
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, Divyanshu! Thanks for answering!
I dont know anything about that. I've just did a quick research on the web and it is related to ABAP programming, right?
I dont have access to ABAP transactions in the company I work for (Despite the fact that i wanted to)
However, i do know a lot about VBA, thats why i intended to do that way.
Regards,
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.