Skip to content

PHP/SAP implementation for Kouckys legacy saprfc module

License

Notifications You must be signed in to change notification settings

php-sap/saprfc-koucky

Folders and files

NameName
Last commit message
Last commit date
Jan 29, 2020
Jan 31, 2020
Jan 16, 2019
Jan 27, 2020
Feb 3, 2020
Dec 17, 2018
Feb 3, 2020
Oct 5, 2021
Oct 5, 2021
Jan 4, 2019

Repository files navigation

PHP/SAP implementation for Kouckys legacy saprfc module

License: MIT Build Status Maintainability Test Coverage

This repository implements the PHP/SAP interface for Eduard Kouckys legacy saprfc PHP module.

Usage

composer require php-sap/saprfc-koucky
<?php
//Include the composer autoloader ...
require_once 'vendor/autoload.php';
//... and add the namespaces of the classes used.
use phpsap\classes\Config\ConfigTypeA;
use phpsap\DateTime\SapDateTime;
use phpsap\saprfc\SapRfc;
/**
 * Create an instance of the SAP remote function using its
 * name, input parameters, and connection configuration.
 *
 * The imaginary SAP remote function requires a
 * date as input and will return a date as output.
 *
 * In this case the configuration array is defined manually.
 */
$result = (new SapRfc(
  'MY_COOL_SAP_REMOTE_FUNCTION',
  [
      'IV_DATE' => (new DateTime('2019-12-31'))
                   ->format(SapDateTime::SAP_DATE)
  ],
  new ConfigTypeA([
      ConfigTypeA::JSON_ASHOST => 'sap.example.com',
      ConfigTypeA::JSON_SYSNR  => '999',
      ConfigTypeA::JSON_CLIENT => '001',
      ConfigTypeA::JSON_USER   => 'username',
      ConfigTypeA::JSON_PASSWD => 'password'
  ])
))->invoke();
//The output array contains a DateTime object.
echo $result['OV_DATE']->format('Y-m-d') . PHP_EOL;

For further documentation, please read the documentation on PHP/SAP!