cancel
Showing results for 
Search instead for 
Did you mean: 

Bug with answer file access for VBA API RunPackage

former_member186338
Active Contributor
0 Kudos

I am working with EPM SP27 patch 2 and trying to implement RunPackage API to pass answer prompt to DM package. Everything correctly but I am unable to delete answer file after RunPackage execution.

    epmDM.RunPackage epmDMPackage, strAnswerFileName
    Kill strAnswerFileName

The file strAnswerFileName is still open after RunPackage execution!

After decompile of EPM code in ILSpy I can see the reason:

Public Sub RunPackage(package As IADMPackage, filename As String)
    Try
        SAPModuleNameInspectorBehavior.ModuleOverride = "DataManager"
        If package Is Nothing Then
            Throw New InvalidArgException(String.Format(Resources.ExceptionParameterIsNull, "package"))
        End If
        package.CheckParameters()
        If filename Is Nothing Then
            Throw New InvalidArgException(String.Format(Resources.ExceptionParameterIsNull, "filename"))
        End If
        If filename.Trim() = "" Then
            Throw New InvalidArgException(String.Format(Resources.ExceptionPropertyOfObjectIsAnEmptyString, MyBase.[GetType]().ToString(), "filename"))
        End If
        Try
            Dim fi As System.IO.FileInfo = New System.IO.FileInfo(filename)
            If Not fi.Exists Then
                Throw New InvalidArgException("File doesn't exists")
            End If
            Dim fs As System.IO.FileStream = fi.OpenRead()
            Dim sr As System.IO.StreamReader = New System.IO.StreamReader(fs)
            Dim content As String = sr.ReadToEnd()
            ...

But I don't see sr.Close until the end of procedure

Looks like bug!

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Bug is STILL there as of 2.6.100.78647

former_member186338
Active Contributor
0 Kudos

Looks like SAP support has to be notified!

former_member186338
Active Contributor
0 Kudos

Even with introduction of DataManagerAdvancedRunPackage in EPM SP 29 Patch 01 it's still not possible to delete answer file immediately after package run. Same lock.