on 2022 Jun 24 2:29 PM
Dear all,
I would like to give a list of more than 20000 text values (document numbers) as filter for an BW Query in Analysis for Office. This I would like to do via a short VBA code to automate. The Filter value shall be based on a variable list length. I have defined a variable name range in Excel and tried to use this name range then as filter input via the Application.Run SAPSet filter function. For this I am joining my variable area together in one string with a ; seperator.
For a limited amount of documents this does work. But as soon as it comes to a bigger list, I do receive a runtime error 1004. I guess the SapSetFilter function has an input limit. Do you have an idea to solve it? Is there a possibility to use the "Paste from Clipboard" function via VBA to use a Range filter in AO?
Sub Test()
Dim lresult As String
Dim rng As Range
Dim i As String
Dim SourceRange As Range
Set SourceRange = Range("MyRangeTest")
For Each rng In SourceRange
i = i & rng & ";"
Next rng
lresult = Application.Run("SAPSetFilter", "DS_3", "0DOC_NUMBER", i, "INPUT_STRING")
End Sub
When it comes to a big amount of data in the String i, it comes to this Runtime Error for the lresult row:
Thank you.
User | Count |
---|---|
66 | |
11 | |
10 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.