SAP에 BAPI로부터 Web Service를 생성하여 SAP에 일부 AccountDocuments를 삽입했습니다. 이 경우 시스템은 성공적인 삽입 호출 후에 COMMIT 호출을 필요로합니다. 이 두 함수는 모두 "하나의 컨텍스트"에서 호출되어야합니다. 이제 어떻게 PHP에서이 작업을 수행 할 수 있는지 또는이 작업을 수행 할 방법이 있는지를 모르는 문제에 직면하고 있습니까? 다음 예제를 만들었지 만 작동하지 않습니다. COMMIT 함수는 실행되지만 SAP에는 영향을 미치지 않습니다. 첫 번째 호출에서 "데이터가 성공적으로 예약되었습니다"가 반환되지만 데이터베이스의 데이터를 볼 수 없습니다. SAP에서 COMMIT 호출로이를 확인해야한다는 것을 알고 있습니다. SE37에는 2 개의 함수 호출을 하나의 시퀀스에 넣는 방법이 있습니다. 나는 PHP 방식으로 이것을 수행하고있다.SAP 및 php SOAP COMMIT
function insertAccntDoc($accntgl, $currAmount, $docHeader, $accntTax)
{
#Define Authentication
$SOAP_AUTH = array('login' => SAPUSER,
'password' => SAPPASSWORD);
$WSDL = "url_to_my_wsdl";
#Create Client Object, download and parse WSDL
$client = new SoapClient($WSDL, $SOAP_AUTH);
#Setup input parameters (SAP Likes to Capitalise the parameter names)
$params = array(
'AccountGl' => $accntgl,
'CurrencyAmount' => $currAmount,
'DocumentHeader' => $docHeader,
'AccountTax' => $accntTax
);
#Call Operation (Function). Catch and display any errors
try
{
$result = $client->AcctngDocumentPost($params);
$result = $client->BapiServiceTransactionCommit();
$result->Gebucht = 'Committed';
if(count($result->Return) > 1)
{
$client->BapiServiceTransactionRollback();
$result->Gebucht = 'Rollback';
}
else if($result->Return->item->Type == 'S')
{
try
{
$client->BapiServiceTransactionCommit();
$result->Gebucht = 'Committed';
}
catch(SoapFault $exception)
{
$client->BapiServiceTransactionRollback();
$result->Fehler = "***Caught Exception***<br>".$exception."<br>***END Exception***<br>";
$result->Gebucht = 'Fehler beim Committen';
}
}
}
catch (SoapFault $exception)
{
$client->BapiServiceTransactionRollback();
$result->Fehler = "***Caught Exception***<br>".$exception."<br>***END Exception***<br>";
$result->Gebucht = 'Fehler beim Anlegen';
}
#Output the results
$result->FlexRet = 'insertAccntDoc';
return $result;
}
고마워요!