cancel
Showing results for 
Search instead for 
Did you mean: 

SAPSetVariable Returns Error 1004

12-30-2019 2:32 PM
548 views 0 comments
0 Likes
SAP Managed Tags
Subscribe

I am attempting to set the Material variable with a list which is the result of another SAP/BW query in Excel on a separate worksheet. I run the SAPLogon first. Then, refresh the queries to activate them. Next, I run a script to get the variables (a list with 4000+ items) from DS_1. This part collects the data successfully.

Function GetVariable1()

Dim Material As String

Dim MaterialTrim As String

Excel.Worksheets("Prov").Select

Material = ""

j = 2

While Not IsEmpty(Cells(j, 1))

Material = Material + Cells(j, 1) + ";"

Debug.Print Material

j = j + 1

Wend

MaterialTrim = Left(Material, Len(Material) - 1) 'removes last semi-colon from loop Debug.Print MaterialTrim

****Here is where the code breaks down. I receive a Run-time error ‘1004: Method ‘Run’ of object ‘_Application’ failed.

Call Application.Run("SAPSetVariable", "0MATERIAL", MaterialTrim, "INPUT_STRING", "DS_1")

What am I missing?

0 Likes

Accepted Solutions (0)

Answers (0)