Read data from SAP R/3 Systems
Project description
pyrfc-read
Query table data from SAP R/3 Systems
Install
pip install pyrfc-read
Prerequisites
SAP NW RFC SDK must be installed (https://support.sap.com/nwrfcsdk).
Demo
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyrfc_read-1.0.2.tar.gz.
File metadata
- Download URL: pyrfc_read-1.0.2.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd7fe1ca7493913c8cef2ce1ea88e769e009bcebd8ad50cc1f8e5b6fc16ff964
|
|
| MD5 |
7e162f86a72e1acdf2132bc91cb04208
|
|
| BLAKE2b-256 |
c26c76fcdff502adedddcb5e2c9380d19be6b9d59f47b79a582a61d8175515e6
|
Provenance
The following attestation bundles were made for pyrfc_read-1.0.2.tar.gz:
Publisher:
python-publish.yml on amarvin/pyrfc-read
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrfc_read-1.0.2.tar.gz -
Subject digest:
dd7fe1ca7493913c8cef2ce1ea88e769e009bcebd8ad50cc1f8e5b6fc16ff964 - Sigstore transparency entry: 152894149
- Sigstore integration time:
-
Permalink:
amarvin/pyrfc-read@ddfc0f9f35a65d01c1495c2d757f9c4cec134ac2 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/amarvin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ddfc0f9f35a65d01c1495c2d757f9c4cec134ac2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyrfc_read-1.0.2-py3-none-any.whl.
File metadata
- Download URL: pyrfc_read-1.0.2-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44a5bacceaacbea8bda5e4e5b2674459079745d409868af3bf09fbf133d99f8f
|
|
| MD5 |
f3eec0f3f34387294f6fec650fcadf7b
|
|
| BLAKE2b-256 |
a76c46445070310b10394242794551163ab8a5ae719e420c1d89a192fbe7ba36
|
Provenance
The following attestation bundles were made for pyrfc_read-1.0.2-py3-none-any.whl:
Publisher:
python-publish.yml on amarvin/pyrfc-read
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrfc_read-1.0.2-py3-none-any.whl -
Subject digest:
44a5bacceaacbea8bda5e4e5b2674459079745d409868af3bf09fbf133d99f8f - Sigstore transparency entry: 152894151
- Sigstore integration time:
-
Permalink:
amarvin/pyrfc-read@ddfc0f9f35a65d01c1495c2d757f9c4cec134ac2 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/amarvin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ddfc0f9f35a65d01c1495c2d757f9c4cec134ac2 -
Trigger Event:
release
-
Statement type: