定制 elielelie/laravel-sap 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

elielelie/laravel-sap

最新稳定版本:v1.0.5

Composer 安装命令:

composer require elielelie/laravel-sap

包简介

SAP features integrated with Laravel.

README 文档

README

SAP features integrated with Laravel.

Maintainer PHP VERSION BUILD LICENSE

Installation

Make sure you have the php7-sapnwrfc extension installed.

composer require elielelie/laravel-sap

To establish the connection with SAP, you need to add the following variables to your .env file:

SAP_HOST        Host
SAP_SYSTEM      System number
SAP_LANGUAGE    Language default
SAP_CLIENT      Client instance
SAP_USERNAME    Username
SAP_PASSWORD    Password    

You can publish the configuration file and add new connections by running:

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

Usage

Connecting to SAP

<?php

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');

Perform Function Module call

<?php

// ... 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();

Getting details about a user using RFC_READ_TABLE

<?php

// ... 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();

Query Builder usage

<?php

// ... 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()
;

License

This software is licensed under the MIT license. See LICENSE for details.

Legal Notice

SAP and other SAP products and services mentioned herein are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries.

统计信息

  • 总下载量: 778
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-16