PHP code example of elielelie / laravel-sap

1. Go to this page and download the library: Download elielelie/laravel-sap library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

elielelie / laravel-sap example snippets




use Elielelie\Sap\Sap;

$sap = app(Sap::class);

$connection = $sap->open();

or

// Connection name defined in the configuration file config/sap.php
 
$connection = $sap->open('name');




// ... connection

$function = $connection->fm('BAPI_USER_GET_DETAIL');

// Get function description.
print_r($function->description());

// Add import parameter.
$function->param('USERNAME', 'USER');

// Perform function call and retrieve result.
$results = $function->execute();

$connection->close();




// ... connection

$function = $connection->fm('RFC_READ_TABLE');

$function->param('QUERY_TABLE', 'USR01')
	->param('OPTIONS', [
		['TEXT' => 'BNAME = 'USER' OR BNAME = 'USER2' OR BNAME LIKE 'USER5*']
	])
	->param('ROWCOUNT', 5)
	->param('DELIMITER', '~')
;

$result = $function->execute();

$connection->close();




// ... connection

$fm = $connection->fmc(Table::class);

$results = $fm->table('USR01')
    ->fields(['BNAME', 'STCOD', 'MANDT' ...])
	->where('bname', ['USER', 'USER5'])
	->orWhere('bname', 'LIKE', 'USER5*')
	->limit(5)
	->get()
;

$ php artisan vendor:publish --provider="Elielelie\Sap\SapServiceProvider"