VB SCript Not recognizing the open SAP session

Friends really need help here
this is the code i have
Sub StartTransaction(SapGuiAuto, Connection, session)
' Dim SapGuiAuto As Object
Dim i As Long
i = 1
' There may be bad entries in the ROT from previous crashes
While i < 10 And SapGuiAuto Is Nothing
   i = i + 1
   On Error Resume Next
   Set SapGuiAuto = GetObject("SAPGUI")
   On Error GoTo 0
Wend
If SapGuiAuto Is Nothing Then
   MsgBox "Could not connect to SAPlogon process. Did you start it?", vbOKOnly Or vbCritical
   End
End If
On Error Resume Next
Set SAPApplication = SapGuiAuto.GetScriptingEngine
Set SapGuiAuto = Nothing
On Error GoTo 0
If SAPApplication Is Nothing Then
   MsgBox "Could not access GuiApplication. Maybe Scripting is disabled?", vbOKOnly Or vbCritical
   End
End If
Set Connection = SAPApplication.Children(0)
Set session = Connection.Children(0)
End Sub
Even though i have multiple sap sessions open, it fails at
Set session = Connection.Children(0)
Any help is appreciated

Hello.
Below code list all available SAP sessions in a messagebox (EXCEL VBA). You Need to reference SAPFEWSE.OCX in VBA Editor. This can be found in your program Folder for SAPGUI.
Sub List_SAP_Sessions()
    Dim SapGuiAuto As Object
    Dim i As Integer
    Dim iSession As Long
    Dim SAP_APP As Object
    Dim Connection As SAPFEWSELib.GuiConnection
    Dim Session As SAPFEWSELib.GuiSession
    Dim strMSG As String
    Dim strSessions$
    i = 1
    ' There may be bad entries in the ROT from previous crashes
    While i < 10 And SapGuiAuto Is Nothing
       i = i + 1
       On Error Resume Next
       Set SapGuiAuto = GetObject("SAPGUI")
       On Error GoTo 0
    Wend
    If SapGuiAuto Is Nothing Then
        MsgBox "Could not connect to SAPlogon process. Did you start it?"
        Exit Sub
    End If
    On Error Resume Next
    Set SAP_APP = SapGuiAuto.GetScriptingEngine
    Set SapGuiAuto = Nothing
    On Error GoTo 0
    If SAP_APP Is Nothing Then
        MsgBox "Could not access GuiApplication. Maybe Scripting is disabled?"
        Exit Sub
    End If
    Set SapGuiAuto = Nothing
    iSession = 0
    For Each Connection In SAP_APP.Children
        If Not Connection.DisabledByServer Then
            For Each Session In Connection.Children
                If Session.Busy = False Then
                    iSession = iSession + 1
                    strMSG = strMSG & (Session.Info.SystemName & " (" & CStr(Session.Info.SessionNumber) & ") (" & Session.Info.Client & ") | User: " & Session.Info.User & " | Transaction: " & Session.Info.Transaction & " | Session ID: " & Session.ID) & vbCrLf & vbCrLf
                End If
            Next
        End If
    Next
strMSG = strMSG & vbCrLf & "Sessions counted: " & iSession
MsgBox strMSG, vbInformation + vbOKOnly, "Information"
End Sub
You can use a similar code to connect to a specific session by using Sesssion.ID. I have written an function for my EXCEL VBA template for this requirement:
Public Function objSession(strSessionID As String) As Object
    Dim SapGuiAuto As Object
    Dim SAP_APP As Object
    Dim i As Integer
    Dim bConnect As Boolean
    Dim Connection As SAPFEWSELib.GuiConnection
    Dim Session As SAPFEWSELib.GuiSession
    Set objSession = Nothing
    i = 1
    ' There may be bad entries in the ROT from previous crashes
    While i < 10 And SapGuiAuto Is Nothing
       i = i + 1
       On Error Resume Next
       Set SapGuiAuto = GetObject("SAPGUI")
       On Error GoTo 0
    Wend
    If SapGuiAuto Is Nothing Then
        MsgBox "Please start SAPlogon"
        Exit Function
    End If
    On Error Resume Next
    Set SAP_APP = SapGuiAuto.GetScriptingEngine
    Set SapGuiAuto = Nothing
    On Error GoTo 0
    If SAP_APP Is Nothing Then
        MsgBox "Scripting disabled"
        Exit Function
    End If
    Set SapGuiAuto = Nothing
    For Each Connection In SAP_APP.Children
       If Not Connection.DisabledByServer Then
          For Each Session In Connection.Children
            If Session.Busy = False Then
             If Session.ID = strSessionID Then
                Set objSession = Session
                locSessionHandle = Session.FindById("wnd[0]").Handle
                bConnect = True
                Exit For
             End If
            End If
          Next
       End If
      If bConnect = True Then Exit For
    Next
End Function
Hope this Support you to find root cause for your issue.
Best regards,
Holger

Similar Messages

  • I have Photoshop CS5.1 (bought in 2011). The photoshop Camera Raw plug-in is not recognizing the format of my new Nikon D610. I updated the version of my Camera Raw plug in and am still getting this message when trying to open images in photoshop. Please

    I have Photoshop CS5.1 (bought in 2011). The photoshop Camera Raw plug-in is not recognizing the format of my new Nikon D610. I updated the version of my Camera Raw plug in and am still getting this message when trying to open images in photoshop. Please help.

    This link shows that ACR 8.3 supports the Nikon D610 and 6.7.1 was the final version for CS5.
    Camera Raw plug-in | Supported cameras
    So you can upgrade to CS6 and ACR 8.7.1
    or using the DNG converter, convert your Nikon raw files to dng format to open in CS5.
    Here is the download link: Adobe - Adobe Camera Raw and DNG Converter : For Macintosh : Adobe DNG Converter 8.7.1
    or Windows: Adobe - Adobe Camera Raw and DNG Converter : For Windows : Adobe DNG Converter 8.7.1
    And here is a great video tutorial on how to use the converter.
    https://www.youtube.com/watch?v=0bqGovpuihw
    Gene

  • I am not able to open illustrator file as it is not recognizing the plugin

    I am not able to open illustrator file as it is not recognizing the plugin.
    Every time i try to open the illustrator file it shows up a alert message that the file can't be opened as it doesn't recognize the plugin.
    how can I open that kind of file ?

    Hi Larry,
    I tried opening it with Acrobat. It opened smoothly but somehow I am not able to open on Illustrator as this is the error I am facing
    Please help !

  • My computer is not recognizing the e drive. it won't read the disc or open the drive.

    My computer is not recognizing the E drive. It won't read a CD and it the drive will not open so I can remove the disc. The E drive is not showing up under My Computer
    HP Pavillion dv6000   Windows 7 64-bit

    When did it started? is it showing under device manager?
    you can try system restore first and go back to the date when your notebook is still working fine...
    or you can try this...
    hope this helps...
    ~reikableu~
    ...KUDO's to me and if this resolves the issue, please tag this as "AcceptedSolution"
    ~I MAYBE working for HP Consumer Notebook Support but any opinion stated are not at anyways connected to those of HP.~

  • Account Information Not Recognized: The user account has been disabled.(FW

    Hi Expert ,
    I'm working with SAP Business Objects 4.0 SP2 patch 5 and SAP Enterpriseportal. I want to use Single Sign On with trusted authentication in enterprise portal. EP administrator has created an infoview in order to be able to connect the portal and BO.
    I have configured trusted authentication in BO but when I try to use the infoview from the portal the following error appear:
    "Account Information Not Recognized: The user account has been disabled.(FWB 00012) "
    the user used in the sap portal is also defined and active in sap BO.
    In order to activate SSO in BO I executed the following steps:
    1. Log onto the CMC.
    2. Went to the Authentication management area.
    3. Select the Enterprise option. The "Enterprise" dialog box opens.
    4. Scroll down until I see "Trusted Authentication".
    4.a. Click Trusted Authentication is enabled.
    4.b. Click New Shared Secret.
    4.c. Click Download Shared Secret.
    5. Selected Update to commit the shared secret.
    6. Saved the trustedprincipal.conf file in the boe server in the path:
    'D:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects
    Enterprise XI 4.0\win32_x86'
    7. Modified the file 'D:\Program Files (x86)\SAP
    BusinessObjects\Tomcat6\webapps\BOE\WEB-INF\config\default\global.properties'
    sso.enabled=true
    sso.sap.primary=false
    trusted.auth.shared.secret=
    trusted.auth.user.param=
    trusted.auth.user.retrieval=REMOTE_USER
    8.Restart Tomcat
    Please could anyone help me to resolve the issue?
    Thanks in advance for collaboration.
    regards
    gio'

    Hi Giovanni,
    The configuration you have wonu2019t work. You have two different web application servers: Netweaver and Tomcat. Your user credentials are only established in one of them: Netweaver. When you configure trusted authentication in Tomcat you have to authenticate the user in this Web Application server. The REMOTE_USER canu2019t pass from one server to another.
    You can confirm this capturing your request using Fiddler in your browser.
    If you want to configure the integration BI4 into SAP Enterprise portal, you can follow this guide:
    http://wiki.sdn.sap.com/wiki/display/BOBJ/BI4IntegrationintotheSAPEntreprisePortal+7.0.x
    Regards,
    Julian

  • No luck importing from SonyHandycam DCR-DVD650?  I am using USB import to my MacBook that is running OSX 10.6.8. The MacBook is not recognizing the camera.  Any ideas what the issue could be?

    I am not having any success in importing my videos from Sony Handycam DCR-DVD 650 to my mac book.  I am using the USB connection.  The macbook is not recognizing the camera.  The macbook is running OSX 10.6.8.  Any ideas on what the problem could be?

    http://support.apple.com/kb/HT2361 There's a recommendation that when using this camera to record in the 'Standard' format instead of VR format. So if you know what the setting was you used to record the disk that's a starting point.
    According to this website the camera should be compatible with iMovie '11
    http://help.apple.com/imovie/cameras/en/index.html?lang=en_US
    So here's some steps to take to get the Mac to recognize your camera.
    1. Try it more than a few times, sometimes it can take 2-4 attempts to get iMovie to recognize a camera for the first time.
    2. Always get the power adapter for your camera out of the bag. Hook it to the wall outlet, then plug your camera into that. Don't run it off the battery.
    3. With the camera plugged into the wall, in DV playback mode. Hit play and just let it play video out continuously, then reboot the Mac. As soon as you see the desktop, launch iMovie. Go to File Menu > Import from Camera and see if the Capture window opens with your video playing through.
    4. Make sure iPhoto doesn't try to launch itself automatically when it detects your camera has been connected to the Mac. Sometimes it tries to steal the videos off of a camera and 'blocks' iMovie from seeing the camera when it's attached. So make sure iPhoto hasn't interecepted your camera and is not running at all when you launch iMovie
    No guarantees, but some things to try

  • USB is not recognizing the device and giving error 10

    My PC USB is not recognizing the device (iphone) and giving error 10.. The USb is malfunctioning but ipod is getting connected easliy

    Try DFU Mode Restore. Open iTunes on computer. Connect iPhone to computer with USB cable. Hold both Home and Power button, after exactly 10 seconds release the Power Button, keep holding the Home button until iTunes recognizes iPhone in Recovery Mode, usually about 20 seconds time. If the iPhone screen is black, blank this is DFU Mode. Click the Restore button of iTunes.

  • My Toshiba Satellite p775-s7320 not recognizing the CD/DVD player (ODD)

    Hello all,
    I am having the problem as listed in the title in that my toshiba satellite p775-s7320 is not recognizing the built-in CD/DVD player anymore. I have the latest Bios upgrade from Toshiba. The last time this worked was earlier this year during the summer. Nothing abnormal or apparent has happened to the laptop to change anything internally, except the Bios upgrades.
    Interestingly enough, there is power to the CD/DVD mechanism and the open/close features work perfectly, but the Bios can't "see" the ODD. So because the Bios doesn't see it as being attached, and the System doesn't "see" because the Bios doesn't, it doesn't matter that the Open/Close function works, because putting a good CD in with data on it is of no value.
    I was considering trying to revert the Bios to an earlier one, but simply trying to load the older Bios through the Windows Bios software is a No-Go because the software won't allow me to go to an earlier Bios flash.
    I'm at the end of the line with common options, other than trying to switch out the Cd/DVD for a brand new one. Something I don't want to do if I can avoid it, but I would as a last resort. As well, loading a fresh image is out of the question as I have too much accumulated software on my harddrive and don't really think the problems stims from that.
    Otherwise, any other solutions may be worthwhile to try. I would really like to flash the Bios to an earlier time when the machine worked well, but I dont know how.
    Thanks for taking a look. BTW, I have removed and replaced the current CD/DVD several times with no change in recognition by the Bios.
    houdinihar

    any other solutions may be worthwhile to try
    Try the Microsoft fix-it : http://support.microsoft.com/mats/cd_dvd_drive_problems It is used to fix problems with CD or DVD drives. (Note This Fix it solution does not support Windows 8.1.) 
    For more things to try see this Microsoft support page:  http://support.microsoft.com/kb/314060/en-us  It gives possible reasons for your problem and several methods to fix the issue.
    Your support page is here :  http://support.toshiba.com/support/modelHome?freeText=3132880
    S70-ABT2N22 Windows 7 Pro & 8.1Pro, C55-A5180 Windows 8.1****Click on White “Kudos” STAR to say thanks!****

  • HttpsURLConnection is not recognizing the ssl.proxyHost properties

    Hello All,
    We have a requirement to do https post outside our network. I'm trying to tunnel through a proxy by setting system properties.
    System.setProperty("ssl.proxyHost",myProxy );
    System.setProperty("ssl.proxyPort",80 );
    but some how weblogic.net.http.HttpsURLConnect is not recognizing the above settings and trying to post data directly.
    we are currently on weblogic 8.1 sp1. Could some one please help me on this.
    Thanks
    pn

    I also has this kind of problem setting a proxy :
    1/- Try setting the properties in your start up script :
    JAVA_OPTIONS="-Dssl.proxyHost=proxy -D....
    2/- Try an upgrade to WLS8.1 SP3
    Alexandre

  • Folder appears in Windows Explorer, but not in the Open File dialog

    Hello,
    I hope this is the right place to post this. If not, please let me know where is.
    A friend just showed me a weird problem he is having with his computer. He is using Windows 7 pro, and has a folder under My Documents, in which he keeps his work files. He emails these files using Gmail, which he accesses via Internet Explorer.
    All worked fine until a few days ago, when he noticed that when he clicked the link in Gmail to attach a file, his folder wasn't listed in the Open File dialog. He looked in Windows Explorer, and could see the folder OK. I tried opening Word and using the Open
    File dialog there, and the folder wasn't visible.
    If he clicks in the address bar, and adds the folder name to the path, it opens the folder, but shows it as empty. I actually has two subfolders. If he adds the name of a subfolder, then the Open File dialog shows the files in that folder.
    I checked the permissions on the folder, and couldn't see anything odd. What I don't understand is how the folder can be visible in Windows Explorer, and not in the Open File dialog.
    Anyone any ideas? Thanks
    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers.
    Download from the Visual Studio Gallery.
    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at
    http://dotnetwhatnot.pixata.co.uk/

    I can confirm - I'm having the exact same problem.
    When I try to lookup or save a file from an IE file dialog some folders do not show up. I can type the folder name into the directory field and it then goes there, but this assumes you know the directory name and it's a PITB.
    Firefox can browse to the directory directly.
    It would be interesting if anyone else found a fix for this - I'll post here again if I find out more somewhere else, but there are not too many threads out there as far as I have found for now.
    Found a solution over at answers at Microsoft dot com. (can post links here yet - will update once I can)
    In short: There's a fast fix for this issue by resetting a hidden flag that IE sets for some folders. I believe this part of the "protected mode" feature, though I can't confirm and also have no idea how this would protect me from any intruders,
    if only (unimportant) subfolders are protected ...
    Anyway - if you know the name of the missing folder (e.g. from browsing the directories form windows explorer): in the parent directory that has the folder missing do a Search (in box at top right) for the missing
    folder name. In my case the hidden folder shows up in the search - now right click -> Properties -> clear hidden flag. Note: this "hidden" flag is independent of the flags set in windows explorer - that's why you have trouble going there with IE and not
    the file explorer from the desktop.

  • エラー Could not complete the Open command because there is not enough memory(RAM).

    Windows 版 Adobe Photoshop CS6 13.0.1(32 ビット)を使用して JPEG 2000 ファイルを開くと、エラー “Could not complete the Open command because there is not enough memory(RAM)”を発生しました。
    詳しい情報:
    http://helpx.adobe.com/jp/photoshop/kb/cq04220115.html
    上記の文書を参考にしてください。

    リンク先に下記のように書かれています。
    追加情報 (Additional Information)
    Photoshop CS6 に付属の JPEG 2000 プラグインに問題があることが確認されています。開発チームは現在、問題の修正に取り組んでいます。
    修正の取り組みはいつまでかかるのでしょうか?
    Photoshop CS5 に付属の JPEG 2000 プラグイン を入れれば直るなら、
    Photoshop CS5 に付属の JPEG 2000 プラグイン配布するのは無理なんでしょうか?

  • Trying to move my iTunes Music and other media from the main drive on my pc to an external hard drive but iTunes is not recognizing the new file location?  Ideas?

    Trying to move my iTunes Music and other media from the main drive on my pc to an external hard drive but iTunes is not recognizing the new file location?  Ideas?

    Hello there, Underwriter.
    The following Knowledge Base article provides in-depth instructions on how to migrate your content to an external drive:
    iTunes: How to move your music to a new computer
    http://support.apple.com/kb/ht4527
    Particularly of note for your situation:
    External drive
    This option requires more work than Home Sharing, but it creates a backup of your iTunes library on the external drive in addition to moving your content.
    Notes before you start:
    You can use most iPods as an external drive.
    Windows operating systems don't recognize Mac OS-formatted disks (HFS or HFS Plus formats). Because of this, you can't use a Mac-formatted iPod or external drive to move your music to a Windows PC. See iPod: How to determine iPod's hard disk format if you're not sure how your iPod is formatted.
    Mac OS X can read Windows-formatted iPods and drives. This means there are many ways to migrate your information from your old Windows-based PC to your new Mac.
    Mac OS X: To be sure external drives appear on your desktop, choose Preferences from the Finder menu. Be sure the options for "External disks" and "Hard disks" are enabled.
    Part 1: Locating and consolidating the iTunes Media folder
    Part 2: Copy iTunes folder from the old computer:
    Part 3: Get iTunes ready on your new computer
    Part 4: Back up any music that's already on your new computer
    Part 5: Copy music to your new computer
    Part 6: Add preexisting music that was on the new computer back into the library
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Payment run  - should not clear the open item but should post payment doc

    Hi Gurus,
    Can you please help me , on how to acheive like when payment run F110 post the payment doc it should not close the open item rather keep that open item as open item , but hsould be be paid by payment doc posted through payment run F110.
    Have any one of you had similar requirement ..? FICO gurus help me to acheiev this .. any exit /BADI ..or ideas..
    Appreciate your help in advance

    HI ,
    Thanks for your reply , but still I am not clear on that.
    reason they want to keep this open to be kept as open item , so that item will be picked up by dunning run ..
    Basically  the open invoice is being cleared by payment doc which was generated by payment run. If we look at BSEG in the open item record BSEG-AUGBL = will have the clearing doc number , and in addition to that BSEG will have created another record for the clearing doc as well .
    May be since open invoice record is being updated with clearing doc (AUGBL ) , I belive its not shown up as open item .
    Somehow this item should be kept as open item ... that is the req and also paid item payment reference should be transfered to Bill of exchange as well.
    Hope you have clear background of my req...
    Tnanks in advance ,

  • Pages for iPad is not recognizing the password I assigned to a document.  I included a hint, and I know I am entering the password that goes with the hint.  Is there anything I can do to access my doc?

    Pages for iPad is not recognizing the password I assigned to a document.  I included a hint, and I know I am entering the password associated with the hint.  Is there anything I can do to access my document?  i quite the Pages app and restarted it.  Now I guess I'll reset the iPad and see if that helps.   Thanks!

    Rhonda Fogel wrote:
    Interesting that one does not need the password to delete using Finder.
    The Pages password protects the contents of the document.  If there were a Finder password, it would protect what you might think of as the "file wrapper" ... the stuff around the file content.
    Glad it's not vital.  I have to say I only pasword protect those Pages documents that are, in fact, vital.
    Best of luck.

  • I downloaded an app to a computer that is synced to my iphone. So I copied the app to my ipad synced computer, but it does not recognized the app. How can I get the app onto my ipad library?

    I downloaded an app to a computer that is synced to my iphone. So I copied the app to my ipad synced computer, but it does not recognized the app. How can I get the app onto my ipad library?

    Store>Check for Available Downloads

Maybe you are looking for