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

Facing error while passing Variable value in VB script

prabahar_sekar
Explorer
0 Likes
525

Hi ,

In My requirement, I need to read Cell value in work book and need to pass to Input variable of Planning sequence.

By using SAPGetCellInfo, its reading cell value in lResult1 (Type variant ), but not able to pass in SAPSetPlanParameter" Planning sequence variable.

Instead of lResult1 i passed costcentre value directly eg "CC01010101" planning sequence working , but if i use IResult1 its not accepting.

Coding

Dim lResult1 As Variant

Dim lRange As Object

Call Application.Run("SAPSetRefreshBehaviour", "Off")

Call Application.Run("SAPExecuteCommand", "PauseVariableSubmit", "On")

lResult1 = Application.Run("SAPGetCellInfo", ActiveCell, "SELECTION", lNameChar)

lResult = Application.Run("SAPSetPlanParameter", "PS_2", "ZV_ISGM_COSTCENTER_002", lResult1, "INPUT_STRING") ---- IResult variable not passing value

MsgBox IIf(Val(lResult) = 1, "Filter is applied", "No Filter") --- its throwing "No Filter" message only

Call Application.Run("SAPExecuteCommand", "PauseVariableSubmit", "Off")

Call Application.Run("SAPSetRefreshBehaviour", "On")

lResult = Application.Run("SAPExecutePlanningSequence", "PS_2")

View Entire Topic
former_member186338
Active Contributor
0 Likes

lResult1 = Application.Run("SAPGetCellInfo", ActiveCell, "SELECTION", lNameChar)

What do you mean by undefined variable INameChar?

Please read this blog about correct syntax:

https://blogs.sap.com/2013/11/17/sapgetcellinfo-specifying-a-filter-doesnt-determine-the-order-of-re...

lResult1 = Application.Run("SAPGetCellInfo", ActiveCell, "SELECTION", "DimName")

Look on lResult1 in VBA debugger!

And remove useless lines, not related to your code:

Call Application.Run("SAPSetRefreshBehaviour", "Off") 
Call Application.Run("SAPExecuteCommand", "PauseVariableSubmit", "On")
...
Call Application.Run("SAPExecuteCommand", "PauseVariableSubmit", "Off")  
Call Application.Run("SAPSetRefreshBehaviour", "On")

Not related to SAPExecutePlanningSequence