Quantcast
Channel: SCN : Discussion List - Scripting Languages
Viewing all articles
Browse latest Browse all 325

Gui navigation - entering data through VBA

$
0
0

Hello,

 

I started a project just yesterday after realizing I can control SAP through VBA.  I've been doing pretty good figuring things out with the awesome answers provided here to other people's questions.  I have the automated login as well as 2 of the 3 total major functions I wish to accomplish all figured out.  A good lot of it comes from recording scripts to see how things are done.  I've ran into a minor snag that I had a question about and not sure where to turn for this one, so figured I'd ask the professionals.

 

In my office, we have 2 different computers.  PC1 is set to a screen resolution of 1024x768.  PC2 is set to 1280x1024.

 

On PC1 when manually navigating the GUI to a particular SAP screen I have 4 rows of a data input table with 1 more row hidden that I have to scroll down one click to get to the last row.  On PC2 at the higher screen resolution, I don't have to scroll, it shows all 5 rows.  I'm doing all of my scripting/recording/testing on PC1. 

 

This is a small snippet from that script on PC1.

 

'Travel Time

session.findById("wnd[0]/usr/tabsTB_CLOSER/tabpTB_CLOSER_FC2/ssubTB_CLOSER_SCA:SAPMZCS_CALL_CLOSER:0220/tblSAPMZCS_CALL_CLOSERTC_OPERATIONS/txtG_WRK_OPERATION-ISMNW[3,0]").Text = "60"

'Time Onsite

session.findById("wnd[0]/usr/tabsTB_CLOSER/tabpTB_CLOSER_FC2/ssubTB_CLOSER_SCA:SAPMZCS_CALL_CLOSER:0220/tblSAPMZCS_CALL_CLOSERTC_OPERATIONS/txtG_WRK_OPERATION-ISMNW[3,3]").Text = "240"

 

'scroll 1 for Mileage

session.findById("wnd[0]/usr/tabsTB_CLOSER/tabpTB_CLOSER_FC2/ssubTB_CLOSER_SCA:SAPMZCS_CALL_CLOSER:0220/tblSAPMZCS_CALL_CLOSERTC_OPERATIONS").verticalScrollbar.Position = 1

session.findById("wnd[0]/usr/tabsTB_CLOSER/tabpTB_CLOSER_FC2/ssubTB_CLOSER_SCA:SAPMZCS_CALL_CLOSER:0220/tblSAPMZCS_CALL_CLOSERTC_OPERATIONS/txtG_WRK_OPERATION-ISMNW[3,3]").Text = "48"

 

I left a couple comments in to refer to them by their name.

 

After the initial recording and looking at it.  I expected the mileage line to be...

 

.../txtG_WRK_OPERATION-ISMNW[3,4]").Text = "48"

 

but it wasn't.    If I do the same thing on PC2, then that is exactly what the mileage line is, but because I scrolled down one notch it's [3,3] just like the Time Onsite line, which tells me that the reference is to what is on-screen and not a direct label to that entry.  I double checked that by recording again and this time before making that 5th line entry, I scrolled down far enough so it was in the 1st position and sure enough, it recording it as [3,0].

 

Now to the pertinent question.  Can I use [3,4] in the script even though technically that position is off-screen or will I end up having to add screen resolution checking to ensure things get done the right way no matter the screen resolution?

 

I would test it, but I have to keep my testing to a minimum as I only have access to the live database and I do have to be careful what I'm doing with the live data.

 

Thanks, Much Appreciated.

RJ


Viewing all articles
Browse latest Browse all 325

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>