Example #1
0
    def __set_auth_filter(session, rsusr002_filter):
        SAPGuiElements.select_element(session, PRIVILEGE_TAB)

        for i, auth in enumerate(rsusr002_filter.auth_objects):
            if i >= MAX_AUTH_OBJECTS:
                break

            SAPGuiElements.try_to_set_text(
                session, AUTH_OBJECT_TEMPLATE.format(type="{type}", num=i + 1),
                auth.name)
            SAPGuiElements.press_keyboard_keys(session, "Enter")

            for k in range(0, 10):
                try:
                    text = SAPGuiElements.get_text(
                        session, FIELD_NAME_TEMPLATE.format(num=i + 1, num1=k))
                except AttributeError:
                    break
                else:
                    values = auth.get_values_for_field(text)

                    if not values or len(values) == 0:
                        continue

                    for j, value in enumerate(values):
                        if j >= MAX_AUTH_VALUES:
                            break
                        SAPGuiElements.try_to_set_text(
                            session,
                            AUTH_VALUES_TEMPLATE.format(type="{type}",
                                                        num=i + 1,
                                                        num1=k,
                                                        num2=j + 1), value)
Example #2
0
 def is_already_logon_window(sap_session):
     try:
         select = SAPGuiElements.get_element(sap_session, MULTI_USER_DISCONNECT)
     except AttributeError:
         pass
     else:
         SAPGuiElements.select_element(sap_session, select.id)
         SAPGuiElements.press_keyboard_keys(sap_session, "Enter", pysapgui.sapgui.GUI_CHILD_WINDOW1)
Example #3
0
 def save_to_file(self, sap_session=None):
     if not sap_session:
         sap_session = self.sap_session
     SAPGuiElements.press_keyboard_keys(sap_session, "Ctrl+Shift+F9")
     if self.file_format == 'html':
         SAPGuiElements.select_element(sap_session, HTML_FORMAT)
     filename = self.__get_filename()
     SAPGuiElements.press_button(sap_session, CONFIRM_FORMAT_BUTTON)
     SAPGuiElements.set_text(sap_session, PATH_TEXT_FIELD, self.report_dir)
     SAPGuiElements.set_text(sap_session, FILENAME_TEXT_FIELD, filename)
     SAPGuiElements.press_button(sap_session, REPLACE_BUTTON)
     self.__del_gif_files()
     return filename
Example #4
0
    def get_row_number_by_filter(self, sap_session, rsusr002_filter):
        if not sap_session:
            sap_session = self.sap_session
        self.start_report(sap_session)

        SAPGuiElements.select_element(sap_session, LOGON_TAB)
        if rsusr002_filter.active_users:
            self.__set_active_users_only(sap_session)

        if len(rsusr002_filter.filter_user_type):
            self.__set_filter_by_user_type(sap_session,
                                           rsusr002_filter.filter_user_type)

        if len(rsusr002_filter.auth_objects):
            self.__set_auth_filter(sap_session, rsusr002_filter)

        return self.__execute_and_return_entries_number(sap_session)
Example #5
0
    def set_filter(self, session):
        SAPGuiElements.press_keyboard_keys(session, "Shift+F4")
        if hasattr(self, "exclude_single_values"):
            if len(self.exclude_single_values):
                SAPGuiElements.select_element(session, EXCLUDE_VALUES)
                for i, item in enumerate(self.exclude_single_values):
                    if item == "":
                        SAPGuiElements.press_button(session, EXCLUDE_VALUES_BUTTON.format(i))
                        SAPGuiElements.press_button(session, OK_BUTTON_FILTER)
                    else:
                        SAPGuiElements.try_to_set_text(session, EXCLUDE_VALUES_TEMPLATE.format(type="{type}", row=i), item)

        if hasattr(self, "equal_single_values"):
            if len(self.equal_single_values):
                SAPGuiElements.select_element(session, INCLUDE_VALUES)
                for i, item in enumerate(self.equal_single_values):
                    if item == "":
                        SAPGuiElements.press_button(session, INCLUDE_VALUES_BUTTON.format(i))
                        SAPGuiElements.press_button(session, OK_BUTTON_FILTER)
                    else:
                        SAPGuiElements.try_to_set_text(session, INCLUDE_VALUES_TEMPLATE.format(type="{type}", row=i), item)

        SAPGuiElements.press_keyboard_keys(session, "F8")
Example #6
0
 def __set_active_users_only(session):
     SAPGuiElements.select_element(session, ACTIVE_USERS_ONLY)
Example #7
0
 def __set_se16_parameters(session):
     SAPGuiElements.call_menu(session, MENU_USER_PARAMETERS)
     SAPGuiElements.select_element(session, FIELD_NAME_SELECTION)
     SAPGuiElements.select_element(session, ALV_GRID_SELECTION)
     SAPGuiElements.press_keyboard_keys(session, "Enter", GUI_CHILD_WINDOW1)
     TCodeSE16.first_call = False