The King
The King

Reputation: 4650

Load values in Multiple Selection screen in SAP

Trying to automate a process using SAP-Gui Scripting, where in there is a need to paste multiple values in the multiple selection screen in SAP.

enter image description here

I will not be able to use, paste from clipboard as by the time this gets executed, the clipboard contents would get changed. When I record import from file option, the command is not getting recorded. Is there some way to achieve this?

session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/nfs10n"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/btn%_SO_BUKRS_%_APP_%-VALU_PUSH").press

'  **The import from file command should go here.**

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

I tried the CopyText command but it is not working as intended, though not sure why.

Copytext fromFile="myfile.txt" toText="t1"
Copytext fromText="t1" -toclipboard

Is there some way to achieve this?, like reading the file into clipboard before using paste from clipboard command... Currently there are around 3000 such line items and looping them through is making the script to run for long.

Upvotes: 1

Views: 4208

Answers (2)

ScriptMan
ScriptMan

Reputation: 1625

If the selection "Show native Dialog boxes of Microsoft Windows" ist not active, then the script might look like this:

session.findById("wnd[0]/usr/btn%_S_RECNNR_%_APP_%-VALU_PUSH").press
session.findById("wnd[1]/tbar[0]/btn[23]").press
session.findById("wnd[2]/usr/ctxtDY_PATH").text = "z:\"
session.findById("wnd[2]/usr/ctxtDY_FILENAME").text = "test.txt"
session.findById("wnd[2]/usr/ctxtDY_FILENAME").caretPosition = 8
session.findById("wnd[2]/tbar[0]/btn[0]").press
session.findById("wnd[1]/tbar[0]/btn[8]").press

Upvotes: 2

ScriptMan
ScriptMan

Reputation: 1625

The solution of the issue is in the settings for SAP GUI Scripting. There should be disabled / deactivated all three options for selection. Especially "dialog box of Microsoft Windows shows". Then you can also record the button 23 and leave the button 24 off.

P.S. The "CopyText" command comes from GuiXT and can not be readily applied within a VB script.

Regards, ScriptMan

Upvotes: 0

Related Questions