cancel
Showing results for 
Search instead for 
Did you mean: 

Emulating Drag & Drop in Transaction OAWD

former_member709020
Participant
0 Kudos

Hello:

Iv'e been trying to automate dragging and dropping files into the TextEdit window via transaction OAWD.  I've recorded the script using the script recorder and get this:

session.findById("wnd[0]").maximize

session.findById("wnd[0]/tbar[0]/okcd").text = "oawd"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/lbl[5,3]").setFocus

session.findById("wnd[0]/usr/lbl[5,3]").caretPosition = 1

session.findById("wnd[0]").sendVKey 2

session.findById("wnd[0]/usr/lbl[12,5]").setFocus

session.findById("wnd[0]/usr/lbl[12,5]").caretPosition = 0

session.findById("wnd[0]").sendVKey 2

session.findById("wnd[1]/usr/txt[2]").text = "Test 2"

session.findById("wnd[1]/usr/txt[2]").caretPosition = 6

session.findById("wnd[1]/tbar[0]/btn[9]").press

session.findById("wnd[1]/usr/ssub/1/cntlSPLITTER/shellcont/shellcont/shell/shellcont[0]/shell").hierarchyHeaderWidth = 286

session.findById("wnd[1]/usr/ssub/1/cntlSPLITTER/shellcont/shellcont/shell/shellcont[1]/shell").multipleFilesDropped

session.findById("wnd[1]/usr/ssub/1/cntlSPLITTER/shellcont/shellcont/shell/shellcont[1]/shell").setSelectionIndexes 73,99

session.findById("wnd[1]/tbar[0]/btn[0]").press

session.findById("wnd[1]/tbar[0]/btn[12]").press

session.findById("wnd[0]/tbar[0]/btn[3]").press

The .multipleFilesDropped is a method defined in the Scripting Help as :


Emulate a Drag&Drop operation, in which several files are dropped on the

textedit control. The collection contains for each file the fully qualified file

name as a string.

I've also tried replacing that method with the .SingleFileDropped method which is defined as:


This function emulates the drop of a single file with the directory path fileName.

I used .SingleFileDropped ("C:\SAP\myfile.pdf") when attempting this method.

No files are copied to the TextEdit window with either method.  I'm trying to do this within an Excel macro and realize that my code will have to identify the files that should be dragged to the TextEdit window.  Does anyone out there know how to automate the drag & drop step?

Accepted Solutions (1)

Accepted Solutions (1)

holger_khn
Contributor
0 Kudos

Hello Gary.

According to note 587202 SAP GUI Scripting does not Support Drag&Drop.

Best regards

Holger

former_member709020
Participant
0 Kudos

Holger: Thanks for the quick response.  I found the note you mentioned and it's quoted below:


Drag and Drop is not supported in scripting. However, you should have the option of using the function without drag and drop in all applications.

What has me curious is the last sentence; ...you should have the option or using the function without drag and drop in all applications.  Do you think there may be another way to get the files into the TextEdit window other than drag and drop?

holger_khn
Contributor
0 Kudos


You can choice FileOpen Dialog via OAWD. But there we have the next issue:


  • No support for Microsoft common dialogs

           Scripting for common dialogs (such as FileSave, FileOpen) is not supported.

I do not know if we have another Transaction beside OAWD which can get file-path as string Input.

When you want use MS Comm Dialog FileOpen you Need to use an seperate macro-enabled Excel instance which can control MS Comm FileOpen via USER32-Api calls during execution of SAP Session code.

This is an complex Workaround. Don´t know if this make any sense for your requirements.

former_member709020
Participant
0 Kudos

Thanks.  I marked your answer as correct.

holger_khn
Contributor
0 Kudos

Gary.

One Option for your requirement can be following steps:

Prerequisites => You Need to have Access for SE38 or Transaction START_REPORT

Call Report 'OA_UPLOAD_AND_LINK'

This can be filled via SAP SCRIPTING and execute.

That´s what I found as Option.

holger_khn
Contributor
0 Kudos

Sorry. It´s note 685520

former_member709020
Participant
0 Kudos

Thanks again, Holger:  Our typical users, myself included, don't have access to SE38.

holger_khn
Contributor
0 Kudos

Yes, Access to SE38 is very often restricted. What´s about Access for Transaction START_REPORT?

However, mentioned note include an customized Report 'ZOA_UPLOAD_AND_LINK'. So I assume you have to raise an Change request to your IT department for implementation of note 685520. Then you can request to make an customized Transaction for this new Report.

When this Report/transaction Support to save time for your daily Business I guess this Change can be implemented in your System landscape.

Br, Holger

former_member709020
Participant
0 Kudos

Nope.  Don't have access to that one either.  I'm trying to get into the SAP Marketplace so I can read Note 685520.  Thanks for your help!

Answers (0)