Skip to content

Commit ab65ece

Browse files
committed
start with a project description
1 parent db58d3e commit ab65ece

File tree

3 files changed

+72
-36
lines changed

3 files changed

+72
-36
lines changed

index.md

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,23 @@
1-
**ATTENTION: THIS IS WORK IN PROGRESS AND NOT TO BE USED UNTIL THIS MESSAGE DISAPPEARS!**
1+
**ATTENTION: THIS IS WORK IN PROGRESS AND NOT TO BE USED UNTIL THIS MESSAGE
2+
DISAPPEARS!**
23

34
## What is this?
45

5-
PHP/SAP defines an layer of abstraction between actual SAP remote function calls and your PHP-Code. Therefore PHP/SAP provides three types of interfaces for abstraction:
6-
1. Configuring a connection to an SAP application server.
7-
2. Connecting to an SAP application server
8-
3. Calling a remote function on an SAP application server.
6+
PHP/SAP defines a layer of abstraction between actual SAP remote function calls
7+
and your PHP-Code. As to why this project was created, you can read the
8+
[motivation](motivation).
99

10-
## The motivation
10+
[![PHP/SAP](res/php-sap.png)](res/php-sap.svg)
1111

12-
In case you have legacy code written for PHP <= 5.x using a PHP module to call SAP remote functions, and you need to update this code to a PHP version >= 7.x, this project is for you.
12+
The [interfaces][interfaces] define a common denominator on how to configure a
13+
connection to SAP, prepare a SAP remote function call, and invoke a SAP remote
14+
function call.
1315

14-
There are currently several open source PHP modules available that are compiled using the SAP RFC SDK or SAP Netweaver RFC SDK. Each one of them handles the main tasks, connecting and calling a remote function, quite differently. To complicate things, none of them are available for old and new versions of PHP.
16+
The [common classes and exceptions][common] add logic that is not specific to
17+
the underlying PHP module.
1518

16-
In order to clean this up, you need to remove the dependency of your PHP code on one of these modules. After that you will be able to switch between modules and PHP versions without the need to touch your code calling SAP remote functions.
19+
The module specific implementations contain code that is specific to [the
20+
underlying PHP-module](php-modules).
1721

18-
```php
19-
<?php
20-
//stored configuration, JSON encoded
21-
$config = '{
22-
"ashost": "sap.example.com",
23-
"sysnr": "001",
24-
"client": "01",
25-
"user": "username",
26-
"passwd": "password"
27-
}';
28-
//establish a connection using the stored configuration
29-
$connection = new SapRfcConnection(new SapRfcConfigA($config));
30-
//prepare a function call
31-
$function = $connection->prepareFunction('remoteFunctionName');
32-
//call the remote function
33-
$result = $function->invoke(['paramName' => 'value']);
34-
```
35-
36-
## PHP SAP RFC modules
37-
38-
I am aware of the following three PHP modules.
39-
40-
author | module Name | supported PHP versions | composer package
41-
------------- | ----------- | ---------------------- | ----------------------
42-
Eduard Koucky | `saprfc` | PHP 4.x - 5.5.x | `phpsap/saprfc-koucky`
43-
Piers Haring | `sapnwrfc` | PHP 5.x | `phpsap/saprfc-harding`
44-
Gregor Kralik | `sapnwrfc` | PHP 7.x | `phpsap/saprfc-kralik`
22+
[interfaces]: https://github.com/php-sap/interfaces "Interfaces for implementing the PHP/SAP API."
23+
[common]: https://github.com/php-sap/common "Exceptions and abstract classes containing logic for PHP/SAP that is not specific to the underlying PHP module."

motivation.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
## The motivation
2+
3+
I inherited a project running on PHP 5.5.x containing undocumented code dealing
4+
with SAP remote function calls. As a way to connect, [Eduard Kouckys SAPRFC
5+
module][koucky] had been used. In order to switch to a more current PHP
6+
version, I had to replace the PHP module too. The question was: How can I be
7+
sure, that the code of this project dealing with SAP remote function calls
8+
will not be the source of errors? That lead to the following requirements:
9+
10+
1. Any code dealing with the actual PHP module has to be simple in order to
11+
reduce the risk of errors.
12+
2. The code in my project dealing with SAP remote function calls has to work
13+
for several [PHP modules](php-modules) and it still has to work, in case
14+
of a switch to a different way of communicating with SAP.
15+
3. Any in- and output of a SAP remote function call has to be defined as
16+
methods as a way of documentation.
17+
4. The configuration has to be as interchangeable as possible between the PHP
18+
modules.
19+
20+
Example:
21+
22+
```php
23+
<?php
24+
25+
use phpsap\saprfc\SapRfcConnection;
26+
use phpsap\saprfc\SapRfcConfigA;
27+
28+
//stored configuration, JSON encoded
29+
$config = '{
30+
"ashost": "sap.example.com",
31+
"sysnr": "001",
32+
"client": "01",
33+
"user": "username",
34+
"passwd": "password"
35+
}';
36+
//establish a connection using the stored configuration
37+
$connection = new SapRfcConnection(new SapRfcConfigA($config));
38+
//prepare a function call
39+
$function = $connection->prepareFunction('remoteFunctionName');
40+
//call the remote function
41+
$result = $function->invoke(['paramName' => 'value']);
42+
```
43+
44+
[koucky]: http://saprfc.sourceforge.net/ "SAPRFC extension module for PHP"

php-modules.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## PHP SAP RFC modules
2+
3+
The following PHP modules are currently supported by PHP/SAP.
4+
5+
Author | Module | supported PHP versions | PHP/SAP composer package
6+
----------------------- | ----------- | ---------------------- | ------------------------
7+
[Eduard Koucky][koucky] | `saprfc` | PHP 4.x - 5.5.x | `phpsap/saprfc-koucky`
8+
[Piers Haring][harding] | `sapnwrfc` | PHP 5.x | `phpsap/saprfc-harding`
9+
[Gregor Kralik][kralik] | `sapnwrfc` | PHP 7.x | `phpsap/saprfc-kralik`
10+
11+
[koucky]: http://saprfc.sourceforge.net/ "SAPRFC extension module for PHP"
12+
[harding]: https://github.com/piersharding/php-sapnwrfc "SAP RFC Connector using the SAP NW RFC SDK for PHP"
13+
[kralik]: https://github.com/gkralik/php7-sapnwrfc "SAP NW RFC SDK extension for PHP7"

0 commit comments

Comments
 (0)