cancel
Showing results for 
Search instead for 
Did you mean: 

C# Script SAP GUI Select all column of table

ptuga
Explorer
215

Hello,

I am trying to select all columns of a table where the select all top corner symbol does not exist.

The plan is to copy the full content of the table to the clipboard.

I am not sure (and cannot run the recorder) how to do this.

You can manually select the first column and drag until you reach the last.

On some tables, you can use CTRL+A to select all table contents. On others you cannot. This is the case.

Only a Copy text appears in the context menu (right click) and for that all columns need to be selected first.

I have attached the 2 different examples (3 images).

I believe this is the table object: /app/con[0]/ses[0]/wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell

Please support.

Ideally, I would use C# but a VB.NET example would help a lot (assuming I can revert it to C#). 

Thank you all.

rspecht
Explorer
0 Kudos

Try /app/con[0]/ses[0]/wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell.SelectAll()

stefan_schnell
Active Contributor
0 Kudos

Hello @ptuga, please look at the answer - comment pressed instead of answer. ¯\_(ツ)_/¯

View Entire Topic
stefan_schnell
Active Contributor

Hello @ptuga,

as far as I can see you want to select and copy data from an ALV Grid (Class GuiGridView). As @rspecht described to select all you can use SelectAll method. But it don't know a way to copy the selected content into the clipboard directly, only via toolbar Local File... > In the clipboard. If the button is available here an example.

ID = InvokeMethod(session, "findById", new object[1]{"wnd[0]/usr/cntlGRID1/shellcont/shell"});
InvokeMethod(ID, "clearSelection", new object[0]);
InvokeMethod(ID, "selectAll", new object[0]);

ID = InvokeMethod(session, "findById", new object[1]{"wnd[0]/tbar[1]/btn[9]"});
InvokeMethod(ID, "press", new object[0]);
ID = InvokeMethod(session, "findById", new object[1]{"wnd[0]"});
InvokeMethod(ID, "sendVKey", new object[1]{45});
ID = InvokeMethod(session, "findById", new object[1]{"wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[4,0]"});
InvokeMethod(ID, "select", new object[0]);
ID = InvokeMethod(session, "findById", new object[1]{"wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[4,0]"});
InvokeMethod(ID, "setFocus", new object[0]);
ID = InvokeMethod(session, "findById", new object[1]{"wnd[1]/tbar[0]/btn[0]"});
InvokeMethod(ID, "press", new object[0]);

stefan_schnell_1-1719203614266.png

Check if the button is available in your case.

stefan_schnell_0-1719203539566.png

Best regards
Stefan