Skip to content

ictorch/icsap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

library to consume sap service layer

Usage

// get data form sap
$sapClient = (new SapClientFactory())();
$query = http_build_query([
  '$select'=>"CardCode,CardName",
  '$filter'=>"CardType eq 'cSupplier'"
  ]);
  $response = $this->sapClient->fetch("BusinessPartners?$query", HTTP_GET, [], ["Prefer" => "odata.maxpagesize=100"]);
// put data to sap
$sapClient = (new SapClientFactory())();
try {
  $response = $this->sapClient->fetch("Items", HTTP_POST, [
    "ItemCode" => "i001",
    "ItemName" => "Item1",
    "ItemType" => "itItem"
  ]);
} catch (\SapException $e) {
  print_r($e->getJsonErrors());
}