Hi,
I am trying to set the filters in my workbook using VBA code. I am using the code below, however, the SAPSetFilter call returns a result of 0 (i.e. fails). The technical name is correct and the value is valid. I can get the SAPSetVariable call to work correctly for the fields that are prompts. I have tried many searches but do not seem to be able to work it out.
Any help would be greatly appreciated.
Regards
Lachlan
dataSourceAlias = Application.Run("SAPGetCellInfo", Excel.ActiveWorkbook.Sheets("InventoryData").Cells(1, 1), "DATASOURCE")
lResult = Application.Run("SAPSetRefreshBehaviour", "Off")
lResult = Application.Run("SAPExecuteCommand", "PauseVariableSubmit", "On")
lResult = Application.Run("SAPSetVariable", "Calendar Month/Year From", "01.2014", "INPUT_STRING", dataSourceAlias)
lResult = Application.Run("SAPSetVariable", "Calendar Month/Year TO", "08.2014", "INPUT_STRING", dataSourceAlias)
PlantSel = "1000"
lResult = Application.Run("SAPSetVariable", "Plant (Selection Options, Optional)", PlantSel, "INPUT_STRING", "DS_1")
'''''''''''''''''All above code works ok''''''''''''''
''''''''''''''''the line below returns a value of 0'''''''''''''''''''''
lResult = Application.Run("SAPSetFilter", dataSourceAlias, "0MATERIAL", "200", "KEY")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
lResult = Application.Run("SAPExecuteCommand", "PauseVariableSubmit", "Off")
lResult = Application.Run("SAPSetRefreshBehaviour", "On")