cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrecorder ist not recording "copy text" in contextmenu

Former Member
0 Kudos

Hey there!

I have a problem, which makes me really sick!

My scriptrecording is definitely not recording one special command, see this picture:

All other commands in this contextmenu are recorded. only the first one not. i tryed to guess the command, tryed to use "&COPY" or "&COPYTEXT" and so on, but did not work.

Here is the Code:

.findById("wnd[0]/usr/cntlALV_CONTAINER/shellcont/shell").selectColumn "AUFNR"

.findById("wnd[0]/usr/cntlALV_CONTAINER/shellcont/shell").contextMenu

.findById("wnd[0]/usr/cntlALV_CONTAINER/shellcont/shell").selectContextMenuItem "&COPY"

The parameter in the last row does not work. What can i do, if my scriptrecording is not recording an important command? how do i get the name of the items of the contextmenu?

Or how can i copy the text? I also tried Application.SendKeys "^c" .... not working.

Thanks for your help!

Kind regards from Bavaria.

0 Kudos

Hi,

How can you assign the copied value to a variable using a contextmenu?

Former Member
0 Kudos

I saw your posted comment. I recommend raising your question again as a new question and follow our rules of engagement: https://community.sap.com/resources/rules-of-engagement. The author of the original question is no longer active in the community and won't receive your query. Feel free to take our Q&A tutorial at: https://developers.sap.com/tutorials/community-qa.html. With these tips you'll be able to prepare questions that draw responses from our members.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

stefan_schnell
Active Contributor
0 Kudos

Hello Maximilian,

it is very interesting.

Try this to solve your problem:

session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").contextMenu

session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectContextMenuItemByPosition "0"

Or this:

session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").contextMenu

session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectContextMenuItemByText "Text kopieren"

Let us know the result.

Cheers

Stefan

Former Member
0 Kudos

Stefan,

thanks for your tip. i will try it tomorrow at work.

have you guessed this methods? i'm not sure if they are existing.... but lets have a try.

if some has another solution proposal, please let me know too.

thanks so far.

stefan_schnell
Active Contributor
0 Kudos

Hallo Maximilian,

so far I can see you are using the ContextMenu method with a GuiGridView object. The methods exists, I have previously tested.

Take also a look at the SAP GUI Scripting help and you will find many objects which supports these methods.

Cheers

Stefan

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Stefan,

it worked so far... but one thing is annoying:

If i paste the Values in my Sheet with:

Range("A" & startRow).PasteSpecial

... it always cuts off the last digit number.

But if i paste it manual (with strg+v) ... it works. what is happening there?

Former Member

Ok.... now it works. Dont know why. Now i use:

Range("A" & startRow).PasteSpecial skipblanks:=True

Crazy VBA

Thanks so far!!! You helped me a lot!