Digital Exchange

selectContextMenuItem method returning "The method got an invalid argument"

  • 1.  selectContextMenuItem method returning "The method got an invalid argument"

    Posted 09-06-2019 21:01

    I'm trying to sort a table in SAP in Blue Prism. The code previously worked fine but now I'm getting a 'The method got an invalid argument' error when I try to sort the table by context menu item.

    I've tried passing a variety of values to the selectContextMenuItem method: '&SORT_DSC', '&SORT_ASC', '&COL_INV'...all yield the same error.

    Dim SAPGuiAuto as Object
    Dim SAPApp as Object
    Dim SAPCon as Object
    Dim session as Object
    Dim Table as Object
    
    SAPGuiAuto = Microsoft.VisualBasic.Interaction.GetObject('SAPGUI')
    SAPApp = SAPGuiAuto.GetScriptingEngine
    SAPCon = SAPApp.Children(0)
    session = SAPCon.Children(0)
    
    Table = session.findById('/app/con[0]/ses[0]/wnd[0]/usr/cntlGRID1/shellcont/shell')
    Table.setCurrentCell('-1', 'LMENGEIST')
    Table.selectColumn('LMENGEIST')
    Table.contextMenu
    Table.selectContextMenuItem('&SORT_DSC')
    

    I expect the column I've selected to be sorted in descending order.

    Thanks in advance for any help you can provide.

    --------------------------------------------------
    Disclaimer: This content was auto-posted from Stackoverflow. The original Stackoverflow question is here Stackoverflow Post, posted by Kevin.