cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ErikEngman
Frequent Visitor

RUN VB Script for SAP Data extraction - Syntax error

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-fl...), 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

 

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

5 REPLIES 5
ErikEngman
Frequent Visitor

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 

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

Anonymous
Not applicable

@ErikEngman 

 

 

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"

@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

Anonymous
Not applicable

thank you very much for your help

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Top Solution Authors
Top Kudoed Authors
Users online (2,974)