I need to get the values from a SAP grid into vb.net.
session.FindById("wnd[0]/usr/ctxtCN_PROJN-LOW").Text = "Pxxxxxxx"
session.FindById("wnd[0]").SendVKey(0)
session.FindById("wnd[0]/usr/ctxtCN_NETNR-LOW").Text = 9999999
session.FindById("wnd[0]/usr/ctxtCN_NETNR-LOW").SetFocus
session.FindById("wnd[0]/usr/ctxtCN_NETNR-LOW").CaretPosition = 7
session.FindById("wnd[0]/usr/ctxtP_DISVAR").Text = "/MJ CN53N"
session.FindById("wnd[0]").SendVKey(0)
session.FindById("wnd[0]/tbar[1]/btn[8]").press
session.FindById("wnd[0]/usr/cntlALVCONTAINER/shellcont/shell").CurrentCellColumn = "LST_ACTDT"
session.FindById("wnd[0]/usr/cntlALVCONTAINER/shellcont/shell") 'This line refers to a following grid

I need to access the schd date if Activity = DAFC , Iève been trying every which way for the past week with NO success.
Yet in VBA access I simply do gridview = session.FindById("wnd[0]/usr/cntlALVCONTAINER/shellcont/shell")
Does anyone have a hint as to where I can look ?
So far I've tried setting this at the start.
Public Property GridView2 As GridView
then GridView2 = session.FindById("wnd[0]/usr/cntlALVCONTAINER/shellcont/shell")
But this method gives System.InvalidCastException: 'Unable to cast COM object of type 'System.__ComObject' to class type
Then I tried to create a gridview on the form and create all the fields.
GridView1 = session.findById("wnd[0]/usr/cntlALVCONTAINER/shellcont/shell")
But I also get System.InvalidCastException: 'Unable to cast COM object of type 'System.__ComObject' to class type
And I also tried to get the value individually
Dim i As Integer
Dim dstr As String
For i = 0 To 3
dstr = session.FindById("wnd[0]/usr/cntlALVCONTAINER/shellcont/shell").GetCellValue(i, "VORNR") ' dt.Rows.Add(dr)
Next i
And it says dstr is not declared!Does anyone have a hint as to where I can look ?
Pete
Request clarification before answering.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.