Sap code issue

Shweta

Active Member
Hello

Can someone please help on below query.

I am using below line of code :
I have declared SapGuiObject also.
SapGuiAuto = GetObject("SAPGUI")

But getting error: GetObject is not declared.it may not be accessible due to protection level.

Please help.
 

Shweta

Active Member
Please let me know if need to give anything in inputs/outputs?
I have declared it as:
dim SapGuiAuto As Object
 
Please let me know if need to give anything in inputs/outputs?
I have declared it as:
dim SapGuiAuto As Object
I had the same issue and your suggestion really helped.

However, I am facing another issue. The object initialize tab is equal to image you posted.

I am trying to extract a table from SAP but it returns the following error:
Code:
"Internal : Exception: Object reference not set to an instance of an object."

The code I'm invoking is:
Code:
Dim SapGuiAuto As Object
Dim application As Object
Dim connection As Object
Dim session As Object
Dim Grid As Object

SapGuiAuto = GetObject("SAPGUI")
application = SapGuiAuto.GetScriptingEngine
connection = application.Children(0)
session = connection.Children(0)

session.findById("wnd[0]").maximize
Grid = session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0010/subSUB2:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1211/tblSAPLMEGUITC_1211").selectAllColumns

Columns = Grid.GetColumnPosition("PLNT")
SAP_Plant = Grid.GetCellValue(0, "PLNT")

The code should return as output the 'SAP_Plant' value.

Can you please tell what's missing?

Many thanks!
 
Top