Sub GetUserList() ' https://www.linkedin.com/pulse/connect-sap-r3-call-custom-fm-from-ms-excel-erkan-kopuz ' https://saplsmw.com/Import_tables_directly_into_Access_from_SAP_using_RFCs ' http://sapass.metro.client.jp/Sap_Active_X/UseFunctionControl.htm ' SAP-Objekt erzeugen Set oSAP = CreateObject("SAP.Functions") oSAP.Connection.ApplicationServer = "1.1.1.1" ' IP des Appl-Servers (SM51->Details) oSAP.Connection.SystemNumber = "01" ' Systemnummer, meißt im Namen des Appl-Servers enthalten oSAP.Connection.System = "DV1" ' Entwicklungs-, Test-, Produktivsystem oSAP.Connection.Client = "100" ' Mandant oSAP.Connection.Language = "DE" ' Sprache "EN", "DE" ... oSAP.Connection.User = "USER1" ' SAP-User 'oSAP.Connection.Password = "xyz" ' SAP-Passwort oSAP.Connection.UseSAPLogonIni = False ' RFC-Login, wobei ' Logon(0, False): Logon-Fenster anzeigen ' Logon(0, True): Silent logon, Passwort muss gesetzt sein If oSAP.Connection.Logon(0, False) = True Then Dim oFuBa As Object ' FuBa TH_USER_LIST abfragen Set oFuBa = oSAP.Add("TH_USER_LIST") If oFuBa.Call = True Then ' Schnittstellenparameter "TABLES-USRLIST" Dim oUsrList As Object Set oUsrList = oFuBa.Tables("USRLIST") ' Userliste in Excel-Sheet einfügen Dim i As Integer i = 1 For Each User In oUsrList.Rows ActiveWorkbook.Sheets(1).Cells(i, 1) = User(2) ' Client ActiveWorkbook.Sheets(1).Cells(i, 2) = User(3) ' UserName ActiveWorkbook.Sheets(1).Cells(i, 3) = User(5) ' Terminal ActiveWorkbook.Sheets(1).Cells(i, 4) = User(16) ' IP i = i + 1 Next Else ' Exception? MsgBox oFuBa.Exception End If ' Logoff oSAP.Connection.Logoff Else ' Kein Login möglich MsgBox "Login fehlgeschlagen." End If End Sub
Kategorien
-
Neueste Beiträge
- [SAP] Profit Center
- [SAP Fiori] Setup Fiori My Inbox
- [SAP Fiori] Setup der Fiori Suche / Fiori search
- [ABAP] Liste aller Umgebungsvariablen
- [ABAP] Muster-Leistungsverzeichnisse lesen
- [ABAP] ABAP2XLSX: Column Autosize, Verwendung Iterator
- [ABAP] Schlüsselspalten einer DB-Tabelle ermitteln
- [ABAP] SALV-Grid: Eventhandler für Klick auf eine Zelle (link_click, hotspot)
- [ABAP] Material-Ledger: Materialpreise für unterschiedliche Währungstypen pflegen
- [SAP] Material Ledger / Materialbewertung / Materialpreise