Skip to Content
0

SAP Script

May 24, 2017 at 08:27 PM

99

avatar image
Former Member

I'm currently trying to copy cell values from a table in SAP and pasting it to a text document.

Can someone please help me with the following error:

Object does not support method getcellvalue

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 fso = CreateObject("Scripting.FileSystemObject")


Set TextFile = fso.CreateTextFile("C:\Users\m313501\Desktop\Conc.txt",True)






For ROW = 0 To 10


CELL = session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB03/ssubSUB_GROUP_20:SAPLIQS0:7125/tblSAPLIQS0MASSNAH_VIEWER2/txtVIQMSM-QSMNUM[ROW,ROW]").GetCellValue(ROW,ROW)


TextFile.WriteLine CELL


Next
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Script Man May 26, 2017 at 10:03 AM
0

Hi Billy,

if this is really a table, it should look like this.

for example:

CELL = session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB03/ssubSUB_GROUP_20:SAPLIQS0:7125/tblSAPLIQS0MASSNAH_VIEWER2/txtVIQMSM-QSMNUM[2," & cstr(ROW) & "]").text

The column number is permanently set to 2. If this is also to be variable, it looks as follows:

CELL = session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB03/ssubSUB_GROUP_20:SAPLIQS0:7125/tblSAPLIQS0MASSNAH_VIEWER2/txtVIQMSM-QSMNUM[" & cstr(COL) & "," & cstr(ROW) & "]").text

The method getcellvalue is used with an ALV-GRID.

Regards,

ScriptMan

Share
10 |10000 characters needed characters left characters exceeded