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
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.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,574)