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.

View solution in original post

andresfloza16
Resolver I
Resolver I

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

@andresfloza16 

 

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

andresfloza16
Resolver I
Resolver I

thank you very much for your help

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,868)