Skip to main content

SAP GUI SCRIPTING

This project offers an abstraction over the SAP GUI Scripting API, facilitating interaction with the SAP GUI system. It allows navigation among different SAP transactions and downloading and transforming information exported from these transactions.

Key Features:

  • Automated Logging: Performs records in SAP quickly and easily, minimizing the risk of manual errors.
  • Simplified Navigation: Enables agile movement between different SAP transactions, optimizing workflow.
  • Data Download and Transformation: Exports information from SAP and transforms it for use in other applications or analysis, facilitating data-driven decision-making.

Tabla de Contenidos

  1. Installation
  2. Basic Usage
  3. Recomendations
  4. Contribution
  5. License
  6. Contact

Installation

Remember create your 'venv'

python -m venv venv

venv/Scripts/Activate

pip list

python.exe -m pip install --upgrade pip

pip install sapgui

The second step is to use the following command if you see the library all is ok

pip list

>> ...
>> sapgui   version
>> ...

You are ready to use sap library, in your proyects

Use

The following example demonstrates the most basic and simple usage of this project. For more detailed documentation, please visit this link.

from sapgui import SapGui,Transaction,DataProcess
  • How open sap?

    sap_instance=SapGui(
        conection="our conection",
        user="user",
        password="password"
    )
    session=sap_instance.get_session()
    
  • Basic proccess in transaccion

    COOISPI=Transaction(
        session=session, # or sap_instance.get_session()
        code="COOISPI")
    COOISPI.start_transaction()
    COOISPI.select_variant(
        variant_author="USER",
        variant_name="VARIANT"
    )
    ...
    #COOISPI.session.FindById("id").text=""# example
    #COOISPI.session.FindById("id").press()# example2
    COOISPI.run_transaction()
    COLUMNS_NAMES=COOISPI.get_column_names()
    COOISPI.export_in_shell_or_grid()
    COOISPI.select_export_and_download(
        address=address,
        name="name_file"
    )
    
  • Data transformation

    DATA=DataProcess(
        address_file=os.path.join(address,"name_file.csv")
        ...
    )
    DATA.edit_file(
        generic_name_columns=COLUMNS_NAMES,
        ...
    )
    df=DATA.get_df()
    

Recomendations

The following recommendations are for interacting with SAP in Python development:

  • SAPGUI version

    A version of SAPGUI 770 or higher is required.

  • Scripting Tracker

    This tool helps identify all the elements (objects) we can interact with in each SAP session. You can download it from the official page using this link: Scripting Tracker. If you want more information about the tool, you can find it on the official SAP forum.

  • SAPGUI Accessibility - Scripting

    To interact with SAP in a more fluid and simple way, there are several settings that should be adjusted beforehand:

    • In the options tab:

    • Under Accessibility and Scripting --> Scripting --> enable the "Enable scripting" option and disable the other three options so that you don't get notified every time a script runs.

    Before going to the Accessibility tab and enabling the "Use accessibility mode" option, we need to change the SAP theme or visual style to "SAP Signature Theme." Once this is done, you can go back to Accessibility and Scripting --> Accessibility --> and enable the "Use accessibility mode" option.

  • SAPGUI Web API

    If you want to dive deeper into the attributes and methods available for each object in SAPGUI, you can check the documentation, which comes from the official SAP site.

Contribution

Thank you for your interest in contributing to this project! Here's how you can do it:

  • 1. Fork the Repository

    First, fork the repository by clicking the "Fork" button at the top of the repository page.

  • 2. Create a Branch

    Clone your fork to your local machine and then create a new branch for your work. Name your branch according to the feature or bug you're working on:

    git checkout -b your-branch-name
    
  • 3. Make Your Changes

    Make the changes you believe are necessary.

  • 4. Commit Your Changes

    Once you've made your changes, commit them with a clear description of what you've done:

     git add .
     git commit -m "Clear description of the changes"
    
  • 5. Push Your Branch

    Push your changes to the remote repository:

    git push origin your-branch-name
    
  • 6. Create a Pull Request

    Go to the original repository on GitHub and click the "New Pull Request" button. Clearly explain the changes you've made and why they should be merged.

License

  • MIT License

Contact

If you have any questions, suggestions, or feedback, feel free to contact us:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sap-gui-library-0.1.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sap_gui_library-0.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file sap-gui-library-0.1.0.tar.gz.

File metadata

  • Download URL: sap-gui-library-0.1.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.8

File hashes

Hashes for sap-gui-library-0.1.0.tar.gz
Algorithm Hash digest
SHA256 303b9115aabd99368047129591611726546a6effe5c2579315f1d42b03de21cf
MD5 0d71d5a01a2f5745d36b8b956881a553
BLAKE2b-256 6f2a2dad7c6385c812db193dde4b22a162ab95b1e937b17b8f5273210f15ac91

See more details on using hashes here.

File details

Details for the file sap_gui_library-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sap_gui_library-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b95f787c8a89ff5e6d43dd3a22ce1e157980ad3f9b60273a315ea00a6561baf1
MD5 47790aeb5a8b6aa2ab9fdd89aabd9876
BLAKE2b-256 28450123e8ec0d777dcad0e37f8ba69890e83bd4c0098c26656022914e02a8cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page