Example #1
0
    def enable_columns_to_filter(self, session):
        column_list = [filter1.field_name for filter1 in self.filters]
        if not len(column_list):
            return

        SAPGuiElements.call_menu(session, MENU_FIELDS_FOR_SELECTION)
        max_scroll = int(SAPGuiElements.get_max_scroll_position(session, GUI_CHILD_USER_AREA1))
        pos_scroll = 0
        startpos = 5
        do_cycle = True
        while do_cycle:
            SAPGuiElements.set_scroll_position(session, pos_scroll, GUI_CHILD_USER_AREA1)
            max_i = 0
            for i, element in SAPGuiElements.iter_elements_by_template(session,
                                                                 GUI_CHILD_USER_AREA1,
                                                                 "wnd[1]/usr/lbl[4,{0}]",
                                                                 startpos):
                max_i = i
                if element.text in column_list:
                    SAPGuiElements.set_checkbox(session, "wnd[1]/usr/chk[2,{0}]".format(i))
            if pos_scroll < max_scroll:
                new_pos_scroll = min(pos_scroll + max_i, max_scroll)
                startpos = max_i - (new_pos_scroll - pos_scroll) + 1
                pos_scroll = new_pos_scroll
            else:
                do_cycle = False

        SAPGuiElements.press_keyboard_keys(session, "Enter", GUI_CHILD_WINDOW1)
Example #2
0
    def set_filter_value(self, session):
        if not len(self.filters):
            return

        columnlist = [filter1.field_name for filter1 in self.filters]

        startpos = 1
        for i, element in SAPGuiElements.iter_elements_by_template(session,
                                                             GUI_MAIN_WINDOW,
                                                             "wnd[0]/usr/txt%_I{0}_%_APP_%-TEXT",
                                                             startpos):
            element_text = element.text
            if element_text in columnlist:
                element_id = element.id
                button_id = element_id.replace("txt", "btn").replace("-TEXT", "-VALU_PUSH")
                SAPGuiElements.press_button(session, button_id)
                field_filter = self.get_filter_by_field_name(element_text)
                field_filter.set_filter(session)