web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Invalid syntax of VBSc...
Power Automate
Suggested Answer

Invalid syntax of VBScript for SAP

(1) ShareShare
ReportReport
Posted on by 4

If Not IsObject(application) Then

   Set SapGuiAuto  = GetObject("SAPGUI")

   Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

   Set connection = application.Children(0)

End If

If Not IsObject(session) Then

   Set session    = connection.Children(0)

End If%vDocumentNo%

If IsObject(WScript) Then

   WScript.ConnectObject session,     "on"

   WScript.ConnectObject application, "on"

End If

session.findById("wnd[0]").maximize

session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"

session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem "%GOS_ARL_LINK"

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").hierarchyHeaderWidth = 388

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").selectItem ""%vDocumentNo%"","HITLIST"

session.findById("wnd[1]/usr/ssubSUB110:SAPLALINK_DRAG_AND_DROP:0110/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").ensureVisibleHorizontalItem ""%vDocumentNo%"","HITLIST"
VBScriptError PAD.PNG
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,969 Moderator on at
    Hi
     
    Did you notice you have this variable here next to the end if
  • Suggested answer
    eetuRobo Profile Picture
    4,484 Super User 2026 Season 1 on at
    As @FLMike pointed out you should remove the %vDocumentNo% after the second to last End if. 

    What gives the syntax error is percent signs in the SAP elements (rows 31 and 33). Since PAD reads percent signs as variable starts and ends signs it will give syntax error since it thinks you didn't close the variable referencing. Add another percent sign and it reads it as one. Like so:


    Also make sure its intentional to have two bouble quotes around vDocumentNo -variable

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard