Quantcast
Channel: SCN : Popular Discussions - SAP NetWeaver Gateway Developer Center
Viewing all articles
Browse latest Browse all 1657

How to use OData SDK PHP create an entity in SAP

$
0
0

Hi,

I‘m using OData SDK PHP to consume the odata in SAP system, I can use this get_entityset from SAP but not able to Create entity in SAP

my PHP code is like this

 

 

<?php
require_once "Z_WE_ASSCOCUSTOPENID_SRV_Entities.php";   //connect    $OData = new Z_WE_ASSCOCUSTOPENID_SRV_Entities
('http://192.168.1.138:8008/sap/opu/odata/sap/Z_WE_ASSCOCUSTOPENID_SRV/') ;
$OData->Credential = new WindowsCredential($_POST["userName"],$_POST["pwd"]);   try
{    //Create a Customer php Object    $OpenId = OpenId::CreateOpenId( "","",$_POST["Name"],$_POST["CustomerName"],$_POST["Code"]);    //inserting Customers object context tracking system    $OData->AddObject('OpenIdSet', $OpenId);   //SaveChange insert the object into data service   $Odata->SaveChanges();
}
catch(ODataServiceException $exception)
{    Echo $exception->getError();
}
?>
{    Echo $exception->getError();
}
?>

I will get the error Undefined property:z_we_asscocustopenid_srv_entities::$nextChange in E:\xx\xx\Context\ObjectContext.php on line 789 Unauthorized

but this property is the ODATA SDK PHP file I never change this

can you help me?


Viewing all articles
Browse latest Browse all 1657

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>