cancel
Showing results for 
Search instead for 
Did you mean: 

SAP GUI Scripting v 620 - Cut and Paste from ALV

Former Member
0 Kudos

Hi Experts - I was wondering if someone out there can help me. My question is how would I copy a column of data from an ALV grid and paste it into another area (variant) using a script. I can get it to select (highlight) the column but cannot get it to copy to clipboard for later pasting. Ctrl-C is not recorded in the script. If this is not working with this version, is there a way I can get the script to keypress the letter "C" so I can do a copy through right-clicking and bringing up context menu. I tried saving it into a file and read in the file later but file saved from ALV comes with vertical bars around the data. I tried everything I could think of. The only way seems to be find the command to cut and keep it in the clipboard for pasting.

Thanks for any insight. (I also posted this question in another forum by mistake).

Umur

Accepted Solutions (1)

Accepted Solutions (1)

script_man
Active Contributor
0 Kudos

Hi Umur,

I have this problem solved as follows:

For example:

session.findById("wnd[0]/usr/subSUB_OBJSEL:/BE2/SAPLRECN_GUI_CN_SEL:1000/ctxt/BE2/RECN_CONTRACT_X-RECNNR").setFocus

The recorded line converts it to.

MyClip = session.findById("wnd[0]/usr/subSUB_OBJSEL:/BE2/SAPLRECN_GUI_CN_SEL:1000/ctxt/BE2/RECN_CONTRACT_X-RECNNR").text

At a new location you can use the variable again:

session.findById("wnd[0]/usr/subSUB_OBJSEL:/BE2/SAPLRECN_GUI_CN_SEL:1000/ctxt/BE2/RECN_CONTRACT_X-New_RECNNR").Text = MyClip

Regards,

ScriptMan

Former Member
0 Kudos

Hi Scriptman - this is from an SUIM report output and provides a list only. The individual fields are not recognized by the script when you try to record. The only thing that can be done is to click on the column header and select all. The whole thing is in a container. When I click the header title the recording shows this:

session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").currentCellRow = -1

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

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

It is at this point that I would like to be able to cut and paste. That is what I can't get the script to record and playback. So I had to be creative and save it into a file and then call it up and paste it after cleaning the file from garbage dashes and bars. It works and does the trick but it is a very clunky solution.

Cheers

Umur

script_man
Active Contributor
0 Kudos

Hi Umur,

how about the following solution:

...

LINE = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").currentCellRow

CELL = session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").getcellvalue (LINE,"BNAME")

...

Regards,

ScriptMan

Former Member
0 Kudos

ScriptMan - I tried your solution but I am not sure what panel you have popping up with wnd[1] in your code. As there is no Window[1] it fails. All I have is a shell with rows of userid's, that I can only click on the column heading. Is there a way I can simulate Control-C key combination (to copy the row into clipboard so I can then paste it into another list?

Regards

Umur

script_man
Active Contributor
0 Kudos

Hi Umur,

sorry, it should properly WND [0] read.

My approach is to suggest that each cell must be read out individually.

For example:

...

ROW = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").currentCellRow

CELL = session.findById("wnd[0]/usr/cntlCONTAINER_0100/shellcont/shell").getcellvalue (ROW,"BNAME")

CELL_1 = session.findById("wnd[0]/usr/cntlCONTAINER_0100/shellcont/shell").getcellvalue (ROW,"BNAME_1")

CELL_2 = session.findById("wnd[0]/usr/cntlCONTAINER_0100/shellcont/shell").getcellvalue (ROW,"BNAME_2")

MyLINE = CELL & CELL_1 & CELL_2

ROW = ROW + 1

...

Incidentally, I must apologize for my English. Basically, I can absolutely not. Google - translator helps me here.

Regards,

ScriptMan

Former Member
0 Kudos

ScriptMan - it cannot find control because there is no "cntlCONTAINER_0100" element on that screen. The only element is "usr > cntlGRID1> shellcont --> shell", and that is just the shell. Sorry if I am missing something.

Regards

Umur

P.S. the English whether translated or not is just fine. Thanks for your effort and taking time to help out fellow scripters.

script_man
Active Contributor
0 Kudos

Hi Umur,

of course, read as follows:

...

ROW = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").currentCellRow

CELL = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").getcellvalue (ROW,"BNAME")

CELL_1 = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").getcellvalue (ROW,"BNAME_1")

CELL_2 = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").getcellvalue (ROW,"BNAME_2")

MyLINE = CELL & CELL_1 & CELL_2

ROW = ROW + 1

...

That was just an example. The whole time is actually only the function ... "getCellValue" that one can not record. Sorry if I use my examples inaccurate confused should have.

Regards,

ScriptMan

Former Member
0 Kudos

ScriptMan - you did it again! Thanks! I was able to read the values from the grid and pasted into a text file to be later used by pasting the user id's into another program's variant. I counted number of rows and inserted the reading process in a 'for' loop for that range.

Set fso = CreateObject("Scripting.FileSystemObject")

Set TextFile = fso.CreateTextFile("c:\tmp\Conc.txt",True)

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

RowCt = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").rowCount

For ROW = 0 To RowCt-1

CELL = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").getcellvalue (ROW,"BNAME")

TextFile.WriteLine CELL

Next

TextFile.Close

I then open this file and read records one by one into the variant lines. This works ok but if there was a way to pull in the text file directly into the variant using 'Import from text file' function (Shift-F11). When I press the button, I can't get the script to type the filename into the Windows "Open" Dialog box. Is there a way to overcome this?

Regards

Umur

script_man
Active Contributor
0 Kudos

Hi Umur,

first I am happy that I could help you. You notice that you are also profound, with the topic of scripting deal.

When I see the last question correctly, it goes to windows and entries into this who are not in script recorder can record. I think I have a few solutions. Unfortunately, I am starting tomorrow for a few days. I come to you again.

Regards,

ScriptMan

script_man
Active Contributor
0 Kudos

Hi Umur,

now I'm back. I will publish here an example of how I would solve the problem.

It is thought the dialog box has the name "Open File".

...

set Wshell = CreateObject("WScript.Shell")

Do

bWindowFound = Wshell.AppActivate("Open File")

WScript.Sleep 1000

Loop Until bWindowFound

bWindowFound = Wshell.AppActivate("Open File")

if (bWindowFound) Then

Wshell.appActivate "Open File"

WScript.Sleep 100

Wshell.sendkeys "c:\tmp\filename.txt"

WScript.Sleep 100

Wshell.sendkeys ""

end if

...

As I said, it should only be a suggestion.

Regards,

ScriptMan

Former Member
0 Kudos

Hi ScriptMan - just tried your code. I open up the "Open file' dialog but it sits there - I changed 1000 wait to 100 to see if anything was going to happen but did not seem to go through. It looks like it is not recognizing the open dialog to enter the filename. I tried changing the "Open File" with "Open" (which is what the window title is in my case) thinking it might be what it is looking for but that did not work either. I did not complete the end of the code to execute and save the names but the names do not even drop in the Multiple Selection for User ID dialog. I wanted to get to that point before worrying about the end of the code.

Here's the code - I showed the point it hangs with '<--'. Looks like this will be tricky to get it to work:

If Not IsObject(application) Then

Set SapGuiAuto = GetObject("SAPGUI")

Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

Set connection = application.Children(0)

End If

If Not IsObject(session) Then

Set session = connection.Children(0)

End If

If IsObject(WScript) Then

WScript.ConnectObject session, "on"

WScript.ConnectObject application, "on"

End If

set Wshell = CreateObject("WScript.Shell")

session.findById("wnd[0]/usr/btn%_S_BNAME_%_APP_%-VALU_PUSH").press

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

Do

bWindowFound = Wshell.AppActivate("Open File") *<-- this is where it comes up to and hangs*

WScript.Sleep 100

Loop Until bWindowFound

bWindowFound = Wshell.AppActivate("Open File")

if (bWindowFound) Then

Wshell.appActivate "Open File"

WScript.Sleep 100

Wshell.sendkeys "c:\tmp\Conc.txt"

WScript.Sleep 100

Wshell.sendkeys ""

end if

Regards

Umur

script_man
Active Contributor
0 Kudos

Hi Umur,

Obviously, the window title to be adjusted. If they are "Open" means that my example looks like this:

...

Do

bWindowFound = Wshell.AppActivate("Open")

WScript.Sleep 1000

Loop Until bWindowFound

bWindowFound = Wshell.AppActivate("Open")

if (bWindowFound) Then

Wshell.appActivate "Open"

WScript.Sleep 100

Wshell.sendkeys "c:\tmp\Conc.txt"

WScript.Sleep 100

Wshell.sendkeys ""

end if

...

Unfortunately, I know the specific transaction is not that you are using. A tip from me: After the dialog has opened, all entries should try only using the keyboard to grasp. These keystrokes, you should write to you and me. If you prefer, you can also use my e-address. I would then have a look.

Regards,

ScriptMan

Former Member
0 Kudos

Hi ScriptMan - sorry but even with the dialog box name used as "Open" does not do the trick. I had tried it last week and tried again with Open again, still won't work. The Open dialog screen comes up and it just sits there as if "bWindowFound" is never true. I bring up the dialog box prior to getting into the 'Do':

set Wshell = CreateObject("WScript.Shell")

session.findById("wnd[0]/usr/btn%_S_BNAME_%_APP_%-VALU_PUSH").press

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

Do

bWindowFound = Wshell.AppActivate("Open")

WScript.Sleep 1000

Loop Until bWindowFound

bWindowFound = Wshell.AppActivate("Open")

if (bWindowFound) Then

Wshell.appActivate "Open"

WScript.Sleep 100

Wshell.sendkeys "c:\tmp\Conc.txt"

WScript.Sleep 100

Wshell.sendkeys ""

end if

-


I then moved the dialog open line in the loop to see if that would make it work but it still did not work with the command in the loop.

Not sure what else I can play with to make it work.

Regards

Umur

script_man
Active Contributor
0 Kudos

Hi Umur,

what is the transaction you use?

Regards,

ScriptMan

Former Member
0 Kudos

Hi ScriptMan - I am running a security report transaction through SUIM (program RSUSR070) - Roles by Complex Selection Criteria (selection according to user assignments). But I also tried it with another screen - IW38 to pull up, "Entered by" user ids. It still did not do anything and just sat there waiting to process the next command on the open dialogue. The dialog box (title "Multiple Selection for xxxx") to populate the user id is pretty much identical for all these. The title of the dialog window is "Open" for all. Looks like it is having problem in identifying that the Open dialog has popped up.

Thanks

Regards

Umur

script_man
Active Contributor
0 Kudos

Hi Umur,

I have a long time until I have grasped what is actually happening. My solution to the problem is as follows:

If Not IsObject(application) Then

Set SapGuiAuto = GetObject("SAPGUI")

Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

Set connection = application.Children(0)

End If

If Not IsObject(session) Then

Set session = connection.Children(0)

End If

If IsObject(WScript) Then

WScript.ConnectObject session, "on"

WScript.ConnectObject application, "on"

End If

set Wshell = CreateObject("WScript.Shell")

Wshell.run "c:\tmp\open.vbs",1,false

session.findById("wnd[0]/usr/btn%_S_BNAME_%_APP_%-VALU_PUSH").press

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

...

The file "open.vbs" has the following contents:

set Wshell = CreateObject("Wscript.Shell")

Do

bWindowFound = Wshell.AppActivate("Open")

WScript.Sleep 1000

Loop Until bWindowFound

bWindowFound = Wshell.AppActivate("Open")

if (bWindowFound) Then

Wshell.appActivate "Open"

WScript.Sleep 100

Wshell.sendkeys "c:\tmp\Conc.txt"

WScript.Sleep 100

Wshell.sendkeys ""

end if

Let's see if this is already the solution for you.

Regards,

ScriptMan

Former Member
0 Kudos

Hi ScriptMan - you are a genius. You did it again! This is going to help eliminate a lot of steps in my script where I had to copy id's into a text file, go into another script, clean the data, save, then come back to the same screen and copy these one by one into the dialog, counting the number of lines, etc.

This helps a lot! I am going to paste the script below, in case some one else needs something similar and they can modify and use.I am sure I can use it for some other cases.

Thanks again and best regards.

Umur

-


'This script opens a text file (Conc.txt) populated with userid's and paste these into a "multiple

'selection for xxx" panel. This script emulates SHIFT-F11 (Import from text file) command. Although this

'script uses "BNAME" as the field label, the concept can

'be used for any panel where the input file contains data to be pulled into a multiple select field under

'the "Single value" column. Could be used for equipment number, user ids, material numbers, etc. etc..

'The key to make this work another script file that runs in the background, called by the main script.

'The background file "open.vbs" contents is as follows:

'

'If Not IsObject(application) Then

'Set SapGuiAuto = GetObject("SAPGUI")

'Set application = SapGuiAuto.GetScriptingEngine

'End If

'If Not IsObject(connection) Then

'Set connection = application.Children(0)

'End If

'If Not IsObject(session) Then

'Set session = connection.Children(0)

'End If

'If IsObject(WScript) Then

'WScript.ConnectObject session, "on"

'WScript.ConnectObject application, "on"

'End If

'set Wshell = CreateObject("Wscript.Shell")

'Do

'bWindowFound = Wshell.AppActivate("Open")

'WScript.Sleep 1000

'Loop Until bWindowFound

'bWindowFound = Wshell.AppActivate("Open")

'if (bWindowFound) Then

'Wshell.appActivate "Open"

'WScript.Sleep 100

'Wshell.sendkeys "c:\tmp\Conc.txt"

'WScript.Sleep 100

'Wshell.sendkeys ""

'end if

'

'save the above code in a directory and execute the main script.Courtesy: ScriptMan

If Not IsObject(application) Then

Set SapGuiAuto = GetObject("SAPGUI")

Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

Set connection = application.Children(0)

End If

If Not IsObject(session) Then

Set session = connection.Children(0)

End If

If IsObject(WScript) Then

WScript.ConnectObject session, "on"

WScript.ConnectObject application, "on"

End If

set Wshell = CreateObject("WScript.Shell")

Wshell.run "c:\tmp\open.vbs",1,false

session.findById("wnd[0]/usr/btn%_S_BNAME_%_APP_%-VALU_PUSH").press

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

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

Former Member
0 Kudos

'This script opens a text file populated with userid's and paste these into a "multiple

'selection for xxx" panel. This script emulates SHIFT-F11 (Import from text file) command. Although this

'script uses "BNAME" as the field label, the concept can

'be used for any panel where the input file contains data to be pulled into a multiple select field under

'the "Single value" column. Could be used for equipment number, user ids, material numbers, etc. etc..

'The key to make this work another script file that runs in the background, called by the main script.

'The background file "open.vbs" contents is as follows:

'

'If Not IsObject(application) Then

'Set SapGuiAuto = GetObject("SAPGUI")

'Set application = SapGuiAuto.GetScriptingEngine

'End If

'If Not IsObject(connection) Then

'Set connection = application.Children(0)

'End If

'If Not IsObject(session) Then

'Set session = connection.Children(0)

'End If

'If IsObject(WScript) Then

'WScript.ConnectObject session, "on"

'WScript.ConnectObject application, "on"

'End If

'set Wshell = CreateObject("Wscript.Shell")

'Do

'bWindowFound = Wshell.AppActivate("Open")

'WScript.Sleep 1000

'Loop Until bWindowFound

'bWindowFound = Wshell.AppActivate("Open")

'if (bWindowFound) Then

'Wshell.appActivate "Open"

'WScript.Sleep 100

'Wshell.sendkeys "c:\tmp\Conc.txt"

'WScript.Sleep 100

'Wshell.sendkeys ""

'end if

'

'save the above code in a directory and execute the main script.Courtesy: ScriptMan

If Not IsObject(application) Then

Set SapGuiAuto = GetObject("SAPGUI")

Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

Set connection = application.Children(0)

End If

If Not IsObject(session) Then

Set session = connection.Children(0)

End If

If IsObject(WScript) Then

WScript.ConnectObject session, "on"

WScript.ConnectObject application, "on"

End If

set Wshell = CreateObject("WScript.Shell")

Wshell.run "c:\tmp\open.vbs",1,false

session.findById("wnd[0]/usr/btn%_S_BNAME_%_APP_%-VALU_PUSH").press

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

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

Former Member
0 Kudos

Sorry the code got pasted garbled. Here it is again:

'This script opens a text file populated with userid's and paste these into a "multiple

'selection for xxx" panel. This script emulates SHIFT-F11 (Import from text file) command. Although this

'script uses "BNAME" as the field label, the concept can

'be used for any panel where the input file contains data to be pulled into a multiple select field under

'the "Single value" column. Could be used for equipment number, user ids, material numbers, etc. etc..

'The key to make this work another script file that runs in the background, called by the main script.

'The background file "open.vbs" contents is as follows:

'

'If Not IsObject(application) Then

'Set SapGuiAuto = GetObject("SAPGUI")

'Set application = SapGuiAuto.GetScriptingEngine

'End If

'If Not IsObject(connection) Then

'Set connection = application.Children(0)

'End If

'If Not IsObject(session) Then

'Set session = connection.Children(0)

'End If

'If IsObject(WScript) Then

'WScript.ConnectObject session, "on"

'WScript.ConnectObject application, "on"

'End If

'set Wshell = CreateObject("Wscript.Shell")

'Do

'bWindowFound = Wshell.AppActivate("Open")

'WScript.Sleep 1000

'Loop Until bWindowFound

'bWindowFound = Wshell.AppActivate("Open")

'if (bWindowFound) Then

'Wshell.appActivate "Open"

'WScript.Sleep 100

'Wshell.sendkeys "c:\tmp\Conc.txt"

'WScript.Sleep 100

'Wshell.sendkeys ""

'end if

'

'save the above code in a directory and execute the main script.Courtesy: ScriptMan

If Not IsObject(application) Then

Set SapGuiAuto = GetObject("SAPGUI")

Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

Set connection = application.Children(0)

End If

If Not IsObject(session) Then

Set session = connection.Children(0)

End If

If IsObject(WScript) Then

WScript.ConnectObject session, "on"

WScript.ConnectObject application, "on"

End If

set Wshell = CreateObject("WScript.Shell")

Wshell.run "c:\tmp\open.vbs",1,false

session.findById("wnd[0]/usr/btn%_S_BNAME_%_APP_%-VALU_PUSH").press

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

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

Former Member
0 Kudos

Hi,

I'm trying to execute your code but without success. When "Open" window appears it only changes a current directory to "My Computer" or "Recent Files". Can you help me with that?

Screenshots:

My code:

001
002If Not IsObject(application) Then
003Set SapGuiAuto = GetObject("SAPGUI")
004Set application = SapGuiAuto.GetScriptingEngine
005End If
006If Not IsObject(connection) Then
007Set connection = application.Children(0)
008End If
009If Not IsObject(session) Then
010Set session = connection.Children(0)
011End If
012If IsObject(WScript) Then
013WScript.ConnectObject session, "on"
014WScript.ConnectObject application, "on"
015End If
016set Wshell = CreateObject("WScript.Shell")
017MySession.findById("wnd[0]").resizeWorkingPane 142,18,false
018MySession.findById("wnd[0]/tbar[0]/okcd").text = "zse16"
019MySession.findById("wnd[0]").sendVKey 0
020MySession.findById("wnd[0]/usr/ctxtI_TABLE").text = "MLAN"
021MySession.findById("wnd[0]/usr/ctxtI_TABLE").caretPosition = 4
022MySession.findById("wnd[0]").sendVKey 0
023MySession.findById("wnd[0]/tbar[1]/btn[8]").press
024Wshell.run "c:\sciezka.vbs",1,false
025MySession.findById("wnd[0]/usr/btn%_I1_%_APP_%-VALU_PUSH").press
026MySession.findById("wnd[1]/tbar[0]/btn[23]").press
027MySession.findById("wnd[1]/tbar[0]/btn[8]").press
028

sciezka.vbs:

set Wshell = CreateObject("Wscript.Shell")

Do

bWindowFound = Wshell.AppActivate("Open")

WScript.Sleep 1000

Loop Until bWindowFound

bWindowFound = Wshell.AppActivate("Open")

if (bWindowFound) Then

Wshell.appActivate "Open"

WScript.Sleep 100

Wshell.sendkeys "C:\materials.txt"

WScript.Sleep 100

Wshell.sendkeys ""

end if

Former Member
0 Kudos

Hi Jon -

this is how I call it from main module:

....

FileName = "C:\Tanks-MtceItem.txt"
Wshell.run"c:\tmp\TankLoad.vbs " & FileName,1,False
session.findById("wnd[0]/usr/btn%_WAPOS_%_APP_%-VALU_PUSH").press
session.findById("wnd[1]/tbar[0]/btn[23]").press
session.findById("wnd[1]/tbar[0]/btn[8]").press

 

...

 

and this is how my called routine 'TankLoad.vbs' looks like:

Dim FileNam2
Set Wshell = CreateObject("WScript.Shell")
Do
bWindowFound = Wshell.AppActivate("Open") 
WScript.Sleep1000
LoopUntil bWindowFound
bWindowFound = Wshell.AppActivate("Open") 
if (bWindowFound) Then
Wshell.appActivate"Open"
WScript.Sleep100
Wshell.sendkeys"{TAB}"
Wshell.sendkeys"{TAB}"
Wshell.sendkeys"{TAB}"
Wshell.sendkeys"{TAB}"
WScript.Sleep100
FileNam2 = WScript.Arguments.Item(0)  
'Wshell.sendkeys "c:\EQ2814.txt"
Wshell.sendkeys FileNam2
WScript.Sleep100
Wshell.sendkeys"{ENTER}"
WScript.Sleep100
endif

This works for me but you have to make sure you are not playing with the mouse, like clicking somewhere else, while script is running... also you'll notice the 4 TABs I have which make sure cursor goes to filename in the OPEN dialog.

The code I gave you above works well for me. I, however, had to play with the tab feeds until I got it to work the way I wanted.  You'll also notice I am passing on a filename (FileNam2) for the text file from the main routine, as an input parameter to the 2nd program.

Let me know if there are still problems.

Thanks
Umur

Former Member
0 Kudos

Thank you!

I think TAB could be it...I'll try.

Former Member
0 Kudos

I've just inserted 4x TAB and it works! Thank you.

I have only one, last problem...

VBS is 100%ok. But in SAP script when I change filepath to vbs script it doesn't work anymore (of course same files are placed in both locations):

[OK] Wshell.run "c:\script.vbs",1,false

[FALSE] Wshell.run "C:\File JS validator\Files\script.vbs",1,false

What is wrong? Maybe filepath shouldn't have any spaces?

Former Member
0 Kudos

I am thinking so - maybe you can try in a directory without spaces and see what it does. All the ones I used in my scripts have no spaces.

Former Member
0 Kudos

You can also try this.. it worked for me with spaces in filepath:

Wshell.run """C:\File JS validator\Files\script.vbs""",1,false

Former Member
0 Kudos

Hi Umur,

I used the exact code as per the TankLoad.vbs but it always fails to look for the file, would it have to do with the directory? I'm placing the txt file in the "C:\Temp\".

BTW I'm doing some automated reporting by running the MC.5 and try to import the Storage Location from a txt file store in the "C:\Temp\".

Appreciate your help in advance.

Best Regards,

Patrick

Former Member
0 Kudos

Hi Umur,

Got it to work with additional tab (5 tab needed for my case). BTW, is it possible to run all the code in VBA environment itself instead of execute the TankLoad.vbs separately from the main script?

I'm running this code in MS Excel environment.

Thanks.

Best Regards,

Patrick

Former Member
0 Kudos

Hi Patrick - Haven't tried running the whole thing from VBA as that was not my starting point. There might be someone out there who tried it and might offer some insight.

Regards

Umur

Former Member
0 Kudos

ScriptMan Thanks a lot for this very clever workaround!

ScriptMan is to SAP GUI Scripting, what Batman is to Gotham

Former Member
0 Kudos

Thanks Umur! I needed a few more tabs as well and a longer sleep time to make it work but it worked!

I also like your idea for sending the filename as a parameter to the script. Very useful for batch processing.

Former Member
0 Kudos

Patrick, IMO, I don't think so. Maybe someone else can clarify. But I think it's not possible because once you open the file dialog from VBA, the Excel environment seems to pause entirely, waiting for user input in the file dialog.

So an external script is needed to manipulate the dialog and close it so that Excel can continue with the VBA code.

Anyone, feel free to correct me if I'm wrong. This is just my guess.

script_man
Active Contributor
0 Kudos

Hi Sulaiman,

I thank you for your words of appreciation. I am pleased to read this workaround works still in more than 5 years.

And maybe the name is correct.   I step in appearance only when it gets hot.

@Umur : Many greetings also to Quebec!

Regards,

ScriptMan

Former Member
0 Kudos

hi Scriptman,

i need to get data from me1m transaction, for a material i will get cost details, in sap as shown in image,i need to get data from net price column, i don't know how to get cell address and so on and i don't know table name i don't have access to se16 transaction too, so can you provide help to get data from certain column using scripting.

thanks in advance

script_man
Active Contributor
0 Kudos

Hi Deepan,

normally you would have to open a new thread. This is very old and long since answered. But we turn a blind eye.

Unfortunately I have no access to the ME1M transaction. But you can read through the link below. Maybe you get ahead in the search for a solution.

Regards,

ScriptMan

Answers (0)