pyrfc-read


Namepyrfc-read JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/amarvin/pyrfc-read
SummaryRead data from SAP R/3 Systems
upload_time2024-12-02 17:08:00
maintainerNone
docs_urlNone
authorAlex Marvin
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements pyrfc
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyrfc-read

<p align="center">
    <em>Query table data from SAP R/3 Systems</em>
</p>

[![PyPI Latest Release](https://img.shields.io/pypi/v/pyrfc-read.svg)](https://pypi.org/project/pyrfc-read/)
[![PyPI downloads](https://static.pepy.tech/badge/pyrfc-read)](https://pepy.tech/project/pyrfc-read)
[![License](https://img.shields.io/github/license/amarvin/pyrfc-read)](https://github.com/amarvin/pyrfc-read/blob/main/LICENSE)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![codecov](https://codecov.io/gh/amarvin/pyrfc-read/branch/main/graph/badge.svg)](https://codecov.io/gh/amarvin/pyrfc-read)

## Install

```
pip install pyrfc-read
```

### Prerequisites

SAP NW RFC SDK must be installed (https://support.sap.com/nwrfcsdk).

## Demo

```py
from pyrfc_read import Connection

# Define credentials to the SAP R/3 System
#  many combinations of key-values will work here, and these are just an example
#  https://help.sap.com/doc/saphelp_nw74/7.4.16/de-DE/48/b0ff6b792d356be10000000a421937/frameset.htm
credentials = dict(
    ashost="hostname",
    sysnr="system_number",
    client="client",
    user="user",
    passwd="password",
    lang="EN",
)

# Open connection to the SAP R/3 System
with Connection(**credentials) as conn:
    # Confirm connection active by having SAP echo a message
    message = "Hello world!"
    response = conn.echo(message)

    # Get number of entries in table
    table = "T001"
    entries = conn.number_entries(table)

    # Get table description
    #  in any supported language by SAP Language Code
    #  https://help.sap.com/doc/saphelp_nw73ehp1/7.31.19/en-US/c1/ae563cd2ad4f0ce10000000a11402f/content.htm?no_cache=true
    description = conn.table_description(table, language="E")

    # Search tables by description
    description = "data that I need"
    tables = conn.find_tables_by_description(description, language="E")

    # Get table metadata about its fields
    field_info = conn.field_info(table, descriptions=True, language="E")

    # Read table data, only for select fields, matching where conditions
    fields = [
        "BUKRS",  # Company code
        "BUTXT",  # Name of company
    ]
    wheres = [
        "MANDT = 100",  # Client 100
        ["BUKRS", "in", ["0001", "0002", "0003"]],  # Only company codes 1, 2 and 3
    ]
    data = conn.query(
        table,
        fields,  # optional, but requesting less fields reduces load on SAP
        wheres,  # optional
        field_info=field_info,  # optional, but makes it faster if you already it
        batch_rows=1000,  # optional, handles batching rows to not exceed SAP's output limit
        chunk_rows=100,  # optional, handles chunking long wheres conditions to not exceed SAP's input limit
    )
```

## License

This project is licensed under the terms of the MIT license.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/amarvin/pyrfc-read",
    "name": "pyrfc-read",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Alex Marvin",
    "author_email": "alex.marvin@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c2/6c/76fcdff502adedddcb5e2c9380d19be6b9d59f47b79a582a61d8175515e6/pyrfc_read-1.0.2.tar.gz",
    "platform": null,
    "description": "# pyrfc-read\r\n\r\n<p align=\"center\">\r\n    <em>Query table data from SAP R/3 Systems</em>\r\n</p>\r\n\r\n[![PyPI Latest Release](https://img.shields.io/pypi/v/pyrfc-read.svg)](https://pypi.org/project/pyrfc-read/)\r\n[![PyPI downloads](https://static.pepy.tech/badge/pyrfc-read)](https://pepy.tech/project/pyrfc-read)\r\n[![License](https://img.shields.io/github/license/amarvin/pyrfc-read)](https://github.com/amarvin/pyrfc-read/blob/main/LICENSE)\r\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\r\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)\r\n[![codecov](https://codecov.io/gh/amarvin/pyrfc-read/branch/main/graph/badge.svg)](https://codecov.io/gh/amarvin/pyrfc-read)\r\n\r\n## Install\r\n\r\n```\r\npip install pyrfc-read\r\n```\r\n\r\n### Prerequisites\r\n\r\nSAP NW RFC SDK must be installed (https://support.sap.com/nwrfcsdk).\r\n\r\n## Demo\r\n\r\n```py\r\nfrom pyrfc_read import Connection\r\n\r\n# Define credentials to the SAP R/3 System\r\n#  many combinations of key-values will work here, and these are just an example\r\n#  https://help.sap.com/doc/saphelp_nw74/7.4.16/de-DE/48/b0ff6b792d356be10000000a421937/frameset.htm\r\ncredentials = dict(\r\n    ashost=\"hostname\",\r\n    sysnr=\"system_number\",\r\n    client=\"client\",\r\n    user=\"user\",\r\n    passwd=\"password\",\r\n    lang=\"EN\",\r\n)\r\n\r\n# Open connection to the SAP R/3 System\r\nwith Connection(**credentials) as conn:\r\n    # Confirm connection active by having SAP echo a message\r\n    message = \"Hello world!\"\r\n    response = conn.echo(message)\r\n\r\n    # Get number of entries in table\r\n    table = \"T001\"\r\n    entries = conn.number_entries(table)\r\n\r\n    # Get table description\r\n    #  in any supported language by SAP Language Code\r\n    #  https://help.sap.com/doc/saphelp_nw73ehp1/7.31.19/en-US/c1/ae563cd2ad4f0ce10000000a11402f/content.htm?no_cache=true\r\n    description = conn.table_description(table, language=\"E\")\r\n\r\n    # Search tables by description\r\n    description = \"data that I need\"\r\n    tables = conn.find_tables_by_description(description, language=\"E\")\r\n\r\n    # Get table metadata about its fields\r\n    field_info = conn.field_info(table, descriptions=True, language=\"E\")\r\n\r\n    # Read table data, only for select fields, matching where conditions\r\n    fields = [\r\n        \"BUKRS\",  # Company code\r\n        \"BUTXT\",  # Name of company\r\n    ]\r\n    wheres = [\r\n        \"MANDT = 100\",  # Client 100\r\n        [\"BUKRS\", \"in\", [\"0001\", \"0002\", \"0003\"]],  # Only company codes 1, 2 and 3\r\n    ]\r\n    data = conn.query(\r\n        table,\r\n        fields,  # optional, but requesting less fields reduces load on SAP\r\n        wheres,  # optional\r\n        field_info=field_info,  # optional, but makes it faster if you already it\r\n        batch_rows=1000,  # optional, handles batching rows to not exceed SAP's output limit\r\n        chunk_rows=100,  # optional, handles chunking long wheres conditions to not exceed SAP's input limit\r\n    )\r\n```\r\n\r\n## License\r\n\r\nThis project is licensed under the terms of the MIT license.\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Read data from SAP R/3 Systems",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/amarvin/pyrfc-read"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a76c46445070310b10394242794551163ab8a5ae719e420c1d89a192fbe7ba36",
                "md5": "f3eec0f3f34387294f6fec650fcadf7b",
                "sha256": "44a5bacceaacbea8bda5e4e5b2674459079745d409868af3bf09fbf133d99f8f"
            },
            "downloads": -1,
            "filename": "pyrfc_read-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f3eec0f3f34387294f6fec650fcadf7b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 9095,
            "upload_time": "2024-12-02T17:07:59",
            "upload_time_iso_8601": "2024-12-02T17:07:59.213813Z",
            "url": "https://files.pythonhosted.org/packages/a7/6c/46445070310b10394242794551163ab8a5ae719e420c1d89a192fbe7ba36/pyrfc_read-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c26c76fcdff502adedddcb5e2c9380d19be6b9d59f47b79a582a61d8175515e6",
                "md5": "7e162f86a72e1acdf2132bc91cb04208",
                "sha256": "dd7fe1ca7493913c8cef2ce1ea88e769e009bcebd8ad50cc1f8e5b6fc16ff964"
            },
            "downloads": -1,
            "filename": "pyrfc_read-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "7e162f86a72e1acdf2132bc91cb04208",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 11010,
            "upload_time": "2024-12-02T17:08:00",
            "upload_time_iso_8601": "2024-12-02T17:08:00.922294Z",
            "url": "https://files.pythonhosted.org/packages/c2/6c/76fcdff502adedddcb5e2c9380d19be6b9d59f47b79a582a61d8175515e6/pyrfc_read-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-02 17:08:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "amarvin",
    "github_project": "pyrfc-read",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pyrfc",
            "specs": [
                [
                    "==",
                    "3.3.1"
                ]
            ]
        }
    ],
    "lcname": "pyrfc-read"
}
        
Elapsed time: 1.62508s