Results 1 to 4 of 4

Thread: [RESOLVED] [Excel] - Run-time error '1001': Sap Remote Function Call

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    9

    Resolved [RESOLVED] [Excel] - Run-time error '1001': Sap Remote Function Call

    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: 1389
Size:  14.8 KB

    My VBA References are as follows:
    Name:  vba_ref.jpg
Views: 1485
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

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: [Excel] - Run-time error '1001': Sap Remote Function Call

    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    9

    Re: [Excel] - Run-time error '1001': Sap Remote Function Call

    Quote Originally Posted by Zvoni View Post
    Hi Zvoni,

    as I can see, in that problem the function module doesn't exist in SAP system. In my case, the function exists, it was created by me

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    9

    Re: [Excel] - Run-time error '1001': Sap Remote Function Call

    It is working...I did nothing to the code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width