1
- ** ATTENTION: THIS IS WORK IN PROGRESS AND NOT TO BE USED UNTIL THIS MESSAGE
2
- DISAPPEARS!**
3
-
4
1
## About PHP/SAP
5
2
6
3
PHP/SAP defines a layer of abstraction between actual SAP remote function calls
@@ -9,11 +6,11 @@ PHP/SAP defines a layer of abstraction between actual SAP remote function calls
9
6
10
7
[ ![ PHP/SAP] ( res/php-sap.svg )] ( res/php-sap.svg )
11
8
12
- The [ interfaces] ( interfaces ) define a common denominator on how to configure a
9
+ The interfaces define a common denominator on how to configure a
13
10
connection to SAP, prepare a SAP remote function call, and invoke a SAP remote
14
11
function call.
15
12
16
- The [ common classes and exceptions] ( common ) add logic that is not specific to
13
+ The common classes and exceptions add logic that is not specific to
17
14
the underlying PHP module.
18
15
19
16
The module specific implementations contain code that is specific to [ the
@@ -24,38 +21,56 @@ The module specific implementations contain code that is specific to [the
24
21
Especially short explanation for people in a hurry.
25
22
26
23
Use ` composer require ` to add PHP/SAP to your project. Depending on the
27
- [ PHP module] ( php-modules ) you need to require a certain PHP/SAP composer
28
- package.
24
+ [ PHP module] ( php-modules ) you need to require a certain PHP/SAP package.
29
25
30
- Module Author | Module | supported PHP versions | composer require
31
- ------------------------ | ----------- | ---------------------- | -------------------------
32
- [ Eduard Koucky ] [ koucky ] | ` saprfc ` | PHP 4.x - 5.5.x | ` composer require php-sap/saprfc-koucky `
33
- [ Piers Harding ] [ harding ] | ` sapnwrfc ` | PHP 5.x | ` composer require php-sap/saprfc-harding `
34
- [ Gregor Kralik ] [ kralik ] | ` sapnwrfc ` | PHP 7.x | ` composer require php-sap/saprfc-kralik `
26
+ ` composer require php-sap/saprfc-koucky `
27
+ or
28
+ ` composer require php-sap/saprfc-harding `
29
+ or
30
+ ` composer require php-sap/saprfc-kralik `
35
31
36
32
``` php
37
33
<?php
38
- use phpsap\saprfc\SapRfcConfigA;
39
- use phpsap\saprfc\SapRfcConnection;
40
-
41
- $result = (new SapRfcConnection(new SapRfcConfigA([
42
- 'ashost' => 'sap.example.com',
43
- 'sysnr' => '001',
44
- 'client' => '002',
45
- 'user' => 'username',
46
- 'passwd' => 'password'
47
- ])))
48
- ->prepareFunction('MY_COOL_SAP_REMOTE_FUNCTION')
49
- ->setParam('INPUT_PARAM', 'some input value')
50
- ->invoke();
34
+ //Include the composer autoloader ...
35
+ require_once 'vendor/autoload.php';
36
+ //... and add the namespaces of the classes used.
37
+ use phpsap\classes\Config\ConfigTypeA;
38
+ use phpsap\DateTime\SapDateTime;
39
+ use phpsap\saprfc\SapRfc;
40
+ /**
41
+ * Create an instance of the SAP remote function using its
42
+ * name, input parameters, and connection configuration.
43
+ *
44
+ * The imaginary SAP remote function requires a
45
+ * date as input and will return a date as output.
46
+ *
47
+ * In this case the configuration array is defined manually.
48
+ */
49
+ $result = (new SapRfc(
50
+ 'MY_COOL_SAP_REMOTE_FUNCTION',
51
+ [
52
+ 'IV_DATE' => (new DateTime('2019-12-31'))
53
+ ->format(SapDateTime::SAP_DATE)
54
+ ],
55
+ new ConfigTypeA([
56
+ ConfigTypeA::JSON_ASHOST => 'sap.example.com',
57
+ ConfigTypeA::JSON_SYSNR => '999',
58
+ ConfigTypeA::JSON_CLIENT => '001',
59
+ ConfigTypeA::JSON_USER => 'username',
60
+ ConfigTypeA::JSON_PASSWD => 'password'
61
+ ])
62
+ ))->invoke();
63
+ //The output array contains a DateTime object.
64
+ echo $result['OV_DATE']->format('Y-m-d') . PHP_EOL;
51
65
```
52
-
66
+
67
+ Too short? Confused? You should probably read the documentation. 😉
68
+
53
69
## Documentation
54
70
55
71
* [ Usage overview] ( usage )
56
72
- [ Configure a connection] ( saprfc-config )
57
- - [ Establish a connection] ( saprfc-connection )
58
- - [ Invoke a function call] ( saprfc-function )
73
+ - [ Configure the SAP remote function call] ( saprfc-function )
59
74
* [ DateTime conversions for SAP] ( datetime )
60
75
61
76
[ koucky ] : http://saprfc.sourceforge.net/ " SAPRFC extension module for PHP "
0 commit comments