1- ** ATTENTION: THIS IS WORK IN PROGRESS AND NOT TO BE USED UNTIL THIS MESSAGE
2- DISAPPEARS!**
3-
41## About PHP/SAP
52
63PHP/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
96
107[ ![ PHP/SAP] ( res/php-sap.svg )] ( res/php-sap.svg )
118
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
1310 connection to SAP, prepare a SAP remote function call, and invoke a SAP remote
1411 function call.
1512
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
1714 the underlying PHP module.
1815
1916The 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
2421Especially short explanation for people in a hurry.
2522
2623Use ` 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.
2925
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 `
3531
3632``` php
3733<?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;
5165```
52-
66+
67+ Too short? Confused? You should probably read the documentation. 😉
68+
5369## Documentation
5470
5571* [ Usage overview] ( usage )
5672 - [ 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 )
5974* [ DateTime conversions for SAP] ( datetime )
6075
6176[ koucky ] : http://saprfc.sourceforge.net/ " SAPRFC extension module for PHP "
0 commit comments