|
| 1 | +# sap_rfc Ansible Role |
| 2 | + |
| 3 | +The sap_rfc Ansible Role executes SAP RFCs, and performs setup as necessary ([`PyRFC`](https://github.com/SAP/PyRFC) open source by SAP, and [`SAP NWRFC SDK`](https://support.sap.com/en/product/connectors/nwrfcsdk.html)) |
| 4 | + |
| 5 | +## Ansible Role Overview |
| 6 | + |
| 7 | +The sap_rfc Ansible Role uses: |
| 8 | +- the Ansible Module `sap_pyrfc` from the Ansible Collection `sap_libs`, which leverages the open-source [`PyRFC`](https://github.com/SAP/PyRFC) bindings for the proprietary [`SAP NWRFC SDK`](https://support.sap.com/en/product/connectors/nwrfcsdk.html). |
| 9 | +- the Ansible Module `software_center_download` from the Ansible Collection `sap_launchpad`, which on first-run is used to download the [`SAP NWRFC SDK`](https://support.sap.com/en/product/connectors/nwrfcsdk.html). |
| 10 | + |
| 11 | +Appropriate target SAP System user authorizations are required for the execute of the RFCs, and on first-run to obtain the [`SAP NWRFC SDK`](https://support.sap.com/en/product/connectors/nwrfcsdk.html) an SAP User ID with download privileges is required. |
| 12 | + |
| 13 | +The Ansible Role does not contain any system-altering RFCs by default when executed. |
| 14 | + |
| 15 | +The Ansible Task variables define the RFC actions to be executed. Examples are given below. |
| 16 | + |
| 17 | +## Ansible Role Requirements and Dependencies |
| 18 | + |
| 19 | +### Dependencies on other Ansible Roles |
| 20 | + |
| 21 | +To execute successfully, this Ansible Role is dependant on the Ansible Collections: |
| 22 | +- `community.sap_launchpad` on first run |
| 23 | +- `community.sap_libs` for every run |
| 24 | + |
| 25 | +The first run will setup Python altinstall, subsequent runs on the same host will re-use the Python altinstall where PyRFC enabled. This is to protect the System default Python installation from additional or altered versions of Python Packages. |
| 26 | + |
| 27 | +### Operating System |
| 28 | + |
| 29 | +This role has been tested on target systems using RHEL 8.x, and is designed for Linux operating systems. |
| 30 | + |
| 31 | +This role has not been tested and amended for SAP NetWeaver Application Server instantiations on IBM AIX or Windows Server. |
| 32 | + |
| 33 | +Assumptions for executing this role include: |
| 34 | + |
| 35 | +- The target host has access to the SAP System (i.e. the SAP NetWeaver Application Server instance) |
| 36 | +- Registered OS License and OS Package repositories are available (from the relevant content delivery network of the OS vendor) |
| 37 | + |
| 38 | +## Examples |
| 39 | + |
| 40 | +A sample [Ansible Playbook for using the sap_rfc Ansible Role](../../playbooks/sample-sap-rfc.yml) is provided, which provides: |
| 41 | + |
| 42 | +- Ansible Vars for SAP User ID with download privileges for first-run |
| 43 | +- Ansible Vars for SAP System connection details and user authorization |
| 44 | + |
| 45 | +The Ansible Role is designed to provide for all different RFCs. Therefore, the RFC parameters _(IMPORTING, EXPORTING, CHANGING)_ can accept the following data types: |
| 46 | + |
| 47 | +- Data elements (string, integer etc.) |
| 48 | +- ABAP Structure |
| 49 | +- ABAP Table |
| 50 | + |
| 51 | +These RFC parameter data elements are mapped to the equivilant Python data type (e.g. string, integer, dictionary, list). Examples of these are shown below. |
| 52 | + |
| 53 | +### Examples of Ansible Task variables for different RFC parameters |
| 54 | + |
| 55 | +**RFC parameter requires a data element:** |
| 56 | + |
| 57 | +- Commonly string or integer |
| 58 | +- For this input type the PyRFC Python module requires a Python string or integer |
| 59 | +- Ansible Task must declare the parameter name and use a YAML variable |
| 60 | + |
| 61 | +`Ansible Task code example for data element:` |
| 62 | +```yaml |
| 63 | +target_parameters: |
| 64 | + VAR: 'ECHO' |
| 65 | +``` |
| 66 | +
|
| 67 | +**RFC parameter requires an ABAP Structure:** |
| 68 | +
|
| 69 | +- For this input type the PyRFC Python module requires a Python Dictionary. |
| 70 | +- Ansible Task must declare the parameter name and use a YAML dictionary (key:value) |
| 71 | +
|
| 72 | +`Ansible Task code example for ABAP Struture:` |
| 73 | +```yaml |
| 74 | +target_parameters: |
| 75 | + IMPORTSTRUCT: |
| 76 | + RFCFLOAT: 1.1 |
| 77 | + RFCCHAR1: 'A' |
| 78 | +``` |
| 79 | + |
| 80 | +**RFC requires an ABAP Table:** |
| 81 | + |
| 82 | +- For this input type the PyRFC Python module requires a Python List. |
| 83 | +- The Ansible Task must declare the parameter name and use a YAML list |
| 84 | + |
| 85 | +`Ansible Task code example for ABAP Table:` |
| 86 | +```yaml |
| 87 | +target_parameters: |
| 88 | + RFCTABLE: |
| 89 | + - COLUMN0: SAP |
| 90 | + - COLUMN1: 1.23 |
| 91 | +``` |
| 92 | + |
| 93 | +## Supplementary information |
| 94 | + |
| 95 | +The [Supplementary information](./SUPPLEMENTARY.md) provides: |
| 96 | +- Context of SAP NWRFC SDK and PyRFC |
| 97 | + - Explanation of samples from SAP NWRFC SDK |
| 98 | +- Brief explanation of SAP RFCs |
| 99 | +- Security concerns with RFCs and SAP Systems |
0 commit comments