
$Row = $ReadTableFunc.Tables("FIELDS").Rows.Add
$Row("FIELDNAME") = "BNAME"
$Row = $ReadTableFunc.Tables("FIELDS").Rows.Add
$Row("FIELDNAME") = "LANGU"
;-Begin-----------------------------------------------------------------
;-Directives----------------------------------------------------------
AutoItSetOption("MustDeclareVars", 1)
;-Sub Main------------------------------------------------------------
Func Main()
;-Variables---------------------------------------------------------
Local $SAPFunc = 0, $Connection = 0, $SAPConnection = 0
Local $ReadTableFunc = 0, $Param = 0, $Table = 0
Local $RowCount = 0, $DataLine = "", $i = 0
;-Get SAP.Functions-------------------------------------------------
$SAPFunc = ObjCreate("SAP.Functions.Unicode")
If Not IsObj($SAPFunc) Then
MsgBox(0, "Hint", "Can't create SAP.Functions.Unicode object")
Exit
EndIf
;-Get SAP.LogonControl connection-----------------------------------
$Connection = $SAPFunc.Connection
If Not IsObj($Connection) Then
MsgBox(0, "Hint", "Can't get SAP.LogonControl connection")
Exit
EndIf
;-Set connection parameters-----------------------------------------
$Connection.Client = "001"
$Connection.User = "BCUSER"
$Connection.Password = "minisap"
$Connection.Language = "EN"
$Connection.System = "NSP"
$Connection.HostName = "ABAP"
$Connection.SystemNumber = 0
;-Connect SAP system------------------------------------------------
$SAPConnection = $Connection.Logon(0, -1)
If $SAPConnection = 0 Then
MsgBox(0, "Hint", "Can't logon to the SAP system")
Exit
EndIf
;-Get ABAP function module RFC_READ_TABLE---------------------------
$ReadTableFunc = $SAPFunc.Add("RFC_READ_TABLE")
If Not IsObj($ReadTableFunc) Then
;-Logoff----------------------------------------------------------
$Connection.Logoff()
MsgBox(0, "Hint", "Can't get the function module")
Exit
EndIf
;-Define export parameters------------------------------------------
$ReadTableFunc.Exports("QUERY_TABLE").Value = "USR01"
$ReadTableFunc.Exports("DELIMITER").Value = "~"
;-Call ABAP function module RFC_READ_TABLE to read table USR01------
$ReadTableFunc.Call()
;-Show the content of the table-------------------------------------
$Table = $ReadTableFunc.Tables("DATA")
If IsObj($Table) Then
$RowCount = $Table.RowCount
For $i = 1 To $RowCount
$DataLine = $Table.Value($i, "WA")
MsgBox(0, "Data", "Length: " & StringLen($DataLine) & @CrLf & _
String($DataLine))
Next
EndIf
;-Logoff------------------------------------------------------------
$Connection.Logoff()
EndFunc
;-Main----------------------------------------------------------------
If @AutoItX64 Then
MsgBox(0, "Version", "AutoIt " & @AutoItVersion & " x64")
Else
MsgBox(0, "Version", "AutoIt " & @AutoItVersion & " x86")
EndIf
Main()
;-End-------------------------------------------------------------------
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
7 | |
6 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 |