cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAPSetFilter in VBA - Size limit using a variable to define MEMBER

christophe11
Associate
Associate
0 Kudos
66

Hello,

I'm using the SAPSetFilter function in VBA for one of my files. To set the filter member, I'm using a variable defined as a String. This approach has worked for the last two years, but recently, I'm encountering an error message when running the file.

It seems the issue is related to the size of my variable. When I reduce the number of items used to populate this variable, the file runs without any issues.

Here is the relevant part of my VBA code:

' Set variable Filter with list of Opportunities
Dim Filter As String

For compteur = 5 To wsListOpp.Range("C" & Rows.Count).End(xlUp).Row
    AllOpp = wsListOpp.Range("C" & compteur).Value
    Filter = Filter & AllOpp & ","
Next

' Update AfO Filter
Dim Filter0 As Long
Filter0 = Application.Run("SAPSetFilter", "DS_1", "OPPORTUNITY_ID", Filter, "INPUT_STRING")

Is there a workaround to extend the size limit of the Filter variable when using SAPSetFilter? Interestingly, when I manually copy my list of Opportunities and set the OPPORTUNITY_ID filter without VBA, it works fine.

Thank you for your insights!

Christophe

Accepted Solutions (0)

Answers (0)