Home » excel » excel – Discovering component identifiers of a SAP transaction' fields to utilize

excel – Discovering component identifiers of a SAP transaction' fields to utilize

Posted by: admin May 14, 2020 Leave a comment

Questions:

Through a lot of Googling I managed to connect to SAP and open a transaction from VBA code. This is not part of the problem, so I won’t include it here.

My problem is as follows: Now that I have the transaction open, I want to enter values into the fields of the transaction from my code.

I assume this is done by code similar to this:

session.findById("wnd[0]/usr/ctxtVendor").Text

However, the /usr/ctxtVendor part is obviously wrong. If I understand correctly, this is pretty much different on a company basis.

One solution is to use the “SAP Script Recording & Playback” utility to generate VBA code and extract the variablenames. Unfortunately I am not authorized to use this, and I won’t be any time soon so that is not an option.

EDIT: I found a second solution:but it doesn’t seem as if I have access to this.

Are there other ways of discovering the identifiers for this and other transactions?

Thank you for reading and hopefully for providing an answer.

How to&Answers:

Sorry i gave you the wrong info for VBA scriptable names. Make your window a variable like so:

Dim window As SAPFEWSELib.GuiFrameWindow
Set window = session.FindById("wnd[0]")

Then you go to the Locals window in your VBEditor, and see it here:

enter image description here

For me, the /usr area is Item 5 of the window children, open it up and look for all the fields listed. You can use the path provided. E.g. Below i have opened up Item 2 which is Account number, and you see the string needed in Id property.

enter image description here

Then you use it like so:

window.FindById("usr/ctxtRACCT-LOW").Text = "A123456"