Hello Guru's

I have an excel small application created by me that connects to SAP sytem to execute a function.

Until yesterday, it was working amazingly, but today I get that error in the thread title. I wonder if anyone can help me here.

Name:  Error_runtime.jpg
Views: 2252
Size:  14.8 KB

My VBA References are as follows:
Name:  vba_ref.jpg
Views: 2335
Size:  51.4 KB

The error triggers at the line:
Code:
vResult = Myfunc.Call
My code is as follows:

Code:
Private Sub cmdVerificarStatus_Click()

    Dim arrayGrid() As TSelItemInfo
    Dim arrayRequests() As String
    Dim connR3, Myfunc, App As Object
    Dim Result As Boolean
    Dim iSizeArray As Integer
    
    
    
    'Obter Array com localização das linhas seleccionadas
    arrayGrid = gridRequests.SelItems.GetArray
    
    iSizeArray = UBound(arrayGrid)
    ReDim arrayRequests(iSizeArray)
    
    'Percorrer as linhas seleccionadas e preencher array com nr das ordens a validar status
    For i = 1 To UBound(arrayGrid)
        arrayRequests(i) = gridRequests.CellValue(arrayGrid(i).row, 1)
    Next
    
    
    '*****************************************************
    'Definir Ligação a R3
    '*****************************************************
    Set connR3 = CreateObject("SAP.Functions")
    
    If connR3.Connection.logon(0, False) <> True Then
     Exit Sub
    End If
    
    Set Myfunc = connR3.add("ZZS_CHECK_REQUESTS_STATUS")
    
    
    '*****************************************************
    'Declarar Variaveis
    '*****************************************************
    Dim oTableInput As Object   'Tabela de entrada na Função
    Dim oTableOutput As Object  'Tabela de saida da Função
    
    Set oTableInput = Myfunc.Tables("REQUESTS")
    Set oTableOutput = Myfunc.Tables("REQUESTS_STATUS")
    
    '*****************************************************
    'Preencher tabela de input da função (REQUESTS)
    '*****************************************************
    For i = 1 To UBound(arrayGrid)
        oTableInput.Rows.add
        oTableInput.value(i, 1) = arrayRequests(i)
    Next
    
    '*****************************************************
    'Chamda do módulo de função
    '*****************************************************
    Result = Myfunc.Call
    
    '*****************************************************
    'Valida resultado e preenche grelha com informação
    '*****************************************************
    If Result = True Then
        For i = 1 To UBound(arrayGrid) 'Percorrer Células seleccionadas da grelha
         For a = 1 To oTableOutput.RowCount 'Percorrer tabela de output da função
            If gridRequests.CellValue(arrayGrid(i).row, "strOrdem") = oTableOutput(a, "TRKORR") Then
                Select Case oTableOutput(a, "TARSYSTEM")
                    Case Is = "PRD"
                        gridRequests.CellValue(arrayGrid(i).row, "strPRD") = "Sim"
                        gridRequests.CellValue(arrayGrid(i).row, "strDtImportPRD") = oTableOutput(a, "TRDATE")
                        gridRequests.CellValue(arrayGrid(i).row, "strHrImportPRD") = oTableOutput(a, "TRTIME")
                        
                    Case Is = "TST"
                        gridRequests.CellValue(arrayGrid(i).row, "strTST") = "Sim"
                        gridRequests.CellValue(arrayGrid(i).row, "strDtImportTST") = oTableOutput(a, "TRDATE")
                        gridRequests.CellValue(arrayGrid(i).row, "strHrImportTST") = oTableOutput(a, "TRTIME")
                End Select
            End If
        Next
       Next
    Else
        'ERRO
    End If
    
    '*******************************************
    'Logoff de SAP
    '*******************************************
    connR3.Connection.Logoff