Micro Focus QTP (UFT) Forums

Full Version: Using SAPGuiTable).SetCellData to Active cell.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Using an SAPGuiTable where my code sets the cell that the data needs to go in, however .SetCellData r, "Char. Value",CharVal  "r" is a value set when iterating a DataTable and does not always much the same row that maybe needed in the SAPGuiTable.  Is there a way to SetCellData to the active cell?  or do I need to harvest what the current location is, set it to "r"?  Looking for some guidance on how to do this.  Please advise and thanks.

Code:
    ConFigList = Datatable.GetSheet("ConFig").GetRowCount
    For r = 1 To ConFigList
        Datatable.GetSheet("ConFig").SetCurrentRow(r)
        CharDes = Datatable.Value("Chardescription","ConFig")
        CharVal = Datatable.Value("CharValue","ConFig")
        SAPGuiSession("Session").SAPGuiWindow("Create Corrections Order:_2").SAPGuiButton("Find Char.").Click 'Find dynamically finds the row I need.
        SAPGuiSession("Session").SAPGuiWindow("Position on Characteristc").SAPGuiEdit("Characteristic").Set CharDes
        SAPGuiSession("Session").SAPGuiWindow("Position on Characteristc").SAPGuiEdit("Maximum Number of Hits:").Set "1"
        SAPGuiSession("Session").SAPGuiWindow("Position on Characteristc").SAPGuiButton("Continue   (Enter)").Click
        SAPGuiSession("Session").SAPGuiWindow("Create Corrections Order:_2").SAPGuiTable("SAPLCEI0CHARACTER_VALUES").SetCellData r,"Char. Value",CharVal
        ' r is the row that is in the DataTable, but not the row that was choosen in the Find Char.
        SAPGuiSession("Session").SAPGuiWindow("Create Corrections Order:_2").SendKey ENTER
    Next
(02-10-2020, 01:16 AM)rhozeski Wrote: [ -> ]Using an SAPGuiTable where my code sets the cell that the data needs to go in, however .SetCellData r, "Char. Value",CharVal  "r" is a value set when iterating a DataTable and does not always much the same row that maybe needed in the SAPGuiTable.  Is there a way to SetCellData to the active cell?  or do I need to harvest what the current location is, set it to "r"?  Looking for some guidance on how to do this.  Please advise and thanks.

Code:
    ConFigList = Datatable.GetSheet("ConFig").GetRowCount
    For r = 1 To ConFigList
        Datatable.GetSheet("ConFig").SetCurrentRow(r)
        CharDes = Datatable.Value("Chardescription","ConFig")
        CharVal = Datatable.Value("CharValue","ConFig")
        SAPGuiSession("Session").SAPGuiWindow("Create Corrections Order:_2").SAPGuiButton("Find Char.").Click 'Find dynamically finds the row I need.
        SAPGuiSession("Session").SAPGuiWindow("Position on Characteristc").SAPGuiEdit("Characteristic").Set CharDes
        SAPGuiSession("Session").SAPGuiWindow("Position on Characteristc").SAPGuiEdit("Maximum Number of Hits:").Set "1"
        SAPGuiSession("Session").SAPGuiWindow("Position on Characteristc").SAPGuiButton("Continue   (Enter)").Click
        SAPGuiSession("Session").SAPGuiWindow("Create Corrections Order:_2").SAPGuiTable("SAPLCEI0CHARACTER_VALUES").SetCellData r,"Char. Value",CharVal
        ' r is the row that is in the DataTable, but not the row that was choosen in the Find Char.
        SAPGuiSession("Session").SAPGuiWindow("Create Corrections Order:_2").SendKey ENTER
    Next
I sort of got this to work, but woow, it took an hour + to iterate thru 250+ CharDes and place ClarVals. Appeared to go thru the whole list of 250+ chars each time. Is there an easier way to get the row (w) and goto it? place the value, Next. This process not going to work if 700+ global iterations are needed, and it has to go thru this each time.

not seeing the [code] button for reply??

For r = 1 To ConFigList
Datatable.GetSheet("ConFig").SetCurrentRow®
CharDes = Datatable.Value("Chardescription","ConFig")
CharVal = Datatable.Value("CharValue","ConFig")
SAPGuiSession("Session").SAPGuiWindow("Create Corrections Order:_2").SAPGuiButton("Find Char.").Click 'Find dynamically finds the row I need.
SAPGuiSession("Session").SAPGuiWindow("Position on Characteristc").SAPGuiEdit("Characteristic").Set CharDes
SAPGuiSession("Session").SAPGuiWindow("Position on Characteristc").SAPGuiEdit("Maximum Number of Hits:").Set "1"
SAPGuiSession("Session").SAPGuiWindow("Position on Characteristc").SAPGuiButton("Continue (Enter)").Click
'Can not use "r", need to use the current row or active cell.
'***************************************
w=SAPGuiSession("Session").SAPGuiWindow("Create Corrections Order:_2").SAPGuiTable("SAPLCEI0CHARACTER_VALUES").FindRowByCellContent("Char. description",CharDes)
SAPGuiSession("Session").SAPGuiWindow("Create Corrections Order:_2").SAPGuiTable("SAPLCEI0CHARACTER_VALUES").SetCellData w,"Char. Value",CharVal
'***************************************
SAPGuiSession("Session").SAPGuiWindow("Create Corrections Order:_2").SendKey ENTER
Next