Skip to Content
avatar image
Former Member

SAP DIAPI PHP Error -10

Error: -10 - The specified resource name cannot be found in the image file.
Language: PHP 7.1.9
SAP Business One 9.2 (9.20.160) PL: 06  (32-bit)
This error occurs when there is a connection to the Sql Server using PDOSqlsrv and/or when it does not run with administrative privileges.
In SAP 8.8 this error does not occur.
The PHP code:

$sap = new \COM("SAPbobsCOM.Company", null, CP_UTF8);
$sap->DbServerType = config("sap.db.type");
$sap->Server = config("sap.server");
$sap->UserName = config("sap.username");
$sap->Password = config("sap.password");
$sap->CompanyDB = config("sap.db.database");
$sap->language = config("sap.language");
$sap->LicenseServer = config("sap.license_server");
$sap->DbUserName = config("sap.db.username");
$sap->DbPassword = config("sap.db.password");
if ($sap->Connect() !== 0) {
echo $sap->GetLastErrorCode() . ":" . $sap->GetLastErrorDescription());
// -10: - The specified resource name cannot be found in the image file.
}

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Oct 24, 2017 at 05:52 AM

    Hi Anderson,

    From SAP Business One Version 9.2 PL05, the communication protocol has been changed from CORBA to HTTPS, it is recommended to use "SLDServer" property instead of "LicenseServer" property. It should be used as below:

    oCompany.SLDServer = "https://ServerAddress:40000/";

    Refer to SAP Note 2375647 for the same.

    Hope it helps!

    Kind regards,
    ANKIT CHAUHAN
    SAP SME Support

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 24, 2017 at 05:47 PM

    Hi ANKIT, thank you for your help. In SAP 9.2 PL 04 I also get the same error, in this version there is no SLDServer property. Are there any places where I can see error details? because this seems to be a generic error.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Anderson,

      Could you please help to debug your program and tell the exact values for the LicenseServer, Server and other properties that your program is using to make the company connection?

      Kind regards,
      ANKIT CHAUHAN
      SAP SME Support

  • avatar image
    Former Member
    Oct 30, 2017 at 12:45 PM

    Hi ANKIT, here it is:

    // If i use PDO, it causes the -10 error.
    $pdo = new PDO("sqlsrv:server=a2rserver;Database=SBO_TESTES", "sa", "password");
    $stmt = $pdo->query("select top 1 ItemName, ItemCode from OITM");
    var_dump($stmt->fetchAll());
    
    // If I do not use PDO, it connects normally.
    $sap = new \COM("SAPbobsCOM.Company", null, CP_UTF8);
    $sap->DbServerType = 7;
    $sap->Server = "a2rserver";
    $sap->UserName = "manager";
    $sap->Password = "PASSWORD";
    $sap->CompanyDB = "SBO_TESTES";
    $sap->language = 29;
    
    //$sap->LicenseServer = "a2rserver:30000";
    // Adding the SLDServer property did not resolve.
    $sap->SLDServer = "https://a2rserver:40000/";
    
    $sap->DbUserName = "sa";
    $sap->DbPassword = "password";
    if ($sap->Connect() !== 0) {
        echo $sap->GetLastErrorCode() . ":" . $sap->GetLastErrorDescription();
        // -10: - The specified resource name cannot be found in the image file.
    }
    
    // This error occurs in SAP 9.2 PL 04 and PL 05
    
    Add comment
    10|10000 characters needed characters exceeded

    • Hi Anderson,

      Unfortunately, I am not getting what is meant by PDO. Also, I do not understand the need for a database connection

      $pdo = new PDO("sqlsrv:server=a2rserver;Database=SBO_TESTES", "sa", "password");
      $stmt = $pdo->query("select top 1 ItemName, ItemCode from OITM");
      var_dump($stmt->fetchAll());<br>

      before the company connection.

      If I were you, I could have used the query: "Select top 1 ItemName, ItemCode from OITM" after making the company connection too.

      Could you please explain a bit?

      Kind regards,

      ANKIT CHAUHAN

      SAP SME Support

  • avatar image
    Former Member
    Oct 30, 2017 at 02:06 PM

    I use Laravel as a framwork to develop integrations of other systems with SAP.

    Before saving the data directly to SAP, they are stored in an intermediate database. This query of "OITM" is just one example.

    An example of integration:

    I have an ordering application where I import to SAP through an API, before writing to SAP, save the information in a database, do some processing and then save the purchase order in SAP.

    Before saving to SAP, I will consult with this intermediary database to see if there are any orders to write to SAP. Since the connection to SAP takes about 15 seconds, I would like to open it only after verifying that there are requests to save, so that it generates error -10 because I use PDO connection.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      Can you make sure that the company database exists through which you want to make company connection? Make sure that all the passwords are correct.

      One important thing to note that the Server Name and License Server name should be the same as in SLD (Including the upper case and lower case etc.) .

      Kind regards,
      ANKIT CHAUHAN
      SAP SME Support

  • avatar image
    Former Member
    Oct 30, 2017 at 02:26 PM

    Yes, they are all correct. If I open the connection with SAP (DIAPI) before the connection to the intermediate database (PDO) works, the opposite does not work (error -10).

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 07, 2017 at 10:48 AM

    After checking some logs, I noticed that the error is intermittent. I also noticed that the file "C:\Program Files (x86)\SAP\SAP Business One DI API\Conf\b1-local-machine.xml" the tag name="SLDAddress" ranges from "https://ServerAddress:40000 "and" https://ServerAddress:30010".

    But I can not find a solution.

    Add comment
    10|10000 characters needed characters exceeded