Skip to Content
1

Inconsistent script SAP Connection attributes when using Logon Pad

Nov 05, 2017 at 10:15 PM

74

avatar image

Hi all,

I have a code snippet that works as I expect to loop over the active sap connections & makes a match based on the description & client to attach to a specified SAP system.

'start looping at systems to connect to the correct session
        For il = 0 To SAPApp.Children.Count - 1
            If W_Sess = False Then
            Set SAPConn = SAPApp.Children(il + 0)
                If SAPConn.Description = System Then
                    For it = 0 To SAPConn.Children.Count - 1
                        Set session = SAPConn.Children(it + 0)
                        If session.Parent.Description = System And session.Info.Client = clientID Then
                            W_Sess = True
                            Exit For
                        End If
                    Next
                End If
            End If
        Next

the Issue I am having is, when providing the script for others to use, some users experience different behaviour when scanning for the relevant SAP connection.

Some users were finding that even though they are logged on & connected to the expected SAP system, the script was not detecting this & was forcing them to logon.

I'd managed to replicate the inconsistency as follows:

When opening the SAP connection by selecting the system from the Favourites list in explorer view on the logon pad, the SAPConn.Description = System test can be performed, as SAPConn.Description is populated with a string matching the description from the SAPUILandscape.xml file

When opening the SAP connection by selecting the system from the Connections list in Explorer view on the logon pad, the SAPConn.Description = System test cannot be performed, as SAPConn.Description is not populated with a string matching the description from the SAPUILandscape.xml file

Does anyone have any suggestions on the cause for this inconsistency? or a globally successful method to detect the expected session which is better than mine?

regards

Daniel

logongood.png (45.8 kB)
logonbad.png (45.4 kB)
10 |10000 characters needed characters left characters exceeded

I'm realising the environment I am working in is also acting oddly when trying to raise a new connection after failing to find the existing connection.

SAPConn = SAPApp.OpenConnection(System) is raising an error advising it can't locate the system.

The funny thing is the error message is reporting the expected connection string as not being located i.e. it does exist in the SAPUILandscape.xml.

edit1:

Set SAPConn = SAPApp.OpenConnectionByConnectionString("/H/SAPCOnnectionStringHere/S/32nn") works! Although it still doesn't populate the Description Property.

1

Hello Daniel,

a very interesting phenomenon. I try it on my system but your code works in any case as expected and the description property delivers the correct value.

If you have any reasons or solutions for that problem, let us know.

Thanks and best regards
Stefan

0

I'm investigating if its related to the patch level. Currently testing on 7.40 Patch level 2 & there are some notes related to System descriptions (though nothing precisely identical.) Will feedback more once I have approval to upgrade.

1
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Daniel McCollum Nov 13, 2017 at 05:26 AM
0

So I've realised session.Info.SystemName is populated as expected regardless. So pending any SAP Gui patching, I've found my fix. Use session.Info.SystemName instead.

specifically:

'start looping at systems to connect to the correct session
        For il = 0 To SAPApp.Children.Count - 1
            If W_Sess = False Then
            Set SAPConn = SAPApp.Children(il + 0)
                If SAPConn.Description = System Then
                    For it = 0 To SAPConn.Children.Count - 1
                        Set session = SAPConn.Children(it + 0)
                        If session.Info.SystemName = System And session.Info.Client = clientID Then
                            W_Sess = True
                            Exit For
                        End If
                    Next
                ElseIf SAPConn.Description = "" Then
                    For it = 0 To SAPConn.Children.Count - 1
                        Set session = SAPConn.Children(it + 0)
                        If session.Info.SystemName = System And session.Info.Client = clientID Then
                            W_Sess = True
                            Exit For
                        End If
                    Next
                End If
            End If
        Next

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hello Daniel,

thank you very much for sharing this information.

Best regards
Stefan

1

Well, I wouldn't know anything if others hadn't shared in the past, only fair to pay it forward!

0