Skip to Content

Facing error while passing Variable value in VB script

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")

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Apr 28 at 09:29 PM

    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-results/

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.