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 / RUN VB Script for SAP ...
Power Automate
Answered

RUN VB Script for SAP Data extraction - Syntax error

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

 

I'm trying to run a PAD flow to extract certain data reports from SAP. As per the Playbook (link: https://flow.microsoft.com/en-us/blog/rpa-playbook-for-sap-gui-automation-with-power-automate-api-flows-ui-flows-and-power-automate-desktop/), I have used the scripting engine in SAP to record a script that I want to run (and then automate the output further with PAD).

 

For some scripts, I get an error message stating that there is a Syntax error (see screenshot). I have manually run the scripts in SAP and they work fine. Now to the question: Is there any way to see where (on what line) PAD has thrown a syntax error in the script? I have about 100 lines, and just by looking at it, nothing seems wrong.

 

2021-04-30_10-26-02.png

 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Addition:

     

    I looked through the script again and found that SAP generates lines containing multiple instances of the character "%" which are interpreted as a variable by PAD. So the generated script is OK, but is not interpretes correctly by PAD. Anyone have any idea on how to get around that?

     

    Best regards,

    Erik 

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Final update: Found that there is a way to escape from variable interpretation: using two subsequent "%" characters. Now the script runs through perfectly.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Anonymous 

     

     

    Hello friend, help me, I did not understand you, I have this code with the same problem

    it's a button click

     

    session.findById("wnd[0]").maximize
    session.findById("wnd[0]/usr/ctxtW_MATNR-HIGH").showContextMenu
    session.findById("wnd[0]/usr").selectContextMenuItem "%001"

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Anonymous 

     

    If the text ”%001” is auto generated from SAP, try changing it to ”%%001”. Adding an extra ”%” makes PAD interpret it as a single %-character instead of a variable. 

    Hope it helps!

     

    BR

    Erik

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    thank you very much for your help

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 227 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 213 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 151

Last 30 days Overall leaderboard