Problem with SAP logon by VBA

Hi, I'm new in the community and I'm also new with SAP, so sorry for any errors.
For my work I need to open SAP by excel (VBA); and I have found the code below but it don't work.
Sub Work()
Set app = CreateObject("Sapgui.ScriptingCtrl.1")
Set Connection = app.openconnection("my system", True)
Set session = Connection.Children(0)
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 = "Language"
Session.findById("wnd[0]").sendVKey 0
End Sub
When the macro runs there is this error  
Can you help me?
Thank you,
ax_salerno

Hi Alessandro - I am sharing an Excel sub that works for me by opening up logon pad, signing on to production, gettting credentials, then going into SAP and doing a transaction, and finally asking the user to click ok to terminate the session. I think this is something that there were questions on how to do the session close nicely but not sure if there is a solution yet.
Hope this helps.
Regards
Umur
Sub Logon()
'starts by executing logon pad, selecting prod, then enters
id/pwd
'works to sign on to sap and then kill the connection.
refers to saplogon.exe in Program Files/SAP71/FrontEnd/SAPGui folder
Dim SAPguiAPP As Object
Dim oConnection As Object
Dim Session As Object
Dim SAPCon As Object, SAPSesi As Object
Dim SapGuiAuto As Object, SAPApp As Object
If SAPguiAPP Is Nothing Then
    Set SAPguiAPP =
CreateObject("Sapgui.ScriptingCtrl.1")
End If
If oConnection Is Nothing Then
    Set oConnection =
SAPguiAPP.OpenConnection("1. Prod", True)
End If
If SAPSesi Is Nothing Then
   Set SAPSesi =
oConnection.Children(0)
End If
Application.DisplayAlerts = False
With SAPSesi    
    .FindById("wnd[0]/usr/txtRSYST-MANDT").Text
= "010"
.FindById("wnd[0]/usr/txtRSYST-BNAME").Text = "USER"
.FindById("wnd[0]/usr/pwdRSYST-BCODE").Text =
"PASSW"
'.FindById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"
.FindById("wnd[0]").SendVKey 0
    'start extraction
.FindById("wnd[0]").Maximize
.FindById("wnd[0]/tbar[0]/okcd").Text = "/Niw33"
.FindById("wnd[0]").SendVKey 0
.FindById("wnd[0]").Maximize
.FindById("wnd[0]/usr/ctxtCAUFVD-AUFNR").Text =
"8762449"
    .FindById("wnd[0]/usr/ctxtCAUFVD-AUFNR").CaretPosition
= 7
.FindById("wnd[0]/tbar[1]/btn[8]").Press
.FindById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1107/tabsTS_1100/tabpKOAU/ssubSUB_AUFTRAG:SAPLICO1:1100/tabsTABSTRIP/tabpTS05/ssubVALUES:SAPLICO1:1105/cntlPMCO_SUM_TREE/shellcont/shell/shellcont[1]/shell").HierarchyHeaderWidth
= 162
.FindById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1107/tabsTS_1100/tabpKOAU/ssubSUB_AUFTRAG:SAPLICO1:1100/btnPUSH1").Press
    .FindById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").SelectedRows
= "0"
.FindById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").DoubleClickCurrentCell
.FindById("wnd[0]/tbar[0]/btn[3]").Press
.FindById("wnd[1]/usr/btnSPOP-OPTION1").Press
.FindById("wnd[0]/tbar[0]/btn[3]").Press
.FindById("wnd[0]/tbar[0]/btn[3]").Press
.FindById("wnd[0]/tbar[0]/btn[3]").Press
    'etc
End With
     MsgBox
"After clicking OK, this SAP session is terminated."
Application.DisplayAlerts = True
     Set Session =
Nothing
    Set Connection =
Nothing
    Set SAPguiAPP =
Nothing
End Sub

Similar Messages

  • Problem with SAP logon 720 for printng with Citrix.

    Hi,
    I have a problem with sap logon 720 when printing for Citrix, one time print and other time don't print....
    I try to start SAPLPD for prompt comand... it's start but don't print....
    i'm write here for look if other people have this problem... I dont know what I can do.....
    Thank you very much....

    Hi Itmar,
    I was having the similar issue on my Windows Server 2003 Terminal Server. At times SAP prints stop working. Then i changed Printer Type to "G" and it had solved the problem. It skips the use of SAPLPD service and calling windows printing service directly.
    Just try with that.
    Regards,
    Gaurav

  • Problem with SAP Logon

    Hi alls,
    I hope can some help me, I'm trying to connect to SAP via SAPLogon.
    I've tried to fix the problem but I don’t have success.
    SAP Logon Properties:
    Description:  NSP
    Application Server: localhost
    SAProuter-String: blank
    System-ID:        NSP
    System Number:     00
    Here is the error message.
    Runtime Errors         DBIF_RSQL_INVALID_REQUEST       
    Date and Time          2007-01-22 19:14:39                                                                               
    Short text                                            
         Invalid request.                                                                               
    What happened?                                        
         The current ABAP/4 program terminated due to      
         an internal error in the database interface.      
    Trigger Location of Runtime Error                       
        Program         SAPMSYST    
        Include         SAPMSYST    
        Row             2,556       
        Module type     (FORM)      
        Module Name     FILL_INFO_TAB
    SAP-GUI installation:
    Release:      640 Final Release
    Dateiversion: 640.5.18.1016
    Build:        815416
    Patch-Level:  18
    Can you help me ?
    Thanks a lot in advance ..¡
    Ralph Hübner

    Hi,
      Try to check you DB server installation. It seems to be some issue with your Database server.
    With Regards,
    Rajesh V.

  • Problem with sap logon/bex

    Hello Peoples,
    I have a machine is the same with Windows Vista Home Premium, sap logon 7.10 - patch 11
    Access to the SAP system is perfect, but when I try to open the Bex query designer after informing username and password I get the error of communication rfc.
    Can you please tell me know how can I fix this error? or if Bex is compatible with Vista Home Premium?
    Regards...

    Hi,
    Yes,BEx is compatible with Vista Home Premium Edition.
    You will get an RFC Communication Error,if the backend system is down or if you enter the language as blank(sometimes) in the SAP Logon.
    Try opening other tools like WAD,RD and Analyzer and connect with backend and check whether it works or not.Try opening QD from WAD or Analyzer
    This is not tool specific anyway.
    Rgds,
    Murali

  • Problems with SAP Logon ticket

    Hi.
    I am trying to send SAP Logon ticket from ECC 6.0  to the backend legacy using Soap adapter in receiver side. I get the following error in SXMB_MONI, so it looks like AF is not accepting the ticket. Can anybody tell me please, how I can identify that the ticket has been received in PI's side?
    <Trace level="1" type="T">Principal Propagation connection attributes</Trace>
      <Trace level="1" type="T">Host = hostname</Trace>
      <Trace level="1" type="T">Port = 12345</Trace>
      <Trace level="1" type="T">Transport protocol = HTTP</Trace>
      <Trace level="1" type="T">Transport protocol vers = 1.0</Trace>
      <Trace level="1" type="T">Message protocol = 003000</Trace>
      <Trace level="1" type="T">Path = /MessagingSystem/receive/AFW/XI</Trace>
      <Trace level="1" type="T">Security: Logon Ticket</Trace>
      <Trace level="1" type="System_Error">Error while sending by HTTP (error code: 403, error text: Forbidden)</Trace>
      </Trace>
    Thanks, Jukka

    Hi.
    I have had some progress. Actually Principal Propagation works well now, thanks to instructions in http://help.sap.com/saphelp_nwpi711/helpdata/en/48/a9bbb97e28674be10000000a421937/frameset.htm
    But I think I have now found out that the principal progation might not be a direct answer to my problem. In the end of the day I should be able to deliver UsernameToken in my soap message header. Something like this:
    <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      |          <wsu:Timestamp wsu:Id="Timestamp-12134742" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      |             <wsu:Created>2007-10-14T12:45:34.656Z</wsu:Created>
      |             <wsu:Expires>2007-10-14T12:46:34.656Z</wsu:Expires>
      |          </wsu:Timestamp>
      |          <wsse:UsernameToken wsu:Id="UsernameToken-33259721" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      |             <wsse:Username>test</wsse:Username>
      |             <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">test</wsse:Password>
      |          </wsse:UsernameToken>
      |       </wsse:Security>
    I just have not found any documentation which I could utilize in Abap Proxy - PI 7.1 - Soap Receiver scenario. Just wondering should I create my own customized soap envelope and disable the Pi envelope in SOAP communication channel...
    Do you know if there's any "standard way" to configure this kind of configuration?
    Br. Jukka

  • Problem in SAP Logon

    Hi,
    I am Sikander (J2EE Developer). Currently i am working on SAP ABAP. For this purpose i have downloaded SAP Netweaver 2004 Sneak Preview and SAP GUI. These products are installed sucessfully but i am having problem with SAP logon.
    My Computer Name is shahbaz. My System Configurations are :
    Description: NSPSIK
    Application Server: shahbaz
    System ID: NSP
    System Number: 00
    I am having "partner not reached- connection error" message dialog. Please help me in this regard, i am stuck in this.
    Thanks in advance,
    Malik Sikander Khan

    Hi Sikandher,
    step 1:- Check network a) Try to ping your SAP server
    sep 2 :- Check ini files and hosts file
    copy hosts.txt,saplogon.ini,sapmsg from the working gui system to gui  prob system.
      Location of file
      hosts.txt : c:\windows\system32\drivers\etc
      saplogon.ini:c:\windows
      sapmsg: c:\windows
    note:-  before copying the above file , please close all the application on users machine.
    check the database path vaue from the registry
    Hkey_local_machine/system/services/current/controlset/tcpip/parameter
    make sure database path value is      c:\windows\system32\etc

  • SSO with SAP logon tickets to non-SAP web app

    I am trying to implement SSO to an oracle portal based web application using SAP logon tickets, but can't seem to find a way for it to work.  I thought maybe it would be a web server filter, but am unsure if this would work for oracle portal.  Anyone tried similar?
    Cindy

    Hi Cindy,
    If it is EP6 SP2 probably you can checkout the following document.
    http://service.sap.com/ep60
    Go to Documentation Help>How-To-Guides>Current How To Guides section.
    checkout the following how to guide.
    Perform Cross Domain SSO with SAP Logon tickets zip file.
    If you want the zip file please send an e-mail to
    [email protected]
    Regards
    -Venkat Malempati

  • Can SAP GRC AC 5.3 connect without any problem with SAP R/3 4.7 Enterprise?

    hello,
    I went to the PAM in the SAP Marketplace to see if SAP GRC AC 5.3 could connect to SAP R/3 4.7 Enterprise but I can't see all the "Add-On Product Version for...", it's cut off.
    Can SAP GRC AC 5.3 connect without any problem with SAP R/3 4.7 Enterprise?
    If I can't is there any proof about it? I have to show it to a client.
    Best Regards,
    Pablo Mortera,

    Pablo,
    GRC AC 5.3 works perfectly fine with SAP's R/3 4.6c, mySAP ERP 4.7 and ECC systems. In fact we have two 4.7 Enterprise systems connected to GRC AC 5.3 system.
    You can get the details of supported SAP ERP systems under prerequisite section of Info page of GRC AC 5.3 , it can be accessed on marketplace at -
    Downloads-->Installations and Upgrades - Entry by Application Group > SAP Solutions for Governance, Risk, and Compliance>SAP GRC Access Control>SAP GRC ACCESS CONTROL>SAP GRC ACCESS CONTROL 5.3
    Just ensure to have proper BASIS and ABAP support pack level as mentioned in prerequisites.
    Regards,
    Amol

  • One more Problem with SAP query

    Hi All,
    I am having a problem with SAP query
    Execution of SAP query transaction is leading to Dump
    the dump says Field 'R01' contains no fields, syntax check on the program shows same error.
    When I tried regenerating the Query in SQ01
    " Query Specification cannot be use to generate list
    Ranked list contains only numeric fields
    Please help me

    Gianpiero Bucchieri wrote:
    > So its important to listening the following tables too: Faktura (invoice), Partner Role, Partnernumber and the requierements number. The table are EKKO EKPO AND VRKPA OR vbkd, but if I join this table the query doesn't listining any results. If I cancel this 3 or 4 table and I start the query, the listening are ok. 
    >
    I am not sure what business process you are describing here - is it some kind of third-party sales order? If so, your join is wrong.
    From VB E P, firled BANFN and BNFPO you can go to table EBAN, where in field EBELN you will find the number of the purchase order (if somebody already had an MRP+Me58 run over the PR) which will lead you to table EKKO, and EKPO.
    So what we have here (essentially is):
    VBAK -> VBAP -> VBEP -> EBAN -> EKKO -> EKPO
    But that only solves one of your problems - you still have a long way to go to get invoices, partner and partner roles into there and I am beginning to ask myself what exactly it is you want to evaluate.
    Care to explain?
    Edited by: Mylène Dorias on Apr 1, 2010 2:10 PM

  • Problem with SAP PI7.0 J2ee Engine starting

    Hi,
    Problem with SAP PI7.0 Server
    I am using AIX6.1 and p570
    J2ee engine is not starting but I am able to login to ABAP engine.
    When I am trying to long in through internet explorer it is not working.
    How to check J2ee engine started or not.
    If it is not started then how to start J2ee engine.
    If J2ee engine problem is there then how to solve the issue and where to check to solve the issue.

    Hi,
    How to check J2ee engine started or not.
    Check the url http://ipaddress:5xx00/index.html
    If this url shows you the system info page then you j2ee engine is up.
    If it is not started then how to start J2ee engine.
    Check your server0.log file.
    If J2ee engine problem is there then how to solve the issue and where to check to solve the issue.
    Check for the problems in log file and do search in sdn or in the market place you will get plenty of info read them and try to resolve the errors.
    Regards,
    Vamshi.

  • Problem with SAP Script FAX output

    Hi Friends,
    I have problem with SAP Script Fax output.
    After I issued output using the messge type, the print preview format shows me correct alignments and the right data. But when I go to List display using the menu bar functions from the print preview screen, the list is showing me the right data, but all the alignments at the main window went wrong.
    How do I rectify this problem? I need correct alignments in both form display and list display.

    Hi Sasidhar,
    Have you tried with different fax machine.
    Regards,
    Atish

  • Problem with SAP log-in using VBA with Excel Bexanalyzer add-in

    I am trying to login in to SAP using VBA code but the code fails as indicated below .
    In Function GetBEx(Optional iWb As Workbook) As Object
    GetBEx = pAddin.ExcelInterface.WorkbookBExExcelApplication(lName)
    Works properly – I get an object
    However, in the sapBEXgetConnection function it seems that the lBex.ComConnection fails.  The p_connectionObj doesn’t get assigned (p_connectionObj is Nothing)
    Function sapBEXgetConnection(Optional IWhat As Integer) As Variant
        If IWhat = 0 Then
    ' try to get BexApi Connection
            Dim lBEx As Object
            Set lBEx = GetBEx
            On Error Resume Next
            Set p_connectionObj = lBEx.ComConnection  'fails here
            If Err.Number <> 0 Then Set p_connectionObj = Nothing
            On Error GoTo 0
            If p_connectionObj Is Nothing Then If Not prepareConnection Then Exit Function
            Set sapBEXgetConnection = p_connectionObj
        End If
    End Function
    All of this code is part of the Bexanalyzer Excel Add-In
    I’m assuming that I’m missing a patch or some configuration is incorrect but, since I’m not very familiar with SAP I don’t know.  Any help would be greatly appreciated.  Thank you.

    Hello Sebastien,
    Since I don't know what an SSO automatic connection is I can't give you an answer.  Can you explain it?
    Here's what I'm trying to achieve: on demand I'd like to execute VBA code that will use Bexanalyzer.xla functions to log in and then refresh a query that exists in the Excel workbook. Ultimately I'll want to apply parameters / variables to the query when it is refreshed.  I may then automatically execute VBA code to manipulate the resulting data in the workbook.  Basically I want to be able to do all of this without any user input.
    Paul

  • Problem with SNC logon to Analyzer

    Hi friends
    We configure SNC for BW system logon. It works fine for GUI. But when we use Analyzer the problem occurs:
    Missing SNC_LIB=IN CONNECT_PARAM IN RfcOpenEx
    Why this happen?
    we have done the checking:
    existence of Kerberos dll in /windows/system32
    active directory settings for a SAPServiceSID user
    advance setting in saplogon
    It looks fine. Do we miss sth? Maybe there's some configuration for Analyzer? Thank you very much.

    We were attempting standard publishing configuration but it would not work until SNC was installed. Once installed the publishing worked. But that's when the authentication issues started.
    We can login to infoview with SAP credientials no problem. But with the SNC turned on in BOBJ, its as if that first login means nothing. If you attempt to execute a report it shows cached paramaters and is apparently not authenticating against our SAP backend system. When you turn the SNC off via the CMC in BOBJ, the reports execute correctly authenticating against SAP backend.
    With SNC on, if you try to execute a report, nothing happens. As mentioned above, it's as if it's not communicating with the backend data source.  With SNC off, all works well but we just can't do the publishing/bursting.
    Thanks again,
    Sage

  • Backend Connection with SAP Logon

    Hi all,
    Here's my problem.
    I've got System in my Portal (7) for accesing a R/3 backend. I've made an iview and works fine. I access with Win Gui to the backend.
    The only problem is that I have to type "user" and "password" in a Portal pop-up window for accesing R/3.
    I need to do this login in R/3's SAP Logon page and I don't know how to solve.
    Any ideas?
    Thanks a lot,
    Alberto.

    You can map the user in the Portal...
    - Create System Object with R3 details
         - define the connector details
         - go to user management to define the user mapping.
    - Create an alias
    - Login to Portal.  Go User Management and check for user mapping.  Select the alias defined and define the mapping.
    Now refresh the iView.  It shouldn't ask for password.

  • SSO using Kerberos with SAP Logon Tickets

    Hi,
    I am creating a Repository Manager for the Portal Knowledge Management System and I want to use SSO to a backend IIS application and I have a few questions here. 
    I have a three tiered architecture. 
    A.  The presentation tier (SAP Portal which has my Repository Manager implementation)
    B.  ASP.NET web service data layer.
    C.  Backend document management system which runs on IIS. 
    I have installed the ISAPI filter on my ASP.NET application server and have enabled this HOST account for delegation in MSAD 2003.   Server B will use Kerberos constrained delegation to access Server C, which is an IIS backend server. 
    My question is how do I pass an SAP Logon Ticket to an ASP.NET web service request from my Repository Manager implementation?  Basically how do I just make an HTTP request to an ASP.NET application from some portal iView or WebDynPro code and pass along the SAP Logon Ticket in the request so it can be interpreted by the ISAPI filter on the IIS server.  Does anyone have any sample code or an application here that does this?
    Thanks,
    Scott

    Hi Scott
    Did you managed to find out anything regarding how to pass SAP Logon ticket to ASP.NET Webservice. Can you share it with me?
    regards
    ram

Maybe you are looking for

  • Why is the LookUp object in the Flow Task of my SSIS package going red (and not working) ? Sql Server 2008 R2

    I have been working with the Sql Server 2008 R2 SSIS Tutorial at https://msdn.microsoft.com/en-us/library/ms170419(v=sql.105).aspx --specifically -- Lesson 1.  I have been having some problems with this lesson where the source data from the samples d

  • Source List Validity Start Date

    I have noticed that, if the source list validity start date and contract validity start date are same then, the contract price is not considered while creating PO and receive error message as "Source not included in list despite source list requireme

  • I did some upgrades to my computer and now itunes won't recognize or sync to my ipod

    I did some upgrades to my computer and now itunes won't recognize or sync my ipod.

  • PLAY ALL - simple? Or no?

    Simple SD dvd, 3 tracks, one = 79 min, 1 = 3 min, 1 = 4 min...client also wants a PLAY ALL button. It's about 4.4 GB now. How do I make a PLAY ALL option without causing problems for the end jump on the tracks? How to make a PLAY ALL button/option? T

  • CBO + View

    Hi all. So, I get many servers with Oracle 9208 + SLES 9.4 I have view : CREATE OR REPLACE FORCE VIEW SA.V_FULL_DSPEC (ID, DOCUMENT_ID, DEPTFR_ID, DEPTTO_ID, ARTICLE_ID, INCLUDE_ID, QTY, SALE_PRICE, BOSS_PRICE, PRICE, ORDER_NUM, QTY_REAL, PRICE_TYPE,