cancel
Showing results for 
Search instead for 
Did you mean: 

Active field name in the script.

Former Member
0 Kudos

Hi Experts -- First of all, I have to tell you all that, I am quite very new to the SAP Scripting.

I have tried to find the question similar to mine in the forum but I could not.

Does anyone know how to call a current selected field or to get its name like in Excel macro "ActiveCell"?

For example, if we are selecting "Employee number" field, how to find the name of the field like this "wnd[0]/usr/.........."

I know that we can use the SAP Scripting Tools to get it but I would like it to be vary and can be changed in the script. Is it possible to do?

If not, is there any workaround?

I would like to develop a program which can read data in a field of many employees. Some field is not available in my query tool. And it is very exhausting to go into each employee's data page and pick up only one field.

Thank you very much for your kind help

Accepted Solutions (0)

Answers (1)

Answers (1)

script_man
Active Contributor
0 Kudos

Hi jackijacky,

I provide as a possible solution the following code:


. . .
session.findById("wnd[0]").sendVKey 1
session.findById("wnd[0]/shellcont/shell/shellcont[0]/shell").pressbutton "TECH"
DYNPROFLD = session.findById("wnd[1]/usr/txtHELP_INFO-DYNPROFLD").text
session.findById("wnd[1]/tbar[0]/btn[12]").press
session.findById("wnd[0]/shellcont").close
DYNPROFLD_ID = session.activewindow.findByName(DYNPROFLD,"GuiTextField").id
DYNPROFLD_TEXT = session.findById(DYNPROFLD_ID).text
msgbox DYNPROFLD_TEXT
. . .

VB script takes here a detour via "Performance Assistant" and "Technical Info". The code requires that the cursor is in a GuiTextField. One must not forget that there exist also other types: eg GuiCTextField, GuiPasswordField. . .

The variable DYNPROFLD_ID contains a string, the would also create the script recorder.

Regards,

ScriptMan

Former Member
0 Kudos

Thank you very much MR.ScriptMan. I am very appreciated.

I think it must help. I need to test it.

Jackijacky