Hello community,
I'm try to use the the ACTIVEX "wdtfuncs.ocx" with Python 3, but when i call the FM RFC_READ_TABLE, the syntax checker show me an error message. Below the code:
from win32com.client import *
LogonControl = Dispatch("SAP.LogonControl.1") Y_objConnection = LogonControl.NewConnection
Y_objConnection.Client = X_MANDANTE
Y_objConnection.ApplicationServer = X_APPLICATION_SERVER Y_objConnection.User = X_USER
Y_objConnection.Password = X_PASSWORD
Y_objConnection.SystemNumber = X_NUMERO_ISTANZA
Y_objConnection.UseSAPLogonIni = False SilentLogon = True Y_errore_connessione = "" if not Y_objConnection.Logon(0, SilentLogon): Y_errore_connessione = "KO" else: Y_errore_connessione = "OK"
Functions = Dispatch("SAP.Functions") Functions.Connection = objConnection objRfcFunc = Functions.Add("RFC_READ_TABLE") objRfcFunc.Exports("QUERY_TABLE").Value = "QPCD" objRfcFunc.Exports("ROWCOUNT").Value = "99999" objRfcFunc.Exports("DELIMITER").Value = ";" objRfcFunc.Tables("OPTIONS").FreeTable() objRfcFunc.Tables("OPTIONS").Rows.add objRfcFunc.Tables("OPTIONS")(objRfcFunc.Tables("OPTIONS").RowCount,"TEXT") = "CODE = 'ZPROVA' " objRfcFunc.Tables("FIELDS").FreeTable() objRfcFunc.Tables("FIELDS").Rows.Add objRfcFunc.Tables("FIELDS")(objRfcFunc.Tables("FIELDS").RowCount,"FIELDNAME") = "CODE"
if objRfcFunc.Call == False: pass
width_Mymatrix = 1 rowindex = 0 output_Matrix = {} for objDatRec in objRfcFunc.Tables("DATA").Rows(): for columindex in range(width_Mymatrix): output_Matrix[rowindex,columindex] = str(objDatRec("WA")).strip().split(";")[columindex] print(output_Matrix[rowindex,columindex]) rowindex += 1
the syntax checker returns me an error on statement :
objRfcFunc.Tables("OPTIONS")(objRfcFunc.Tables("OPTIONS").RowCount,"TEXT") = "CODE = 'ZPROVA' "
The message of error is "can't assign to function call".
I can not understand what the correct syntax to use is.
Please, help me