sap_functions
Library with utility classes and functions to facilitate the development of SAP automations in python.
This module is built on top of SAP Scripting and aims to making the development of automated workflows easier and quicker.
User-oriented documentation, including installation, examples, and API guides, is available in the documentation vault. It can be opened directly as an Obsidian vault.
Implementation example
from sap_functions import SAP
sap = SAP()
sap.select_transaction("COOIS")
This script:
Checks for existant SAP GUI instances. Connects to that instance. Write "COOIS" in the transaction field.
Classes overview
Module src.sap_functions.base_sap_connection
Class BaseSapConnection
Methods:
__init__(self, window: int = 0): Initialize self. See help(type(self)) for accurate signature.
Module src.sap_functions.grid
Class Grid
Methods:
__init__(self, grid_obj: SAPGridView, session: SAPGuiSession): Initialize self. See help(type(self)) for accurate signature.click_cell(self, index: int, column_id: str) -> None: This function will select and double-click in a SAP Grid cellcount_rows(self) -> int: This function will count all the rows in the current Gridget_cell_value(self, index: int, column_id: str) -> str: Get the value of a specific Grid cellget_column_id(self, column_name: str) -> str: This function will return the column id based on its column nameget_columns(self, *column_id: str) -> Union: Return each column contentget_content(self) -> Dict: Store all the content from a SAP Grid, the data will be stored and returned in a dictionary with 'header' andget_grid_columns(self, *column_id: str) -> Union: Deprecated: useGrid.get_columnsinstead.get_grid_content(self) -> Dict: Deprecated: useGrid.get_contentinstead.get_grid_row(self, row: int) -> list: Deprecated: useGrid.get_rowinstead.get_row(self, row: int) -> list: Get a grid row contentopen_cell_modal(self, index: int, column_id: str) -> None: This function will select and open a cell modal in a SAP Grid cellpress_button(self, field_name: str, skip_error: bool = False) -> None: This function will press any button in the SAP Grid componentpress_nested_button(self, *nested_fields: str, skip_error: bool = False) -> None: This function needs to receive several strings that have the texts that appear written in the button destinationselect_all_content(self) -> None: Select all the table, using the SAP native function to select all itemsselect_column(self, column_id: str) -> None: Select a specific columnselect_layout(self, layout: str) -> None: This function will select the desired Grid Layout when a SAP select Layout Pop up is open
Module src.sap_functions.label
Class Label
Methods:
__init__(self, session: SAPGuiSession, window: int = 0): Initialize self. See help(type(self)) for accurate signature.get_all_screen_labels(self) -> list: This function will return each label row in the SAP Screenget_content(self) -> Dict: Store all the content from a SAP Label, the data will be stored and returned in a dictionary withget_label_content(self) -> Dict: Deprecated: useLabel.get_contentinstead.
Module src.sap_functions.node
Class Node
Methods:
__init__(self, node_obj: CDispatch): Initialize self. See help(type(self)) for accurate signature.click_selected_node(self): Double-click the Node selected previouslyexpand_selected_node(self): Expand the Node selected previouslyget_content(self) -> list: Get all Nodes names in a list formatget_node_content(self) -> list: Deprecated: useNode.get_contentinstead.select_node(self, node_text: str, target_index: int = 0, skip_error: bool = False): Select a specific Node based on the text inside of it
Module src.sap_functions.sap
Class SAP
Methods:
__init__(self, window: int = 0) -> None: Initialize self. See help(type(self)) for accurate signature.change_active_tab(self, selected_tab: Union, skip_error: bool = False) -> None: This function will try to select the transaction tab using the number "selected_tab"choose_text_combo(self, field_name: str, desired_text: str, target_index: int = 0, selected_tab: Union = 0, skip_error: bool = False) -> None: This function has the ability to choose a specific text that is found within a combo box componentclean_all_fields(self, selected_tab: Union = 0, skip_error = False) -> None: Clean all the input fields in the actual screenfind_text_field(self, field_name: str, selected_tab: Union = 0) -> bool: Verify if a text exists in the SAP screenflag_field(self, field_name: str, desired_operator: bool, target_index: int = 0, selected_tab: Union = 0, skip_error: bool = False) -> None: This function can flag and unflag checkboxes based on the field_name, it will flag/unflag the checkbox in theflag_field_at_side(self, field_name: str, desired_operator: bool, side_index: int = 0, target_index: int = 0, selected_tab: Union = 0, skip_error: bool = False) -> None: This function can flag and unflag checkboxes based on the field_name, it will flag/unflag the checkbox at theget_footer_message(self) -> str: Get the message text that is in the SAP Footerget_grid(self, target_index: int = 0) -> Grid: Get the SAP Grid object from the current SAP Grid Windowget_label(self) -> Label: Get the SAP Label object from the current SAP Label Windowget_node(self, target_index: int = 0) -> Node: Get the SAP Node object from the current SAP Node Windowget_table(self, target_index: int = 0) -> Table: Get the SAP Table object from the current SAP Table Windowget_text_at_side(self, field_name, side_index: int, target_index: int = 0, selected_tab: Union = 0) -> str: This function will return the text next to the text received as a parameterget_tree(self) -> Tree: Get the SAP Tree object from the current SAP Tree Windowinsert_variant(self, variant_name: str, skip_error: bool = False) -> None: This function will try to press the "Get Variant" button in the transaction, after that it will overwrite themultiple_selection_field(self, field_name: str, target_index: int = 0, selected_tab: Union = 0, skip_error: bool = False) -> None: This function will press the "Multiple Selection" button in the respective fieldmultiple_selection_paste_data(self, data: list, delete_values: bool = False, skip_error: bool = False) -> None: With the Multiple Selection window open, it's possible to execute this function to easily paste all the datanavigate_into_menu_header(self, *nested_path: str) -> None: This function needs to receive several strings that have the texts that appear written in the header destinationopen_focused_field_modal(self): This function will open the modal of a focused fieldoption_field(self, field_name: str, target_index: int = 0, selected_tab: Union = 0, skip_error: bool = False) -> None: This function will select an option fieldoption_field_at_side(self, field_name: str, side_index: int = 0, target_index: int = 0, selected_tab: Union = 0, skip_error: bool = False) -> None: This function will select an option fieldpress_button(self, field_name: str, target_index: int = 0, selected_tab: Union = 0, skip_error: bool = False) -> None: Press any button in the SAP screens, except in shells and tables componentsrun_actual_transaction(self, skip_error: bool = False) -> None: Run the active transaction, this function will try to press Enter, and after that will try to press F8save_file(self, file_name: str, path: str, option: int = 0, type_of_file: str = 'txt', skip_error: bool = False) -> None: This function will easily navigate into SAP menu header to save the current transaction data, commonly used toselect_main_screen(self, skip_error: bool = False) -> None: Navigate to the SAP main Screenselect_transaction(self, transaction: str) -> None: Navigate to a transaction in SAP GUIset_focus(self, field_name, side_index: int = 0, target_index: int = 0, selected_tab: Union = 0): This function will select/focus in the field with the text received as a parameterwrite_text_field(self, field_name: str, desired_text: str, target_index: int = 0, selected_tab: Union = 0, skip_error: bool = False) -> None: This function will write the desired text in the respective input at the side of the field namewrite_text_field_until(self, field_name: str, desired_text: str, target_index: int = 0, selected_tab: Union = 0, skip_error: bool = False) -> None: This function will write the desired text in the "until" field in the respective input at the side of the
Module src.sap_functions.session
Class GuiComponent
Methods:
Select(self) -> None:__annotate__(format):__getitem__(self, index: int) -> GuiComponent:__iter__(self) -> Iterator:change(self) -> None:clickCurrentCell(self):containerType(self) -> str:press(self) -> None:sendVKey(self, key: int) -> None:setFocus(self) -> None:visualize(self) -> None:
Class SAPGridView
Methods:
__annotate__(format):clearSelection(self) -> None: Calling clearSelection removes all row, column and cell selectionsclickCurrentCell(self) -> None: This function emulates a mouse click on the current cellcontextMenu(self) -> None: Calling contextMenu emulates the context menu requestdoubleClickCurrentCell(self) -> None: This function emulates a mouse double click on the current cellgetCellValue(self, row: int, column: str) -> str: Returns the value of the cell as a stringselectAll(self) -> None: This function selects the whole grid content (i.e. all rows and all columns).selectColumn(self, column: str) -> None: This function adds the specified column to the collection of the selected columnsselectContextMenuItem(self, item: str) -> None: Select an item from the control’s context menusetCurrentCell(self, row: int, column: str) -> None: If row and column identify a valid cell, this cell becomes the current cell. Otherwise, an exception is raised.
Class SAPGuiFrameWindow
Methods:
__annotate__(format):close(self) -> None: The function attempts to close the window. Trying to close the last main window of a session will not succeed immediately; the dialog ‘Do you really want to log off?’ will be displayed first
Class SAPGuiInfo
Methods:
__annotate__(format):
Class SAPGuiScrollbar
Methods:
__annotate__(format):
Class SAPGuiSession
Methods:
CreateSession(self) -> None:EndTransaction(self) -> None:__annotate__(format):findById(self, identifier: str) -> GuiComponent:startTransaction(self, transaction: str) -> None:
Module src.sap_functions.table
Class Table
Methods:
__init__(self, table_obj: CDispatch, session: SAPGuiSession, target_index: int, window: int = 0): Initialize self. See help(type(self)) for accurate signature._return_table(self):click_cell(self, row: int, column: int, skip_error: bool = False) -> None: Focus in a cell and double-click in it, using the relative visible table row. The desired cell needs to becount_visible_rows(self, skip_error: bool = False) -> int: Count all the visible rows from a SAP Tableflag_cell(self, row: int, column: int, desired_operator: bool, skip_error: bool = False) -> None: Flags a checkbox in a SAP Table cell, using the relative visible table row. The desired cell needs to beget_cell_value(self, row: int, column: int, skip_error: bool = False) -> str: Return the content of a SAP Table cell, using the relative visible table row. The desired cell needs to beget_columns(self, *column_text: str, skip_error: bool = False) -> Union: Return each column contentget_content(self, skip_error: bool = False) -> Dict: Store all the content from a SAP Table, the data will be stored and returned in a dictionary with 'header' andget_table_content(self, skip_error: bool = False) -> Dict: Deprecated: useTable.get_contentinstead.select_entire_row(self, absolute_row: int, skip_error: bool = False) -> None: Select the entire row from a SAP Table, it uses the absolute table row. The desired cell needs to beunselect_entire_row(self, absolute_row: int, skip_error: bool = False) -> None: Unselect the entire row from a SAP Table, it uses the absolute table row. The desired cell needs to bewrite_cell_value(self, row: int, column: int, desired_text: str, skip_error: bool = False) -> None: Write any value in a SAP Table cell, using the relative visible table row. The desired cell needs to be
Module src.sap_functions.tree
Class Tree
Methods:
__init__(self, tree_obj: CDispatch): Initialize self. See help(type(self)) for accurate signature.get_columns(self, *column_text: str) -> Union: Return each column contentget_content(self, skip_error: bool = False) -> Dict: Store all the content from a SAP Tree, the data will be stored and returned in a dictionary with 'header' andget_tree_columns(self, *column_text: str) -> Union: Deprecated: useTree.get_columnsinstead.get_tree_content(self, skip_error: bool = False) -> Dict: Deprecated: useTree.get_contentinstead.
Module src.sap_functions.utils
Top-level Functions
active_window(sap) -> int:count_and_create_sap_screens(connection: CDispatch, window: int):generic_conditionals(sap, index: int, children: CDispatch, objective: str) -> bool:get_sap_connection() -> CDispatch:scroll_through_fields(sap, extension: str, objective: str) -> bool:scroll_through_grid(sap, extension: str) -> Union:scroll_through_node(sap, extension: str) -> Union:scroll_through_table(sap, extension: str) -> Union:scroll_through_tabs_by_id(sap, area: GuiComponent, extension: str, selected_tab: int) -> GuiComponent:scroll_through_tabs_by_name(sap, area: GuiComponent, extension: str, tab_name: str) -> GuiComponent:scroll_through_tree(sap, extension: str) -> Union:
Metadata
Release files for sap-functions 1.3.5.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sap_functions-1.3.5.5.tar.gz | 39.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sap_functions-1.3.5.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 62.3 kB
Release files / sap_functions-1.3.5.5.tar.gz
| Download URL | sap_functions-1.3.5.5.tar.gz |
|---|---|
| Size | 39.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54735c805fd4fe58eaef16bb375b4fe5f6a12b72ef7d93bce99ded641d76bbd2
|
|
BLAKE2b-256 checksum How to use checksums |
d2caf379eaa08120a4214ae03fd3dccddfcc5498117d041dd4f43b7c1e2c3ac4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / sap_functions-1.3.5.5-py3-none-any.whl
| Download URL | sap_functions-1.3.5.5-py3-none-any.whl |
|---|---|
| Size | 22.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7dfae85c0405ab48690772be4eb684ff1a7d119f610c44fe2b562b396d467f2f
|
|
BLAKE2b-256 checksum How to use checksums |
5e03182d2191fb075e31d059f8b249253bc82d62d973781c55a034b2868e6366
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logSecurity for sap-functions 1.3.5.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for sap_functions-1.3.5.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.