Skip to content

Commit 1f00cb9

Browse files
committed
apply configuration before adding parameters as long as the API is not cached #4
1 parent 00c1a1f commit 1f00cb9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

saprfc-function.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@ use phpsap\saprfc\SapRfc;
3232
* date as input and will return a date as output.
3333
*/
3434
$function = new SapRfc('MY_COOL_SAP_REMOTE_FUNCTION');
35-
/**
36-
* SAP has a different idea than ISO about formatting dates and times. However
37-
* PHP/SAP has your back with \phpsap\DateTime\SapDateTime extending DateTime.
38-
*/
39-
$inputDate = new DateTime('2019-12-31');
40-
$function->setParams([
41-
'IV_DATE' => $inputDate->format(SapDateTime::SAP_DATE)
42-
]);
4335
/**
4436
* The instance in `$function` has no way to establish a connection
4537
* because it lacks the necessary configuration. Let's add that
@@ -53,6 +45,14 @@ $configuration = new ConfigTypeA([
5345
ConfigTypeA::JSON_PASSWD => 'password'
5446
]);
5547
$function->setConfiguration($configuration);
48+
/**
49+
* SAP has a different idea than ISO about formatting dates and times. However
50+
* PHP/SAP has your back with \phpsap\DateTime\SapDateTime extending DateTime.
51+
*/
52+
$inputDate = new DateTime('2019-12-31');
53+
$function->setParams([
54+
'IV_DATE' => $inputDate->format(SapDateTime::SAP_DATE)
55+
]);
5656
/**
5757
* Now let's encode this remote function call.
5858
*/
@@ -85,8 +85,8 @@ Output
8585
```
8686

8787
**Attention**: An encoded SAP remote function call contains no connection
88-
configuration. Access data and servers may change, but the name, the API and
89-
the parameters are not expected to change.
88+
configuration. Access data and servers may change more easily than the name,
89+
the API and the parameters.
9090

9191
Now let's unfreeze this SAP remote function call.
9292

0 commit comments

Comments
 (0)