cancel
Showing results for 
Search instead for 
Did you mean: 

The control could not be found by id

former_member723399
Discoverer
0 Kudos

Hi Experts,

I ran scripting to save a table from a transaction. That works great too. For another transaction, selection parameters must first be set in a mask. As soon as the table is loaded and a button in the toolbar is clicked in the scripting program, I get the error message: "The control could not be found by id." Therefore I cannot save the table via scripting.

The scripting tracker doesn't show me a menu button, but a shell.

The scripting code works for the first table:

session.findById("wnd[0]/usr/shell[0]").pressToolbarContextButton("&MB_EXPORT")

In the second table I record the following command, which however outputs the error:

session.findById("wnd[0]/usr/shell[1]/shellcont[0]/shell").pressToolbarContextButton("&MB_EXPORT")

What am I doing wrong? How can I find out what the difference between the two tables is, why the toolbar is only inaccessible for one table?

Is there a way to give the mouse coordinates to click as a command?

Thank you very much for your support.

Many Greetings, Chris

Sandra_Rossi
Active Contributor
0 Kudos

It just means that this object doesn't exist on your screen:

wnd[0]/usr/shell[1]/shellcont[0]/shell

Try each level to see which object does not exist:

if session.findById("wnd[0]/usr/shell[1]") is nothing then
  msgbox "I don't exist 1"
end if

if session.findById("wnd[0]/usr/shell[1]/shellcont[0]") is nothing then
  msgbox "I don't exist 2"
end if

if session.findById("wnd[0]/usr/shell[1]/shellcont[0]/shell") is nothing then
  msgbox "I don't exist 3"
end if

Please execute it and tell us.

former_member723399
Discoverer
0 Kudos

many thank for your support.

Unfortunately, the if query did not work. I get the same error message.

Here is the structure tree of the two tables.

The transaction below works. Above is the transaction with the error (red arrow). I notice here that there are two shell [1]. Can it be that the program cannot distinguish between the two?

many thanks to you.

Best Regards,

Chris

Sandra_Rossi
Active Contributor
0 Kudos

The screenshot is not attached.

What means "query did not work"? (invalid syntax, no message displayed, etc.?)

former_member723399
Discoverer
0 Kudos

Oh sorry for the missing table

The transaction below works. Above is the transaction with the error (red arrow). I notice here that there are two shell [1]. Can it be that the program cannot distinguish between the two?

I mean the if code is not working for both tables in both transaction. I get for both tables the error code "The control could not be found by id" although one table with the scripting code for saving the table works.

So I think there must be an issue with the shell / Toolbar?

Or can it be the reason, that a second shell is called after a first shell?

session.findById("wnd[0]/usr/shell[1]/shellcont[0]/shell").pressToolbarContextButton("&MB_EXPORT")

For all other transactions with tables, the shell is only called once and there is no error message.
Example where there is no error message:

session.findById("wnd[0]/usr/shell[0]").pressToolbarContextButton("&MB_EXPORT")

many thanks

Sandra_Rossi
Active Contributor
0 Kudos

Maybe it's a display bug in scripting tracker by Stefan.

If I create a program which has a splitter container in cl_gui_container=>screen0 (shell) with 2 parts (shellcont[0] and shellcont[1]) each containing an ALV grid (shell), I see with the SAP screenreader.exe that the ALV grids have IDs like that:

/app/con[0]/ses[0]/wnd[0]/usr/shell/shellcont[0]/shell
/app/con[0]/ses[0]/wnd[0]/usr/shell/shellcont[1]/shell
Sandra_Rossi
Active Contributor
0 Kudos

By the way, you may debug your script and display the Children property of each control, so you could troubleshoot the right IDs by yourself.

stefan_schnell
Active Contributor
0 Kudos

toto88sap

Hello Chris,
which transaction code do you use?

Thanks and best regards
Stefan

Accepted Solutions (1)

Accepted Solutions (1)

former_member723399
Discoverer

Hello togehter,

I have found a solution.

By chance I am only one step back from the table to the selection mask, and then scripting worked.Unfortunately, I don't know why I have to call up the table first, then leave it and then call it up again so that the toolbar can then be addressed.

@Stefan: The transaction itself is of no use as a statement because it is an individual one.

Many thanks for your support

Answers (0)