on 06-28-2011 12:37 PM
Iam trying to capture a ALV grid fieldss using the scripting.
we have a ALV grid in my R/3 program and in that there are 2 date fields VALUTL and VALUTP with 2 rows. Now if the date is blank in any of the field then value that exist in the corresponding field should be copeid.
Do i need to loop the grid values ?
Could any one you help me in corecting the below code.
session.findById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell").modifyCell 0,"VALUTP","19.04.2011"
session.findById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell").modifyCell 0,"VALUTL","06.06.2011"
session.findById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell").currentCellColumn = ""
session.findById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell").selectedRows = "0"
session.findById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell").pressToolbarButton "UPDA"
Thanks,
Iam missing something in the below code.Not able to update the date in the feild that was empty.Could some check
Set GRID = session.findById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell")
RowCT = GRID.RowCount
For Row = 0 To RowCT - 1
GRID.setCurrentCell Row, "VALUTL"
GRID.selectedRows = CStr(Row)
cell = GRID.getcellvalue(Row, "VALUTL")
cell1 = GRID.getcellvalue(Row, "VALUTP")
If cell <> "" And cell1 <> "" Then
GoTo 50
End If
Next
50 For Row = 0 To RowCT - 1
GRID.setCurrentCell Row, "VALUTL"
GRID.selectedRows = CStr(Row)
valu = GRID.getcellvalue(Row, "VALUTL")
valp = GRID.getcellvalue(Row, "VALUTP")
If valu = "" Then
session.findById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell").modifyCell Row, "VALUTL", cell
session.findById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell").pressToolbarButton "UPDA"
session.findById("wnd[1]/tbar[0]/btn[0]").press
ElseIf valp = "" Then
session.findById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell").modifyCell Row, "VALUTP", cell1
session.findById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell").pressToolbarButton "UPDA"
session.findById("wnd[1]/tbar[0]/btn[0]").press
ElseIf RowCT = GRID.RowCount Then
'session.findById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell").pressToolbarButton "UPDA"
'session.findById("wnd[1]/tbar[0]/btn[0]").press
End If
Next
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Below is the code that will work.
Set grid = session.FindById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell")
rowct = grid.RowCount
For Row = 0 To rowct - 1
grid.setCurrentCell Row, "VALUTL"
grid.selectedRows = CStr(Row)
cell = grid.getcellvalue(Row, "VALUTL")
cell1 = grid.getcellvalue(Row, "VALUTP")
If cell <> "" And cell1 <> "" Then
GoTo 50
End If
Next
50 For Row = 0 To rowct - 1
grid.setCurrentCell Row, "VALUTL"
grid.selectedRows = CStr(Row)
valu = grid.getcellvalue(Row, "VALUTL")
valp = grid.getcellvalue(Row, "VALUTP")
If valu = "" Then
session.FindById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell").modifyCell Row, "VALUTL", cell
ElseIf valp = "" Then
session.FindById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell").modifyCell Row, "VALUTP", cell1
End If
Next
session.FindById("wnd[0]/usr/cntlSCREEN_9001/shellcont/shell").pressToolbarButton "UPDA"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.